Optimize code
This commit is contained in:
parent
d44e782543
commit
641520dcbb
1 changed files with 2 additions and 9 deletions
|
@ -493,9 +493,6 @@ class PlaylistEventhandler(events.FileSystemEventHandler):
|
||||||
if not state.SYNC_PLAYLISTS:
|
if not state.SYNC_PLAYLISTS:
|
||||||
# Sync is deactivated
|
# Sync is deactivated
|
||||||
return
|
return
|
||||||
if event.is_directory:
|
|
||||||
# todo: take care of folder renames
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
_, extension = event.src_path.rsplit('.', 1)
|
_, extension = event.src_path.rsplit('.', 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -590,13 +587,9 @@ class PlaylistQueue(OrderedSetQueue):
|
||||||
def _put(self, item):
|
def _put(self, item):
|
||||||
if item[0].is_directory:
|
if item[0].is_directory:
|
||||||
self.unfinished_tasks -= 1
|
self.unfinished_tasks -= 1
|
||||||
elif item not in self._set_of_items:
|
|
||||||
Queue.Queue._put(self, item)
|
|
||||||
self._set_of_items.add(item)
|
|
||||||
else:
|
else:
|
||||||
# `put` increments `unfinished_tasks` even if we did not put
|
# Can't use super as OrderedSetQueue is old style class
|
||||||
# anything into the queue here
|
OrderedSetQueue._put(self, item)
|
||||||
self.unfinished_tasks -= 1
|
|
||||||
|
|
||||||
|
|
||||||
class PlaylistObserver(Observer):
|
class PlaylistObserver(Observer):
|
||||||
|
|
Loading…
Reference in a new issue