From c544846982bc15dc1e5d8a47a8a5b8510168b183 Mon Sep 17 00:00:00 2001 From: Gottfried Gaisbauer <gogo@servus.at> Date: Sat, 10 Aug 2019 16:24:27 +0200 Subject: [PATCH] removed delete/insert playlist. its also not necessary at engine level --- guru.py | 4 ---- modules/cli_tool/padavan.py | 12 ---------- modules/communication/redis/adapter.py | 10 -------- modules/scheduling/scheduler.py | 33 -------------------------- 4 files changed, 59 deletions(-) diff --git a/guru.py b/guru.py index 79f38d9d..e4ae8c0a 100755 --- a/guru.py +++ b/guru.py @@ -122,10 +122,6 @@ class Guru(AuraConfig): self.parser.add_argument("-fnp", "--fetch-new-programmes", action="store_true", dest="fetch_new_programme", default=False, help="Fetch new programmes from calendarurl in comba.ini") self.parser.add_argument("-pmq", "--print-message-queue", action="store_true", dest="print_message_queue", default=False, help="Prints message queue") - # playlist manipulation - self.parser.add_argument("-dpe", "--delete-playlist-entry", action="store", dest="delete_playlist_entry", default=0, metavar="INDEX", nargs=1, help="Delete Playlistentry at INDEX") - self.parser.add_argument("-ipe", "--insert-playlist-entry", action="store", dest="insert_playlist_entry", default=0, metavar=("FROMTIME", "SOURCE"), nargs=2, help="Add a new Playlistentry at a given index. Set fromtime with this format: 2017-12-31T13:30:00") # , type=valid_playlist_entry) - # send a redis message 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") diff --git a/modules/cli_tool/padavan.py b/modules/cli_tool/padavan.py index 6154b795..0fc34f0d 100644 --- a/modules/cli_tool/padavan.py +++ b/modules/cli_tool/padavan.py @@ -224,18 +224,6 @@ class Padavan: self.send_redis(channel, message) self.stringreply = "Message '"+message+"' sent to channel '"+channel+"'" - # ------------------------------------------------------------------------------------------ # - def delete_playlist_entry(self, index): - json_reply = self.send_and_wait_redis("aura", "delete_playlist_entry " + str(index), RedisChannel.DPE_REPLY) - actprogramme = simplejson.loads(json_reply) - self.print_programme(actprogramme) - - # ------------------------------------------------------------------------------------------ # - def insert_playlist_entry(self, fromtime, source): - json_reply = self.send_and_wait_redis("aura", "insert_playlist_entry " + fromtime + " " + source, RedisChannel.IPE_REPLY) - actprogramme = simplejson.loads(json_reply) - self.print_programme(actprogramme) - # ------------------------------------------------------------------------------------------ # def print_message_queue(self): self.stringreply = self.send_and_wait_redis("aura", "print_message_queue", RedisChannel.PMQ_REPLY) diff --git a/modules/communication/redis/adapter.py b/modules/communication/redis/adapter.py index 3f9da422..947bce9e 100644 --- a/modules/communication/redis/adapter.py +++ b/modules/communication/redis/adapter.py @@ -162,16 +162,6 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger): elif item["data"] == "print_message_queue": self.execute(RedisChannel.PMQ_REPLY.value, self.scheduler.print_message_queue) - elif item["data"].find("delete_playlist_entry") >= 0: - entrynum = item["data"].split()[1] - self.logger.info("entry to del: " + str(entrynum)) - self.execute(RedisChannel.DPE_REPLY.value, self.scheduler.delete_playlist_entry, entrynum) - - elif item["data"].find("insert_playlist_entry") >= 0: - extracted = item["data"].split()[1:3] - param = {"fromtime": extracted[0], "source": extracted[1]} - self.execute(RedisChannel.IPE_REPLY.value, self.scheduler.insert_playlist_entry, param) - elif item["data"].find("set_next_file") >= 0: playlist = item["data"].split()[1] playlist = playlist[0:len(playlist)-8] diff --git a/modules/scheduling/scheduler.py b/modules/scheduling/scheduler.py index 6d808df7..075efb76 100644 --- a/modules/scheduling/scheduler.py +++ b/modules/scheduling/scheduler.py @@ -337,39 +337,6 @@ class AuraScheduler(ExceptionLogger, threading.Thread): return message_queue - # ------------------------------------------------------------------------------------------ # - def delete_playlist_entry(self, index): - found = False - - for p in self.programme: - if p.programme_index == int(index): - p.delete(True) - self.load_programme_from_db() - found = True - break - - if not found: - self.logger.warning("Nothing to delete") - - return self.get_act_programme_as_string() - - # ------------------------------------------------------------------------------------------ # - def insert_playlist_entry(self, fromtime_source): - fromtime = fromtime_source["fromtime"] - source = fromtime_source["source"] - - entry = ScheduleEntry() - entry.entry_start = fromtime - entry.source = source - entry.playlist_id = 0 - entry.schedule_id = 0 - entry.entry_num = ScheduleEntry.select_next_manual_entry_num() - - entry.store(add=True, commit=True) - self.load_programme_from_db() - - return self.get_act_programme_as_string() - # ------------------------------------------------------------------------------------------ # def fetch_new_programme(self): self.logger.info("trying to fetch new programme") -- GitLab