mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
added basic download resuming
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from core.utils.data.state import state
|
||||
from core.utils.network.download import run_download_direct
|
||||
|
||||
def split_data(data):
|
||||
|
||||
count = data.count
|
||||
downloads = data.data
|
||||
|
||||
return count, downloads
|
||||
|
||||
def check_completed(downloads, resume):
|
||||
for download in downloads:
|
||||
if download.completed == False:
|
||||
if state.debug:
|
||||
print(f"Found unfinished download: {download.title}")
|
||||
if resume == True:
|
||||
run_download_direct(download.magnet_uri)
|
||||
if state.debug:
|
||||
print(f"Resuming {download.title}")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,5 +27,9 @@ def run_download(item, posts, post_titles):
|
||||
add_download_log(item, post_url, magnet_uri, False)
|
||||
add_magnet(magnet_uri)
|
||||
|
||||
def run_download_direct(magnet_uri):
|
||||
start_client()
|
||||
add_magnet(magnet_uri)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user