Fix Download Anime

This commit is contained in:
Alhaziel
2019-10-05 09:27:19 +02:00
parent 49d75fce7b
commit bbdb0df3fe
3 changed files with 25 additions and 19 deletions
+7 -7
View File
@@ -275,7 +275,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
infoLabels=infolabels, infoLabels=infolabels,
thumbnail=item.thumbnail if function == 'episodios' else scraped["thumb"] , thumbnail=item.thumbnail if function == 'episodios' else scraped["thumb"] ,
args=item.args, args=item.args,
contentSerieName= title if item.contentType or CT != 'movie' and function != 'episodios' else item.fulltitle if function == 'episodios' else '', contentSerieName= item.title if item.contentType or CT != 'movie' and function != 'episodios' else item.fulltitle if function == 'episodios' else '',
contentTitle= title if item.contentType or CT == 'movie' else '', contentTitle= title if item.contentType or CT == 'movie' else '',
contentLanguage = lang1, contentLanguage = lang1,
contentEpisodeNumber=episode if episode else '' contentEpisodeNumber=episode if episode else ''
@@ -756,13 +756,13 @@ def download(itemlist, item, typography='', function_level=1, function=''):
if not typography: typography = 'color kod bold' if not typography: typography = 'color kod bold'
if item.contentType == 'movie': if item.contentType == 'movie':
fromaction = 'findvideos' from_action = 'findvideos'
title = typo(config.get_localized_string(60354), typography) title = typo(config.get_localized_string(60354), typography)
elif item.contentType == 'episode': elif item.contentType == 'episode':
fromaction = 'findvideos' from_action = 'findvideos'
title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title
else: else:
fromaction = 'episodios' from_action = 'episodios'
title = typo(config.get_localized_string(60355), typography) 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]
@@ -781,10 +781,10 @@ def download(itemlist, item, typography='', function_level=1, function=''):
contentSerieName=contentSerieName, contentSerieName=contentSerieName,
url=item.url, url=item.url,
action='save_download', action='save_download',
fromaction=fromaction, from_action=from_action,
contentTitle=contentTitle contentTitle=contentTitle
)) ))
if fromaction == 'episodios': if from_action == 'episodios':
itemlist.append( itemlist.append(
Item(channel='downloads', Item(channel='downloads',
from_channel=item.channel, from_channel=item.channel,
@@ -795,7 +795,7 @@ def download(itemlist, item, typography='', function_level=1, function=''):
contentSerieName=contentSerieName, contentSerieName=contentSerieName,
url=item.url, url=item.url,
action='save_download', action='save_download',
fromaction=fromaction, from_action=from_action,
contentTitle=contentTitle, contentTitle=contentTitle,
download='season' download='season'
)) ))
+15 -9
View File
@@ -114,7 +114,7 @@ def manual_renumeration(item, modify=False):
dict_series[title] = dict_renumerate dict_series[title] = dict_renumerate
# channel = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel]) # channel = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
itemlist = get_episodes(item) itemlist = find_episodes(item)
for item in itemlist: for item in itemlist:
Title = re.sub(r'\d+x\d+ - ', '', item.title) Title = re.sub(r'\d+x\d+ - ', '', item.title)
if modify == True: if modify == True:
@@ -210,7 +210,7 @@ def semiautomatic_config_item(item):
jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0] jsontools.update_node(dict_series, item.channel, TAG_TVSHOW_RENUMERATE)[0]
_list = [] _list = []
# channel = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel]) # channel = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
itemlist = get_episodes(item) itemlist = find_episodes(item)
for item in itemlist: for item in itemlist:
Title = re.sub(r'\d+x\d+ - ', '', item.title) Title = re.sub(r'\d+x\d+ - ', '', item.title)
if item.action == 'findvideos': if item.action == 'findvideos':
@@ -287,6 +287,7 @@ def config_item(item, itemlist=[], typography='', active=False):
def renumber(itemlist, item='', typography=''): def renumber(itemlist, item='', typography=''):
log() log()
# dbg()
# Carica Impostazioni # Carica Impostazioni
if itemlist: if itemlist:
settings_node = jsontools.get_node_from_file(itemlist[0].channel, 'settings') settings_node = jsontools.get_node_from_file(itemlist[0].channel, 'settings')
@@ -294,23 +295,28 @@ def renumber(itemlist, item='', typography=''):
settings_node = {} settings_node = {}
try: dict_series = jsontools.get_node_from_file(itemlist[0].channel, TAG_TVSHOW_RENUMERATE) try: dict_series = jsontools.get_node_from_file(itemlist[0].channel, TAG_TVSHOW_RENUMERATE)
except: dict_series = {} except: dict_series = {}
log('CHANNEL', itemlist[0])
# Seleziona la funzione Adatta, Menu Contestuale o Rinumerazione # Seleziona la funzione Adatta, Menu Contestuale o Rinumerazione
if item: if item:
if 'from_channel' in item: item.channel = item.from_channel if item.from_channel else item.channel
item.channel = item.from_channel if item.from_channel else item.channel
# Controlla se la Serie è già stata rinumerata # Controlla se la Serie è già stata rinumerata
TITLE = item.fulltitle.rstrip() if item.fulltitle else item.contentTitle TITLE = item.fulltitle.rstrip() if item.fulltitle else item.contentTitle
if inspect.stack()[2][3] == 'get_episodes': log('dict', dict_series)
log('TITLE ', TITLE)
log('TITLE EXIST? ', TITLE in dict_series)
log('HAS ID? ',dict_series[TITLE].has_key(TAG_ID))
if inspect.stack()[2][3] == 'find_episodes':
log('PRENDO ITEMLIST ',inspect.stack()[2][3])
return itemlist return itemlist
elif dict_series.has_key(TITLE) and dict_series[TITLE].has_key(TAG_ID): elif dict_series.has_key(TITLE) and dict_series[TITLE].has_key(TAG_ID):
ID = dict_series[TITLE][TAG_ID] ID = dict_series[TITLE][TAG_ID]
EPISODE = dict_series[TITLE][TAG_EPISODE] EPISODE = dict_series[TITLE][TAG_EPISODE]
if dict_series[TITLE].has_key(TAG_SEASON): SEASON = dict_series[TITLE][TAG_SEASON] if dict_series[TITLE].has_key(TAG_SEASON): SEASON = dict_series[TITLE][TAG_SEASON]
else: SEASON = '' else: SEASON = ''
if dict_series[TITLE].has_key(TAG_MODE): MODE = dict_series[TITLE][TAG_MODE] if dict_series[TITLE].has_key(TAG_MODE): MODE = dict_series[TITLE][TAG_MODE]
else: MODE = False else: MODE = False
@@ -349,7 +355,7 @@ def renumber(itemlist, item='', typography=''):
item.context = context(exist) item.context = context(exist)
def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE, TYPE): def renumeration (itemlist, item, typography, dict_series, ID, SEASON, EPISODE, MODE, TITLE, TYPE):
# Se ID è 0 salta la rinumerazione # Se ID è 0 salta la rinumerazione
if ID == '0': if ID == '0':
return itemlist return itemlist
@@ -543,7 +549,7 @@ def check(item):
exist = False exist = False
return exist return exist
def get_episodes(item): def find_episodes(item):
log() log()
ch = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel]) ch = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
itemlist = ch.episodios(item) itemlist = ch.episodios(item)
+3 -3
View File
@@ -811,11 +811,11 @@ def save_download(item):
if item.from_action and item.from_channel: if item.from_action and item.from_channel:
item.channel = item.from_channel item.channel = item.from_channel
item.action = item.from_action item.action = item.from_action
del item.from_action item.from_action
del item.from_channel item.from_channel
item.contentChannel = item.from_channel if item.from_channel else item.channel item.contentChannel = item.from_channel if item.from_channel else item.channel
item.contentAction = item.fromaction if item.fromaction else item.action item.contentAction = item.from_action if item.from_action else item.action
if item.contentType in ["tvshow", "episode", "season"]: if item.contentType in ["tvshow", "episode", "season"]:
if 'download' in item: if 'download' in item: