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 18, 2023
1 parent a00b2af commit 9c5f754
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/pyload/core/database/file_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,16 @@ 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.
"""
self.c.execute(
"SELECT id FROM links WHERE package=? AND status NOT IN (0, 4, 13) LIMIT 3",
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, 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 9c5f754

Please sign in to comment.