From 641520dcbb839c6c48bd200557ab9b83a391fc72 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 7 Jul 2018 18:32:11 +0200 Subject: [PATCH] Optimize code --- resources/lib/playlists.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/resources/lib/playlists.py b/resources/lib/playlists.py index 822bfbb6..5ec2727c 100644 --- a/resources/lib/playlists.py +++ b/resources/lib/playlists.py @@ -493,9 +493,6 @@ class PlaylistEventhandler(events.FileSystemEventHandler): if not state.SYNC_PLAYLISTS: # Sync is deactivated return - if event.is_directory: - # todo: take care of folder renames - return try: _, extension = event.src_path.rsplit('.', 1) except ValueError: @@ -590,13 +587,9 @@ class PlaylistQueue(OrderedSetQueue): def _put(self, item): if item[0].is_directory: self.unfinished_tasks -= 1 - elif item not in self._set_of_items: - Queue.Queue._put(self, item) - self._set_of_items.add(item) else: - # `put` increments `unfinished_tasks` even if we did not put - # anything into the queue here - self.unfinished_tasks -= 1 + # Can't use super as OrderedSetQueue is old style class + OrderedSetQueue._put(self, item) class PlaylistObserver(Observer):