diff --git a/guru.py b/guru.py index 9ac3143b66d7d4f89bb1c7989fdd1b3d2797e571..509aab2961f9e2536443f6496f2b85b5406cd9d7 100755 --- a/guru.py +++ b/guru.py @@ -113,6 +113,7 @@ class Guru(): self.parser.add_argument("-gam", "--get-active-mixer", action="store_true", dest="get_active_mixer", default=False, help="Which mixer is activated?") self.parser.add_argument("-pms", "--print-mixer-status", action="store_true", dest="get_mixer_status", default=False, help="Prints all mixer sources and their states") self.parser.add_argument("-pap", "--print-act-programme", action="store_true", dest="get_act_programme", default=False, help="Prints the actual Programme, the controller holds") + self.parser.add_argument("-s", "--status", action="store_true", dest="get_status", default=False, help="Returns the Engine Status as JSON") # liquid manipulation self.parser.add_argument("-am", "--select-mixer", action="store", dest="select_mixer", default=-1, metavar="MIXERNAME", help="Which mixer should be activated?") diff --git a/modules/base/enum.py b/modules/base/enum.py index 1d4fe25d04eb2155fbeaaea893add2cc22fd1b21..0ef1880529b3e81b63638bdc4e2116508e4a276e 100644 --- a/modules/base/enum.py +++ b/modules/base/enum.py @@ -32,6 +32,7 @@ class RedisChannel(Enum): DPE_REPLY = "delete_playlist_entry_reply" FNP_REPLY = "fetch_new_programme_reply" GAP_REPLY = "get_act_programme_reply" + GS_REPLY = "get_status_reply" GCS_REPLY = "get_connection_status_reply" GNF_REPLY = "get_next_file_reply" IPE_REPLY = "insert_playlist_entry_reply" diff --git a/modules/cli_tool/padavan.py b/modules/cli_tool/padavan.py index a96f515640dd50103968bf300453cd47a4a92c2b..56c3c8eb0b2f6f4dd5391d47de2a38d3b39f0ebe 100644 --- a/modules/cli_tool/padavan.py +++ b/modules/cli_tool/padavan.py @@ -59,6 +59,9 @@ class Padavan: elif self.args.get_act_programme: self.get_act_programme() + elif self.args.get_status: + self.get_status() + elif self.args.get_connection_status: self.get_connection_status() @@ -155,6 +158,16 @@ class Padavan: actprogramme = json.loads(json_reply) self.print_programme(actprogramme) + + def get_status(self): + """ + Retrieves the Engine's status information. + """ + json_reply = self.send_and_wait_redis("aura", "get_status", RedisChannel.GS_REPLY) + # status = json.loads(json_reply) + self.stringreply = json_reply + + # ------------------------------------------------------------------------------------------ # def get_connection_status(self): json_reply = self.send_and_wait_redis("aura", "get_connection_status", RedisChannel.GCS_REPLY) diff --git a/modules/communication/redis/adapter.py b/modules/communication/redis/adapter.py index 751a2d15fcf03989a1797c7f63ccc70815a13387..06eefd546bf743830f242a7bb37e6815d75ed542 100644 --- a/modules/communication/redis/adapter.py +++ b/modules/communication/redis/adapter.py @@ -156,6 +156,13 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger): elif item["data"] == "get_act_programme": self.execute(RedisChannel.GAP_REPLY.value, self.scheduler.get_act_programme_as_string) + elif item["data"] == "get_status": + def get_status_string(): + status = self.soundsystem.monitoring.get_status() + return str(status) + + self.execute(RedisChannel.GS_REPLY.value, get_status_string) + # elif item["data"] == "get_connection_status": # self.execute(RedisChannel.GCS_REPLY.value, self.connection_tester.get_connection_status) @@ -179,8 +186,6 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger): elif item["data"] == "recreate_db": self.execute(RedisChannel.RDB_REPLY.value, self.scheduler.recreate_database) - elif item["data"] == "status": - return True else: raise RedisConnectionException("ServerRedisAdapter Cannot understand command: " + item["data"])