Aggiunto Scarica Stagione

This commit is contained in:
Alhaziel
2019-08-24 12:10:59 +02:00
parent d44fc5cf70
commit aebe27dbf9
5 changed files with 71 additions and 23 deletions

View File

@@ -731,25 +731,42 @@ def match(item, patron='', patronBlock='', headers='', url='', post=''):
def download(itemlist, item, typography='', function_level=1, function=''):
if item.contentType == 'movie':
fromaction = 'findvideos'
title = config.get_localized_string(60354)
else:
fromaction = 'episodios'
title = config.get_localized_string(60355)
function = function if function else inspect.stack()[function_level][3]
if not typography: typography = 'color kod bold'
title = typo(title, typography)
if item.contentType == 'movie':
fromaction = 'findvideos'
title = typo(config.get_localized_string(60354), typography)
elif item.contentType == 'episode':
fromaction = 'findvideos'
title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title
else:
fromaction = 'episodios'
title = typo(config.get_localized_string(60355), typography)
function = function if function else inspect.stack()[function_level][3]
contentSerieName=item.contentSerieName if item.contentSerieName else ''
contentTitle=item.contentTitle if item.contentTitle else ''
if item.contentType != 'episode':
# if item.contentType != 'episode':
log(item)
itemlist.append(
Item(channel='downloads',
fromchannel=item.channel,
title=title,
fulltitle=item.fulltitle,
show=item.fulltitle,
contentType=item.contentType,
contentSerieName=contentSerieName,
url=item.url,
action='save_download',
fromaction=fromaction,
contentTitle=contentTitle
))
if fromaction == 'episodios':
itemlist.append(
Item(channel='downloads',
fromchannel=item.channel,
title=title,
title=typo(config.get_localized_string(60357),typography),
fulltitle=item.fulltitle,
show=item.fulltitle,
contentType=item.contentType,
@@ -757,8 +774,10 @@ def download(itemlist, item, typography='', function_level=1, function=''):
url=item.url,
action='save_download',
fromaction=fromaction,
contentTitle=contentTitle
))
contentTitle=contentTitle,
download='season'
))
return itemlist

View File

@@ -612,6 +612,11 @@ def set_context_commands(item, parent_item):
(sys.argv[0], item.clone(channel="downloads", action="save_download",
from_channel=item.channel,
from_action=item.action).tourl())))
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
(sys.argv[0], item.clone(channel="downloads", action="save_download",
from_channel=item.channel,
from_action=item.action,
download='season').tourl())))
# Descargar episodio
elif item.contentType == 'episode' and item.action in ["findvideos"]:
@@ -622,11 +627,12 @@ def set_context_commands(item, parent_item):
from_action=item.action).tourl())))
# Descargar temporada
elif item.contentType == "season":
context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
(sys.argv[0], item.clone(channel="downloads", action="save_download",
from_channel=item.channel,
from_action=item.action).tourl())))
# elif item.contentType == "season":
# context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
# (sys.argv[0], item.clone(channel="downloads", action="save_download",
# from_channel=item.channel,
# from_action=item.action,
# download='season').tourl())))
# Abrir configuración
if parent_item.channel not in ["setting", "news", "search"]:

View File

@@ -173,6 +173,10 @@ msgctxt "#30109"
msgid "added to download list"
msgstr ""
msgctxt "#30110"
msgid " Episodes of: "
msgstr " Episodi di: "
msgctxt "#30112"
msgid "Enter title to search"
msgstr ""

View File

@@ -171,7 +171,11 @@ msgstr "aggiunto ai preferiti"
msgctxt "#30109"
msgid "added to download list"
msgstr "aggiunto alla lista download"
msgstr "aggiunto/i alla lista download"
msgctxt "#30110"
msgid " Episodes of: "
msgstr " Episodi di: "
msgctxt "#30112"
msgid "Enter title to search"

View File

@@ -712,6 +712,11 @@ def start_download(item):
def get_episodes(item):
logger.info("contentAction: %s | contentChannel: %s | contentType: %s" % (
item.contentAction, item.contentChannel, item.contentType))
if 'dlseason' in item:
season = True
season_number = item.dlseason
else:
season = False
# El item que pretendemos descargar YA es un episodio
if item.contentType == "episode":
@@ -758,11 +763,18 @@ def get_episodes(item):
# Episodio, Temporada y Titulo
if not episode.contentTitle:
episode.contentTitle = re.sub("\[[^\]]+\]|\([^\)]+\)|\d*x\d*\s*-", "", episode.title).strip()
episode.contentTitle = re.sub(r"\[[^\]]+\]|\([^\)]+\)|\d*x\d*\s*-", "", episode.title).strip()
episode.downloadFilename = filetools.validate_path(os.path.join(item.downloadFilename, "%dx%0.2d - %s" % (
episode.contentSeason, episode.contentEpisodeNumber, episode.contentTitle.strip())))
itemlist.append(episode)
if season:
log('SEASON= ',season)
log(int(scrapertools.find_single_match(episode.title, r'(\d+)x')))
log(season_number,' ',type(season_number))
if scrapertools.find_single_match(episode.title, r'(\d+)x') == season_number:
itemlist.append(episode)
else:
itemlist.append(episode)
# Cualquier otro resultado no nos vale, lo ignoramos
else:
logger.info("Omitting invalid item: %s" % episode.tostring())
@@ -807,6 +819,9 @@ def save_download(item):
item.contentAction = item.fromaction if item.fromaction else item.action
if item.contentType in ["tvshow", "episode", "season"]:
if 'download' in item:
heading = config.get_localized_string(70686) # <- Enter the number of the starting season (for season > 1)
item.dlseason = platformtools.dialog_numeric(0, heading, '')
save_download_tvshow(item)
elif item.contentType == "movie":
@@ -885,7 +900,7 @@ def save_download_tvshow(item):
if not platformtools.dialog_yesno(config.get_localized_string(30101), config.get_localized_string(70189)):
platformtools.dialog_ok(config.get_localized_string(30101),
str(len(episodes)) + " capitulos de: " + item.contentSerieName,
str(len(episodes)) + config.get_localized_string(30110) + item.contentSerieName,
config.get_localized_string(30109))
else:
for i in episodes: