Skip to content
Snippets Groups Projects
Commit 3595bdc0 authored by David Trattnig's avatar David Trattnig
Browse files

Extended communication to include filename.

parent 38483da6
No related branches found
No related tags found
No related merge requests found
......@@ -130,11 +130,11 @@ class Guru():
self.parser.add_argument("-rm", "--redis-message", action="store", dest="redis_message", default=False, metavar=("CHANNEL", "MESSAGE"), nargs=2, help="Send a redis message to the Listeners")
# calls from liquidsoap
self.parser.add_argument("-gnf", "--get-next-file-for", action="store", dest="get_file_for", default=False, metavar="PLAYLISTTYPE", help="For which type you wanna GET a next audio file?")
self.parser.add_argument("-snf", "--set-next-file-for", action="store", dest="set_file_for", default=False, metavar=("PLAYLISTTYPE", "FILE"), nargs=2, help="For which type you wanna SET a next audio file?")
self.parser.add_argument("-np", "--now-playing", action="store_true", dest="now_playing", default=False, help="Which source is now playing")
self.parser.add_argument("-ip", "--init-player", action="store_true", dest="init_player", default=False, help="Reset liquidsoap volume and mixer activations?")
self.parser.add_argument("-ts", "--adapt-trackservice-title", action="store", dest="adapt_trackservice_title", default=False, metavar="TITLE", help="Update trackservice entry due to fallback")
self.parser.add_argument("-gnf", "--get-next-file-for", action="store", dest="get_file_for", default=False, metavar="PLAYLISTTYPE", help="For which type you wanna GET a next audio file?")
self.parser.add_argument("-snf", "--set-next-file-for", action="store", dest="set_file_for", default=False, metavar=("PLAYLISTTYPE", "FILE"), nargs=2, help="For which type you wanna SET a next audio file?")
self.parser.add_argument("-np", "--now-playing", action="store_true", dest="now_playing", default=False, help="Which source is now playing")
self.parser.add_argument("-ip", "--init-player", action="store_true", dest="init_player", default=False, help="Reset liquidsoap volume and mixer activations?")
self.parser.add_argument("-ts", "--adapt-trackservice-title", action="store", dest="adapt_trackservice_title", default=False, metavar="INFO", help="Update trackservice entry due to fallback")
if len(sys.argv) == 1:
raise ValueError("No Argument passed!")
......
......@@ -175,13 +175,16 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
self.execute(RedisChannel.GNF_REPLY.value, self.scheduler.get_next_file_for, playlist)
elif item["data"].find("adapt_trackservice_title") >= 0:
artist = item["data"].split("|+|+|")[1]
title = item["data"].split("|+|+|")[2]
file = item["data"].split("|+|+|")[1]
artist = item["data"].split("|+|+|")[2]
title = item["data"].split("|+|+|")[3]
if not artist:
artist = "n/a"
artist = ""
if not title:
title = "n/a"
self.execute(RedisChannel.TS_REPLY.value, self.scheduler.adapt_trackservice_title, artist, title)
self.execute(RedisChannel.TS_REPLY.value, self.scheduler.adapt_trackservice_title, file, artist, title)
elif item["data"] == "recreate_db":
self.execute(RedisChannel.RDB_REPLY.value, self.scheduler.recreate_database)
......@@ -193,10 +196,13 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
raise RedisConnectionException("ServerRedisAdapter Cannot understand command: " + item["data"])
# ------------------------------------------------------------------------------------------ #
def execute(self, channel, f, param1=None, param2=None):
if param1:
if param2:
reply = f(param1, param2)
def execute(self, channel, f, param1=None, param2=None, param3=None):
if param1 != None:
if param2 != None:
if param3 != None:
reply = f(param1, param2, param3)
else:
reply = f(param1, param2)
else:
reply = f(param1)
else:
......
......@@ -314,7 +314,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
def adapt_trackservice_title(self, artist, title):
def adapt_trackservice_title(self, filename, artist, title):
"""
Updates the track-service entry with the info from a fallback track/playlist.
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment