From 3708a25d0c91c268681c0f22690efb1269a2c693 Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 19 Apr 2020 18:30:13 +0200 Subject: [PATCH 1/2] migliorie download --- platformcode/platformtools.py | 6 ++-- specials/downloads.py | 5 ++- specials/videolibrary.py | 67 ++++++++++++++++++----------------- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index a67ef160..0cecb38d 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1107,10 +1107,8 @@ def get_dialogo_opciones(item, default_action, strm, autoplay): opciones.append(config.get_localized_string(30164)) else: # "Descargar" - import xbmcaddon - addon = xbmcaddon.Addon('plugin.video.kod') - downloadenabled = addon.getSetting('downloadenabled') - if downloadenabled != "false": + downloadenabled = config.get_setting('downloadenabled') + if downloadenabled != "false" and item.channel != 'videolibrary': opcion = config.get_localized_string(30153) opciones.append(opcion) diff --git a/specials/downloads.py b/specials/downloads.py index 75766130..8f2c16fe 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -946,7 +946,10 @@ def save_download_background(item): if item.channel == 'videolibrary': from specials import videolibrary - parent = Item().fromurl(item.parent) + if not item.parent: + parent = item + else: + parent = Item().fromurl(item.parent) parent.contentChannel = 'videolibrary' if item.downloadItemlist: # episode parent.downloadItemlist = item.downloadItemlist diff --git a/specials/videolibrary.py b/specials/videolibrary.py index 58cbdce4..7e554573 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -1168,37 +1168,38 @@ def check_tvshow_playcount(item, season): def add_download_items(item, itemlist): - localOnly = True - for i in itemlist: - if i.contentChannel != 'local': - localOnly = False - break - if not item.fromLibrary and not localOnly: - downloadItem = Item(channel='downloads', - from_channel=item.channel, - title=typo(config.get_localized_string(60355), "color kod bold"), - fulltitle=item.fulltitle, - show=item.fulltitle, - contentType=item.contentType, - contentSerieName=item.contentSerieName, - url=item.url, - action='save_download', - from_action="findvideos", - contentTitle=item.contentTitle, - path=item.path, - thumbnail=thumb(thumb='downloads.png'), - parent=item.tourl()) - if item.action == 'findvideos': - if item.contentType == 'episode': - downloadItem.title = typo(config.get_localized_string(60356), "color kod bold") - else: # film - downloadItem.title = typo(config.get_localized_string(60354), "color kod bold") - downloadItem.downloadItemlist = [i.tourl() for i in itemlist] - itemlist.append(downloadItem) - else: - if item.contentSeason: # season - downloadItem.title = typo(config.get_localized_string(60357), "color kod bold") + if config.get_setting('downloadenabled'): + localOnly = True + for i in itemlist: + if i.contentChannel != 'local': + localOnly = False + break + if not item.fromLibrary and not localOnly: + downloadItem = Item(channel='downloads', + from_channel=item.channel, + title=typo(config.get_localized_string(60355), "color kod bold"), + fulltitle=item.fulltitle, + show=item.fulltitle, + contentType=item.contentType, + contentSerieName=item.contentSerieName, + url=item.url, + action='save_download', + from_action="findvideos", + contentTitle=item.contentTitle, + path=item.path, + thumbnail=thumb(thumb='downloads.png'), + parent=item.tourl()) + if item.action == 'findvideos': + if item.contentType == 'episode': + downloadItem.title = typo(config.get_localized_string(60356), "color kod bold") + else: # film + downloadItem.title = typo(config.get_localized_string(60354), "color kod bold") + downloadItem.downloadItemlist = [i.tourl() for i in itemlist] itemlist.append(downloadItem) - else: # tvshow + not seen - itemlist.append(downloadItem) - itemlist.append(downloadItem.clone(title=typo(config.get_localized_string(60003), "color kod bold"), unseen=True)) \ No newline at end of file + else: + if item.contentSeason: # season + downloadItem.title = typo(config.get_localized_string(60357), "color kod bold") + itemlist.append(downloadItem) + else: # tvshow + not seen + itemlist.append(downloadItem) + itemlist.append(downloadItem.clone(title=typo(config.get_localized_string(60003), "color kod bold"), unseen=True)) \ No newline at end of file From 708bc91f8628a3ecc9bcd854498e927250637913 Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 19 Apr 2020 18:40:57 +0200 Subject: [PATCH 2/2] migliorie download 2 --- core/support.py | 119 +++++++++++++++++----------------- platformcode/platformtools.py | 4 ++ 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/core/support.py b/core/support.py index 167051c6..e8db22bf 100755 --- a/core/support.py +++ b/core/support.py @@ -459,7 +459,7 @@ def scrape(func): if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): # item.fulltitle = item.infoLabels["title"] videolibrary(itemlist, item, function=function) - if config.get_setting('downloadenabled') and (function == 'episodios' or function == 'findvideos'): + if function == 'episodios' or function == 'findvideos': download(itemlist, item, function=function) if 'patronMenu' in args and itemlist: @@ -906,69 +906,70 @@ def match_dbg(data, patron): def download(itemlist, item, typography='', function_level=1, function=''): - if not typography: typography = 'color kod bold' + if config.get_setting('downloadenabled'): + if not typography: typography = 'color kod bold' - if item.contentType == 'movie': - from_action = 'findvideos' - title = typo(config.get_localized_string(60354), typography) - elif item.contentType == 'episode': - from_action = 'findvideos' - title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title - else: - from_action = 'episodios' - title = typo(config.get_localized_string(60355), typography) + if item.contentType == 'movie': + from_action = 'findvideos' + title = typo(config.get_localized_string(60354), typography) + elif item.contentType == 'episode': + from_action = 'findvideos' + title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title + else: + from_action = 'episodios' + title = typo(config.get_localized_string(60355), typography) - function = function if function else inspect.stack()[function_level][3] + function = function if function else inspect.stack()[function_level][3] - contentSerieName=item.contentSerieName if item.contentSerieName else '' - contentTitle=item.contentTitle if item.contentTitle else '' - downloadItemlist = [i.tourl() for i in itemlist] + contentSerieName=item.contentSerieName if item.contentSerieName else '' + contentTitle=item.contentTitle if item.contentTitle else '' + downloadItemlist = [i.tourl() for i in itemlist] - if itemlist and item.contentChannel != 'videolibrary': - show = True - # do not show if we are on findvideos and there are no valid servers - if from_action == 'findvideos': - for i in itemlist: - if i.action == 'play': - break - else: - show = False - if show: - itemlist.append( - Item(channel='downloads', - from_channel=item.channel, - title=title, - fulltitle=item.fulltitle, - show=item.fulltitle, - contentType=item.contentType, - contentSerieName=contentSerieName, - url=item.url, - action='save_download', - from_action=from_action, - contentTitle=contentTitle, - path=item.path, - thumbnail=thumb(thumb='downloads.png'), - downloadItemlist=downloadItemlist + if itemlist and item.contentChannel != 'videolibrary': + show = True + # do not show if we are on findvideos and there are no valid servers + if from_action == 'findvideos': + for i in itemlist: + if i.action == 'play': + break + else: + show = False + if show: + itemlist.append( + Item(channel='downloads', + from_channel=item.channel, + title=title, + fulltitle=item.fulltitle, + show=item.fulltitle, + contentType=item.contentType, + contentSerieName=contentSerieName, + url=item.url, + action='save_download', + from_action=from_action, + contentTitle=contentTitle, + path=item.path, + thumbnail=thumb(thumb='downloads.png'), + downloadItemlist=downloadItemlist + )) + if from_action == 'episodios': + itemlist.append( + Item(channel='downloads', + from_channel=item.channel, + title=typo(config.get_localized_string(60357),typography), + fulltitle=item.fulltitle, + show=item.fulltitle, + contentType=item.contentType, + contentSerieName=contentSerieName, + url=item.url, + action='save_download', + from_action=from_action, + contentTitle=contentTitle, + download='season', + thumbnail=thumb(thumb='downloads.png'), + downloadItemlist=downloadItemlist )) - if from_action == 'episodios': - itemlist.append( - Item(channel='downloads', - from_channel=item.channel, - title=typo(config.get_localized_string(60357),typography), - fulltitle=item.fulltitle, - show=item.fulltitle, - contentType=item.contentType, - contentSerieName=contentSerieName, - url=item.url, - action='save_download', - from_action=from_action, - contentTitle=contentTitle, - download='season', - thumbnail=thumb(thumb='downloads.png'), - downloadItemlist=downloadItemlist - )) - return itemlist + return itemlist def videolibrary(itemlist, item, typography='', function_level=1, function=''): @@ -1135,7 +1136,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True, vid autoplay.start(itemlist, item) if item.contentChannel != 'videolibrary' and video_library: videolibrary(itemlist, item, function_level=3) - if get_setting('downloadenabled') and down_load == True: download(itemlist, item, function_level=3) + if down_load == True: download(itemlist, item, function_level=3) VL = False try: diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 0cecb38d..5d7de2ac 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -790,6 +790,10 @@ def set_context_commands(item, item_url, parent_item, **kwargs): elif item.contentSerieName: # Descargar serie if item.contentType == "tvshow": + if item.channel == 'videolibrary': + context_commands.append((config.get_localized_string(60003), "XBMC.RunPlugin(%s?%s&%s)" % + (sys.argv[0], item_url, + 'channel=downloads&action=save_download&unseen=true&from_channel=' + item.channel + '&from_action=' + item.action))) context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))) context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s&%s)" %