Skip to content

Commit

Permalink
Fix hidden audio after preload
Browse files Browse the repository at this point in the history
  • Loading branch information
mervick committed Jan 7, 2025
1 parent 5b4c8c4 commit ae15e78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
* detect existing directories in a case-insensitive manner
* allow re-download downloaded songs
* add best artists
* fix hidden audio after preload
6 changes: 6 additions & 0 deletions TelegramLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, plugin):
self.entries = []
self._running = False
self._idx = 0
self._is_hidden = False

def is_downloading(self, entry):
if self._running:
Expand Down Expand Up @@ -69,11 +70,15 @@ def stop(self):

def _process(self, audio):
entry = self.entries[self._idx]
if self._is_hidden:
self._is_hidden = False
audio.save({"is_hidden": True})
audio.update_entry(entry)
GLib.idle_add(entry.get_entry_type().emit, 'entry_downloaded', entry)
self._next(1000)

def _next(self, delay=1000):
self._is_hidden = False
del self.entries[self._idx]
self._idx = len(self.entries) - 1
if self._idx < 0:
Expand All @@ -94,6 +99,7 @@ def _load(self):
self.plugin.db.commit()
self._next(20)
else:
self._is_hidden = audio.is_hidden
audio.download(success=self._process, fail=self._next)


Expand Down

0 comments on commit ae15e78

Please sign in to comment.