diff --git a/core/support.py b/core/support.py index 423f9415..8bb3ad9d 100755 --- a/core/support.py +++ b/core/support.py @@ -262,33 +262,36 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t longtitle = title + (s if title and title2 else '') + title2 + '\n' if sceneTitle: - parsedTitle = guessit(title) - title = longtitle = parsedTitle.get('title', '') - log('TITOLO',title) - if parsedTitle.get('source'): - quality = str(parsedTitle.get('source')) - if parsedTitle.get('screen_size'): - quality += ' ' + str(parsedTitle.get('screen_size', '')) - if not scraped['year']: - infolabels['year'] = parsedTitle.get('year', '') - if parsedTitle.get('episode') and parsedTitle.get('season'): - longtitle = title + s + try: + parsedTitle = guessit(title) + title = longtitle = parsedTitle.get('title', '') + log('TITOLO',title) + if parsedTitle.get('source'): + quality = str(parsedTitle.get('source')) + if parsedTitle.get('screen_size'): + quality += ' ' + str(parsedTitle.get('screen_size', '')) + if not scraped['year']: + infolabels['year'] = parsedTitle.get('year', '') + if parsedTitle.get('episode') and parsedTitle.get('season'): + longtitle = title + s - if type(parsedTitle.get('season')) == list: - longtitle += str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) - else: - longtitle += str(parsedTitle.get('season')) + if type(parsedTitle.get('season')) == list: + longtitle += str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) + else: + longtitle += str(parsedTitle.get('season')) - if type(parsedTitle.get('episode')) == list: - longtitle += 'x' + str(parsedTitle.get('episode')[0]).zfill(2) + '-' + str(parsedTitle.get('episode')[-1]).zfill(2) - else: - longtitle += 'x' + str(parsedTitle.get('episode')).zfill(2) - elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list: - longtitle += s + config.get_localized_string(30140) + " " +str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) - elif parsedTitle.get('season'): - longtitle += s + config.get_localized_string(60027) % str(parsedTitle.get('season')) - if parsedTitle.get('episode_title'): - longtitle += s + parsedTitle.get('episode_title') + if type(parsedTitle.get('episode')) == list: + longtitle += 'x' + str(parsedTitle.get('episode')[0]).zfill(2) + '-' + str(parsedTitle.get('episode')[-1]).zfill(2) + else: + longtitle += 'x' + str(parsedTitle.get('episode')).zfill(2) + elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list: + longtitle += s + config.get_localized_string(30140) + " " +str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) + elif parsedTitle.get('season'): + longtitle += s + config.get_localized_string(60027) % str(parsedTitle.get('season')) + if parsedTitle.get('episode_title'): + longtitle += s + parsedTitle.get('episode_title') + except: + log('Error') longtitle = typo(longtitle, 'bold') lang1, longtitle = scrapeLang(scraped, lang, longtitle) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 5abd7527..a15a2c30 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1351,8 +1351,11 @@ def play_torrent(item, xlistitem, mediaurl): from servers import torrent torrent_options = torrent_client_installed(show_tuple=True) - - if len(torrent_options) > 1: + if len(torrent_options) == 0: + from specials import elementum_download + elementum_download.download() + return play_torrent(item, xlistitem, mediaurl) + elif len(torrent_options) > 1: selection = dialog_select(config.get_localized_string(70193), [opcion[0] for opcion in torrent_options]) else: selection = 0 @@ -1365,13 +1368,13 @@ def play_torrent(item, xlistitem, mediaurl): mediaurl = urllib.quote_plus(item.url) torr_client = torrent_options[selection][0] - if torr_client in ['quasar', 'elementum'] and item.infoLabels['tmdb_id']: + if torr_client in ['elementum'] and item.infoLabels['tmdb_id']: if item.contentType == 'episode' and "elementum" not in torr_client: mediaurl += "&episode=%s&library=&season=%s&show=%s&tmdb=%s&type=episode" % (item.infoLabels['episode'], item.infoLabels['season'], item.infoLabels['tmdb_id'], item.infoLabels['tmdb_id']) elif item.contentType == 'movie': mediaurl += "&library=&tmdb=%s&type=movie" % (item.infoLabels['tmdb_id']) - if torr_client in ['quasar', 'elementum'] and item.downloadFilename: + if torr_client in ['elementum'] and item.downloadFilename: torrent.elementum_download(item) else: time.sleep(3) diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index d1333456..054bdee4 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -144,7 +144,7 @@ msgid "Internal Client" msgstr "" msgctxt "#30034" -msgid ": Select the video, or 'Cancel' for all" +msgid "Select the video, or 'Cancel' for all" msgstr "" msgctxt "#30035" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index a608b054..7a48375b 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -144,8 +144,8 @@ msgid "Internal Client" msgstr "Client Interno" msgctxt "#30034" -msgid ": Select the video, or 'Cancel' for all" -msgstr ": Seleziona il video o 'Annulla' per tutti" +msgid "Select the video, or 'Cancel' for all" +msgstr "Seleziona il video o 'Annulla' per tutti" msgctxt "#30035" msgid "ERROR in the Client" diff --git a/servers/torrent.py b/servers/torrent.py index 3cf0534e..4f0b74ab 100755 --- a/servers/torrent.py +++ b/servers/torrent.py @@ -23,14 +23,19 @@ from platformcode import config, platformtools from threading import Thread, currentThread from torrentool.api import Torrent from lib.guessit import guessit - -elementum_setting = xbmcaddon.Addon(id='plugin.video.elementum') -elementum_host = 'http://127.0.0.1:' + elementum_setting.getSetting('remote_port') + '/torrents/' +try: + elementum_setting = xbmcaddon.Addon(id='plugin.video.elementum') + elementum_host = 'http://127.0.0.1:' + elementum_setting.getSetting('remote_port') + '/torrents/' + TorrentPath = xbmc.translatePath(elementum_setting.getSetting('torrents_path')) +except: + pass extensions_list = ['.aaf', '.3gp', '.asf', '.avi', '.flv', '.mpeg', '.m1v', '.m2v', '.m4v', '.mkv', '.mov', '.mpg', '.mpe', '.mp4', '.ogg', '.wmv'] + # Returns an array of possible video url's from the page_url def get_video_url(page_url, premium=False, user='', password='', video_password=''): + torrent_options = platformtools.torrent_client_installed(show_tuple=True) if len(torrent_options) == 0: from specials import elementum_download @@ -71,33 +76,38 @@ def mark_auto_as_watched(item): elementumHost = 'http://127.0.0.1:65220/torrents/' def elementum_download(item): - sleep = False - if elementum_setting.getSetting('logger_silent') == False: - elementum_setting.setSetting('logger_silent', 'true') - sleep = True - if elementum_setting.getSetting('download_storage') != 0: - config.set_setting('elementumtype', elementum_setting.getSetting('download_storage')) # Backup Setting - elementum_setting.setSetting('download_storage', '0') # Set Setting - sleep = True - if elementum_setting.getSetting('download_path') != config.get_setting('downloadpath'): - elementum_setting.setSetting('download_path', config.get_setting('downloadpath')) # Backup Setting - config.set_setting('elementumdl', elementum_setting.getSetting('download_path')) # Set Setting - sleep = True - if sleep: time.sleep(3) - - path = filetools.join(config.get_data_path(),'elementum_torrent.txt') - url = urllib.quote_plus(item.url) - filetools.write(path, url) + elementum = False + while not elementum: + try: + sleep = False + if elementum_setting.getSetting('logger_silent') == False: + elementum_setting.setSetting('logger_silent', 'true') + sleep = True + if elementum_setting.getSetting('download_storage') != 0: + config.set_setting('elementumtype', elementum_setting.getSetting('download_storage')) # Backup Setting + elementum_setting.setSetting('download_storage', '0') # Set Setting + sleep = True + if elementum_setting.getSetting('download_path') != config.get_setting('downloadpath'): + elementum_setting.setSetting('download_path', config.get_setting('downloadpath')) # Backup Setting + config.set_setting('elementumdl', elementum_setting.getSetting('download_path')) # Set Setting + sleep = True + if sleep: time.sleep(3) + elementum = True + path = filetools.join(config.get_data_path(),'elementum_torrent.txt') + url = urllib.quote_plus(item.url) + filetools.write(path, url) + except: + pass -def stop_elementum_monitor(): - config.set_setting('stop_elementum_monitor', True) - time.sleep(2) +# def stop_elementum_monitor(): +# config.set_setting('stop_elementum_monitor', True) +# time.sleep(2) -def start_elementum_monitor(): - config.set_setting('stop_elementum_monitor', False) - time.sleep(3) - Thread(target=elementum_monitor).start() +# def start_elementum_monitor(): +# config.set_setting('stop_elementum_monitor', False) +# time.sleep(3) +# Thread(target=elementum_monitor).start() @@ -106,37 +116,46 @@ def elementum_monitor(): path = filetools.join(config.get_data_path(),'elementum_torrent.txt') partials = [] while True: - if filetools.isfile(path): - log('Add Torrent') - url = filetools.read(path) - TorrentName = match(url, patron=r'btih(?::|%3A)([^&%]+)', string=True).match - uri = elementum_host + 'add' - post = 'uri=%s&file=null&all=1' % url - match(uri, post=post, timeout=5, alfa_s=True, ignore_response_code=True) - filetools.remove(path) - while not filetools.isfile(filetools.join(elementum_setting.getSetting('torrents_path'), TorrentName + '.torrent')): + try: + if filetools.isfile(path): + log('Add Torrent') + url = filetools.read(path) + if url.startswith('/'): + requests.get(elementum_host + url) + wait = False + else: + TorrentName = match(url, patron=r'btih(?::|%3A)([^&%]+)', string=True).match + uri = elementum_host + 'add' + post = 'uri=%s&file=null&all=1' % url + match(uri, post=post, timeout=5, alfa_s=True, ignore_response_code=True) + wait = True + filetools.remove(path) + if wait: + while not filetools.isfile(filetools.join(elementum_setting.getSetting('torrents_path'), TorrentName + '.torrent')): + time.sleep(1) + else: + log('Watch') + try: + data = requests.get(elementum_host).json() + except: + data = '' + if data: + json = data['items'] + + for it in json: + Partial = float(match(it['label'], patron=r'(\d+\.\d+)%').match) + Title = it['info']['title'] + TorrentName = match(it['path'], patron=r'resume=([^&]+)').match + File, Json = find_file(TorrentName) + update_download_info(Partial, Title, TorrentName, File, Json) + partials.append(Partial) + + partials.sort() + if len(partials) > 0 and partials[0] == 100: + unset_elementum() + time.sleep(1) - else: - log('Watch') - try: - data = requests.get(elementum_host).json() - except: - data = '' - if data: - json = data['items'] - - for it in json: - Partial = float(match(it['label'], patron=r'(\d+\.\d+)%').match) - Title = it['info']['title'] - TorrentName = match(it['path'], patron=r'resume=([^&]+)').match - File, Json = find_file(TorrentName) - update_download_info(Partial, Title, TorrentName, File, Json) - partials.append(Partial) - - partials.sort() - if len(partials) > 0 and partials[0] == 100: - unset_elementum() - + except: time.sleep(1) @@ -155,9 +174,11 @@ def find_file(File): def update_download_info(Partial, Title, TorrentName, File, Json): path = xbmc.translatePath(config.get_setting('downloadlistpath')) dlpath = filetools.join(config.get_setting('downloadpath'), Title) - tpath = filetools.join(xbmc.translatePath(elementum_setting.getSetting('torrents_path')), TorrentName) + + if 'TorrentName' not in Json: + jsontools.update_node(TorrentName, File, 'TorrentName', path, silent=True) if Json['downloadSize'] == 0: - size = Torrent.from_file(tpath + '.torrent').total_size + size = Torrent.from_file(filetools.join(TorrentPath, TorrentName + '.torrent')).total_size jsontools.update_node(size, File, 'downloadSize', path, silent=True) if Json['downloadFilename'] != dlpath and 'backupFilename' not in Json: jsontools.update_node(Json['downloadFilename'], File, 'backupFilename', path, silent=True) @@ -169,14 +190,17 @@ def update_download_info(Partial, Title, TorrentName, File, Json): jsontools.update_node(Json['downloadSize'], File, 'downloadCompleted', path, silent=True) jsontools.update_node(2, File, 'downloadStatus', path, silent=True) requests.get(elementum_host + 'pause/' + TorrentName) - filetools.remove(tpath + '.torrent') + del_torrent(TorrentName) time.sleep(1) rename(TorrentName, path) # requests.get(elementum_host + 'delete/' + TorrentName + '?files=false') +def del_torrent(TorrentName): + filetools.remove(filetools.join(TorrentPath, TorrentName + '.torrent')) def rename(TorrentName, Path): + # dbg() File, Json = find_file(TorrentName) path = Json['downloadFilename'] if Json['infoLabels']['mediatype'] == 'movie': @@ -191,7 +215,7 @@ def rename(TorrentName, Path): if ext in extensions_list: extension = ext filetools.rename(filetools.join(path, f), f.replace(oldName, newName)) filetools.rename(path, newName) - jsontools.update_node(filetools.join(newName,newName + extension), File, 'downloadFilename', Path) + jsontools.update_node(filetools.join(newName, newName + extension), File, 'downloadFilename', Path) else: oldName = filetools.split(path)[-1] @@ -227,9 +251,9 @@ def rename(TorrentName, Path): if not filetools.isdir(NewFolder): filetools.mkdir(NewFolder) from_folder = filetools.join(config.get_setting('downloadpath'), filename) - to_folder = filetools.join(FolderName, title) + to_folder = filetools.join(config.get_setting('downloadpath'), FolderName, title) filetools.move(from_folder, to_folder) - jsontools.update_node(filetools.join(config.get_setting('downloadpath'),to_folder), File, 'downloadFilename', Path) + jsontools.update_node(filetools.join(FolderName, title), File, 'downloadFilename', Path) def process_filename(filename, Title, ext=True): extension = os.path.splitext(filename)[-1] diff --git a/service.py b/service.py index bb6f03f5..c7e1e585 100644 --- a/service.py +++ b/service.py @@ -393,8 +393,8 @@ if __name__ == "__main__": exit(0) # Copia Custom code a las carpetas de Alfa desde la zona de Userdata - from platformcode import custom_code - custom_code.init() + # from platformcode import custom_code + # custom_code.init() from threading import Thread Thread(target=viewmodeMonitor).start() from servers import torrent diff --git a/specials/downloads.py b/specials/downloads.py index 82cad2a4..40127b8e 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -39,10 +39,11 @@ FOLDER_MOVIES = config.get_setting("folder_movies") FOLDER_TVSHOWS = config.get_setting("folder_tvshows") TITLE_FILE = "[COLOR %s]| %i%% |[/COLOR] - %s" TITLE_TVSHOW = "[COLOR %s]| %i%% |[/COLOR] - %s [%s]" +extensions_list = ['.aaf', '.3gp', '.asf', '.avi', '.flv', '.mpeg', '.m1v', '.m2v', '.m4v', '.mkv', '.mov', '.mpg', '.mpe', '.mp4', '.ogg', '.wmv'] def mainlist(item): - logger.info() + log() itemlist = [] # Lista de archivos @@ -145,7 +146,7 @@ def settings(item): def browser(item): - logger.info() + log() itemlist = [] for file in filetools.listdir(item.url): @@ -179,17 +180,23 @@ def del_dir(item): def clean_all(item): - logger.info() + log() stop_all() removeFiles = False if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(30300)): removeFiles = True - for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)): - if fichero.endswith(".json"): - download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero))) + for File in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)): + if File.endswith(".json"): + download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, File))) + if download_item.TorrentName: + path = filetools.join(config.get_data_path(),'elementum_torrent.txt') + url = '/pause/' + download_item.TorrentName + filetools.write(path, url) + from servers.torrent import del_torrent + del_torrent(download_item.TorrentName) if not item.contentType == "tvshow" or ( item.contentSerieName == download_item.contentSerieName and item.contentChannel == download_item.contentChannel): - filetools.remove(filetools.join(DOWNLOAD_LIST_PATH, fichero)) + filetools.remove(filetools.join(DOWNLOAD_LIST_PATH, File)) if removeFiles: filetools.remove(filetools.join(DOWNLOAD_PATH, download_item.downloadFilename)) dirName = filetools.join(DOWNLOAD_PATH, filetools.dirname(download_item.downloadFilename)) @@ -205,11 +212,15 @@ def reload(item): def stop_all(item=None): - logger.info() + log() for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)): if fichero.endswith(".json"): download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero))) + if download_item.TorrentName: + path = filetools.join(config.get_data_path(),'elementum_torrent.txt') + url = '/pause/' + download_item.TorrentName + filetools.write(path, url) if download_item.downloadStatus == 4: update_json(filetools.join(DOWNLOAD_LIST_PATH, fichero), {"downloadStatus": STATUS_CODES.stoped}) xbmc.sleep(300) @@ -218,7 +229,7 @@ def stop_all(item=None): def clean_ready(item): - logger.info() + log() for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)): if fichero.endswith(".json"): download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero))) @@ -230,7 +241,7 @@ def clean_ready(item): def restart_error(item): - logger.info() + log() for fichero in sorted(filetools.listdir(DOWNLOAD_LIST_PATH)): if fichero.endswith(".json"): download_item = Item().fromjson(filetools.read(filetools.join(DOWNLOAD_LIST_PATH, fichero))) @@ -242,8 +253,7 @@ def restart_error(item): filetools.remove( filetools.join(DOWNLOAD_PATH, download_item.downloadFilename)) - update_json(item.path, - {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0}) + update_json(item.path, {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0}) platformtools.itemlist_refresh() @@ -270,7 +280,7 @@ def download_all_background(item): def menu(item): - logger.info() + log() if item.downloadServer: servidor = item.downloadServer.get("server", "Auto") else: @@ -314,7 +324,7 @@ def menu(item): # -1 es cancelar if seleccion == -1: return - logger.info("option=%s" % (opciones[seleccion])) + log("option=", opciones[seleccion]) # Opcion Eliminar if opciones[seleccion] == op[1]: filetools.remove(item.path) @@ -335,21 +345,33 @@ def menu(item): if filetools.isfile(filetools.join(DOWNLOAD_PATH, item.downloadFilename)): filetools.remove(filetools.join(DOWNLOAD_PATH, item.downloadFilename)) - update_json(item.path, {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0, - "downloadServer": {}}) + update_json(item.path, {"downloadStatus": STATUS_CODES.stoped, "downloadComplete": 0, "downloadProgress": 0, "downloadServer": {}}) if opciones[seleccion] == op[4]: update_json(item.path, {"downloadStatus": STATUS_CODES.stoped}) if opciones[seleccion] == op[5]: - xbmc.executebuiltin('PlayMedia(' + filetools.join(DOWNLOAD_PATH, item.downloadFilename) + ',resume)') + path = filetools.join(DOWNLOAD_PATH, item.downloadFilename) + if filetools.isdir(path): + videos = [] + files = filetools.listdir(path) + for f in files: + if os.path.splitext(f)[-1] in extensions_list: + videos.append(f) + if len(videos) > 1: + selection = platformtools.dialog_select(config.get_localized_string(30034), files) + else: + selection = 0 + xbmc.executebuiltin('PlayMedia(' + filetools.join(path, files[selection]) + ',resume)') + else: + xbmc.executebuiltin('PlayMedia(' + path + ',resume)') if opciones[seleccion] != op[5]: platformtools.itemlist_refresh() def move_to_libray(item): - logger.info() + log() if item.contentType == 'movie': FOLDER = FOLDER_MOVIES @@ -403,7 +425,7 @@ def move_to_libray(item): if filename.startswith(name) and (filename.endswith('.strm') or (filename.endswith('.json') and 'downloads' not in filename)): clean = True file_path = filetools.join(config.get_setting("videolibrarypath"), FOLDER, path_title, File) - logger.info('Delete File: ' + str(file_path)) + log('Delete File:', str(file_path)) filetools.remove(file_path) if file_path.endswith('.strm'): file_strm_path = file_path @@ -568,7 +590,7 @@ def sort_method(item): def download_from_url(url, item): - logger.info("Attempting to download: %s" % (url)) + log("Attempting to download:", url) if url.lower().split('|')[0].endswith(".m3u8") or url.lower().startswith("rtmp"): save_server_statistics(item.server, 0, False) platformtools.dialog_notification('m3u8 Download',config.get_localized_string(60364), sound=False) @@ -602,17 +624,17 @@ def download_from_url(url, item): # Descarga detenida. Obtenemos el estado: # Se ha producido un error en la descarga if d.state == d.states.error: - logger.info("Error trying to download %s" % (url)) + log("Error trying to download", url) status = STATUS_CODES.error # La descarga se ha detenifdo elif d.state == d.states.stopped: - logger.info("Stop download") + log("Stop download") status = STATUS_CODES.canceled # La descarga ha finalizado elif d.state == d.states.completed: - logger.info("Downloaded correctly") + log("Downloaded correctly") status = STATUS_CODES.completed if (item.downloadSize and item.downloadSize != d.size[0]) or d.size[0] < 5000000: # if size don't correspond or file is too little (gounlimited for example send a little video to say the server is overloaded) @@ -628,7 +650,7 @@ def download_from_url(url, item): def download_from_server(item): - logger.info(item.tostring()) + log(item.tostring()) unsupported_servers = ["torrent"] if item.contentChannel == 'local': @@ -658,12 +680,11 @@ def download_from_server(item): item.video_urls = itemlist if not item.server: item.server = "directo" else: - logger.info("There is nothing to reproduce") + log("There is nothing to reproduce") return {"downloadStatus": STATUS_CODES.error} finally: progreso.close() - logger.info("contentAction: %s | contentChannel: %s | server: %s | url: %s" % ( - item.contentAction, item.contentChannel, item.server, item.url)) + log("contentAction: %s | contentChannel: %s | server: %s | url: %s" % (item.contentAction, item.contentChannel, item.server, item.url)) if item.server == 'torrent': import xbmcgui @@ -683,11 +704,11 @@ def download_from_server(item): # Si no esta disponible, salimos if not puedes: - logger.info("The video is NOT available") + log("The video is NOT available") return {"downloadStatus": STATUS_CODES.error} else: - logger.info("YES Video is available") + log("YES Video is available") result = {} @@ -708,15 +729,19 @@ def download_from_server(item): def download_from_best_server(item): - logger.info("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) + log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) result = {"downloadStatus": STATUS_CODES.error} progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70179)) try: if item.downloadItemlist: - logger.info('using cached servers') + log('using cached servers') play_items = [Item().fromurl(i) for i in item.downloadItemlist] + elif item.TorrentName: + path = filetools.join(config.get_data_path(),'elementum_torrent.txt') + url = '/resume/' + item.TorrentName + filetools.write(path, url) else: if item.contentChannel in ['community', 'videolibrary']: channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel]) @@ -764,12 +789,11 @@ def download_from_best_server(item): def select_server(item): if item.server: return "Auto" - logger.info( - "contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) + log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70179)) try: if item.downloadItemlist: - logger.info('using cached servers') + log('using cached servers') play_items = [Item().fromurl(i) for i in item.downloadItemlist] else: if item.contentChannel in ['community', 'videolibrary']: @@ -811,8 +835,7 @@ def select_server(item): def start_download(item): - logger.info( - "contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) + log("contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) # Ya tenemnos server, solo falta descargar if item.contentAction == "play": ret = download_from_server(item) @@ -832,8 +855,7 @@ def start_download(item): def get_episodes(item): - logger.info("contentAction: %s | contentChannel: %s | contentType: %s" % ( - item.contentAction, item.contentChannel, item.contentType)) + log("contentAction: %s | contentChannel: %s | contentType: %s" % (item.contentAction, item.contentChannel, item.contentType)) if 'dlseason' in item: season = True @@ -910,7 +932,7 @@ def get_episodes(item): # Cualquier otro resultado no nos vale, lo ignoramos else: - logger.info("Omitiendo item no válido: %s" % episode.tostring()) + log("Omitiendo item no válido:", episode.tostring()) # if Multiple Languages or Qualities itemlist = videolibrarytools.filter_list(itemlist) @@ -919,9 +941,9 @@ def get_episodes(item): def write_json(item): - logger.info() + log() - channel = item.channel + channel = item.from_channel if item.from_channel else item.channel item.action = "menu" item.channel = "downloads" item.downloadStatus = STATUS_CODES.stoped @@ -964,7 +986,7 @@ def save_download(item): def save_download_background(item): - logger.info() + log() # Menu contextual if item.from_action and item.from_channel: item.channel = item.from_channel @@ -1013,7 +1035,7 @@ def save_download_background(item): def save_download_videolibrary(item): - logger.info() + log() show_disclaimer() item.contentChannel = 'videolibrary' item.channel = "downloads" @@ -1022,8 +1044,7 @@ def save_download_videolibrary(item): def save_download_video(item): - logger.info("contentAction: %s | contentChannel: %s | contentTitle: %s" % ( - item.contentAction, item.contentChannel, item.contentTitle)) + log("contentAction: %s | contentChannel: %s | contentTitle: %s" % (item.contentAction, item.contentChannel, item.contentTitle)) set_movie_title(item) @@ -1038,7 +1059,7 @@ def save_download_video(item): def save_download_movie(item): - logger.info("contentAction: %s | contentChannel: %s | contentTitle: %s" % ( item.contentAction, item.contentChannel, item.contentTitle)) + log("contentAction: %s | contentChannel: %s | contentTitle: %s" % ( item.contentAction, item.contentChannel, item.contentTitle)) progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70191)) @@ -1073,7 +1094,7 @@ def save_download_movie(item): def save_download_tvshow(item): - logger.info("contentAction: %s | contentChannel: %s | contentType: %s | contentSerieName: %s" % (item.contentAction, item.contentChannel, item.contentType, item.contentSerieName)) + log("contentAction: %s | contentChannel: %s | contentType: %s | contentSerieName: %s" % (item.contentAction, item.contentChannel, item.contentType, item.contentSerieName)) progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70188)) try: diff --git a/specials/setting.py b/specials/setting.py index ed947e7f..d6bc273b 100644 --- a/specials/setting.py +++ b/specials/setting.py @@ -468,16 +468,16 @@ def check_quickfixes(item): return False -def update_quasar(item): - logger.info() +# def update_quasar(item): +# logger.info() - from platformcode import custom_code, platformtools - stat = False - stat = custom_code.update_external_addon("quasar") - if stat: - platformtools.dialog_notification("Actualización Quasar", "Realizada con éxito") - else: - platformtools.dialog_notification("Actualización Quasar", "Ha fallado. Consulte el log") +# from platformcode import custom_code, platformtools +# stat = False +# stat = custom_code.update_external_addon("quasar") +# if stat: +# platformtools.dialog_notification("Actualización Quasar", "Realizada con éxito") +# else: +# platformtools.dialog_notification("Actualización Quasar", "Ha fallado. Consulte el log") def conf_tools(item):