Skip to content

Commit

Permalink
[core] consider offline links as finished
Browse files Browse the repository at this point in the history
This change considers (permanently) offline links as finished. Although
they are not technically finished in being downloaded, they also never
will be so there is no reason not to dispatch `package_finished`. This
allows plugins and scripts to further process the files.

Note that this does not adjust the progress display in queue, allowing
users to check why their progress never finishes and decide what to do
with the package or links in question.

Fixes pyload#4392
  • Loading branch information
mihawk90 committed Nov 15, 2023
1 parent a00b2af commit 52a1bfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pyload/core/database/file_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,14 @@ def get_plugin_job(self, plugins):
@style.queue
def get_unfinished(self, pid):
"""
return list of max length 3 ids with pyfiles in package not finished or
processed.
return list of max length 3 ids with pyfiles in package not:
- finished (0)
- offline (1)
- skipped (4)
- processed (13)
"""
self.c.execute(
"SELECT id FROM links WHERE package=? AND status NOT IN (0, 4, 13) LIMIT 3",
"SELECT id FROM links WHERE package=? AND status NOT IN (0, 1, 4, 13) LIMIT 3",
(str(pid),),
)
return [r[0] for r in self.c]
Expand Down
1 change: 1 addition & 0 deletions src/pyload/core/threads/download_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def run(self):
self.pyload.log.warning(
self._("Download is offline: {}").format(pyfile.name)
)
self.pyload.files.check_package_finished(pyfile)
elif msg == "temp. offline":
pyfile.set_status("temp. offline")
self.pyload.log.warning(
Expand Down

0 comments on commit 52a1bfd

Please sign in to comment.