initial background downloader support
This commit is contained in:
@@ -92,9 +92,9 @@ class Downloader:
|
|||||||
# Funciones
|
# Funciones
|
||||||
def start_dialog(self, title=config.get_localized_string(60200)):
|
def start_dialog(self, title=config.get_localized_string(60200)):
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
progreso = platformtools.dialog_progress(title, config.get_localized_string(60201))
|
progreso = platformtools.dialog_progress_bg(title, config.get_localized_string(60201))
|
||||||
self.start()
|
self.start()
|
||||||
while self.state == self.states.downloading and not progreso.iscanceled():
|
while self.state == self.states.downloading:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
line1 = "%s" % (self.filename)
|
line1 = "%s" % (self.filename)
|
||||||
line2 = config.get_localized_string(59983) % (
|
line2 = config.get_localized_string(59983) % (
|
||||||
@@ -102,10 +102,7 @@ class Downloader:
|
|||||||
self.speed[1], self.speed[2], self.connections[0], self.connections[1])
|
self.speed[1], self.speed[2], self.connections[0], self.connections[1])
|
||||||
line3 = config.get_localized_string(60202) % (self.remaining_time)
|
line3 = config.get_localized_string(60202) % (self.remaining_time)
|
||||||
|
|
||||||
progreso.update(int(self.progress), line1, line2, line3)
|
progreso.update(int(self.progress), line1, line2 + line3)
|
||||||
if self.state == self.states.downloading:
|
|
||||||
self.stop()
|
|
||||||
progreso.close()
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self._state == self.states.error: return
|
if self._state == self.states.error: return
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ import os
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
from core import filetools, jsontools, scraper, scrapertools, servertools, videolibrarytools, support
|
from core import filetools, jsontools, scraper, scrapertools, servertools, videolibrarytools, support
|
||||||
from core.downloader import Downloader
|
from core.downloader import Downloader
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from platformcode import config, logger
|
from platformcode import config, logger
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
|
from platformcode.launcher import downloaderObj
|
||||||
|
|
||||||
STATUS_COLORS = {0: "orange", 1: "orange", 2: "green", 3: "red"}
|
STATUS_COLORS = {0: "orange", 1: "orange", 2: "green", 3: "red"}
|
||||||
STATUS_CODES = type("StatusCode", (), {"stoped": 0, "canceled": 1, "completed": 2, "error": 3})
|
STATUS_CODES = type("StatusCode", (), {"stoped": 0, "canceled": 1, "completed": 2, "error": 3})
|
||||||
@@ -244,7 +246,8 @@ def menu(item):
|
|||||||
|
|
||||||
# Opcion inicaiar descarga
|
# Opcion inicaiar descarga
|
||||||
if opciones[seleccion] == op[0]:
|
if opciones[seleccion] == op[0]:
|
||||||
start_download(item)
|
th = Thread(target=start_download, args=(item,))
|
||||||
|
th.start()
|
||||||
|
|
||||||
# Elegir Servidor
|
# Elegir Servidor
|
||||||
if opciones[seleccion] == op[3]:
|
if opciones[seleccion] == op[3]:
|
||||||
|
|||||||
Reference in New Issue
Block a user