Auto-Renumeration + Test in Anime World^C
This commit is contained in:
@@ -4,10 +4,10 @@
|
|||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
import re, urlparse
|
import re, urlparse
|
||||||
|
|
||||||
from core import httptools, scrapertoolsV2, servertools, tmdb
|
from core import httptools, scrapertoolsV2, servertools, tmdb, tvdb
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from platformcode import logger, config
|
from platformcode import logger, config
|
||||||
from channels import autoplay, filtertools, support
|
from channels import autoplay, filtertools, support, autorenumber
|
||||||
from channelselector import thumb
|
from channelselector import thumb
|
||||||
|
|
||||||
|
|
||||||
@@ -215,6 +215,7 @@ def lista_anime(item):
|
|||||||
folder=True))
|
folder=True))
|
||||||
|
|
||||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||||
|
autorenumber.renumber(itemlist)
|
||||||
|
|
||||||
# Next page
|
# Next page
|
||||||
next_page = scrapertoolsV2.find_single_match(data, '<a class="page-link" href="([^"]+)" rel="next"')
|
next_page = scrapertoolsV2.find_single_match(data, '<a class="page-link" href="([^"]+)" rel="next"')
|
||||||
@@ -223,10 +224,10 @@ def lista_anime(item):
|
|||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel,
|
Item(channel=item.channel,
|
||||||
action='lista_anime',
|
action='lista_anime',
|
||||||
title='[B]' + config.get_localized_string(30992) + ' »[/B]',
|
title='[B]' + config.get_localized_string(30992) + ' >[/B]',
|
||||||
url=next_page,
|
url=next_page,
|
||||||
contentType=item.contentType,
|
contentType=item.contentType,
|
||||||
thumbnail='http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png'))
|
thumbnail=thumb()))
|
||||||
|
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
@@ -310,9 +311,11 @@ def video(item):
|
|||||||
url=scrapedurl,
|
url=scrapedurl,
|
||||||
fulltitle=title,
|
fulltitle=title,
|
||||||
show=title,
|
show=title,
|
||||||
thumbnail=scrapedthumb))
|
thumbnail=scrapedthumb,
|
||||||
|
context = autoplay.context))
|
||||||
|
|
||||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||||
|
autorenumber.renumber(itemlist)
|
||||||
|
|
||||||
# Next page
|
# Next page
|
||||||
next_page = scrapertoolsV2.find_single_match(data, '<a class="page-link" href=".*?page=([^"]+)" rel="next"')
|
next_page = scrapertoolsV2.find_single_match(data, '<a class="page-link" href=".*?page=([^"]+)" rel="next"')
|
||||||
@@ -321,10 +324,10 @@ def video(item):
|
|||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel,
|
Item(channel=item.channel,
|
||||||
action='video',
|
action='video',
|
||||||
title='[B]' + config.get_localized_string(30992) + ' »[/B]',
|
title='[B]' + config.get_localized_string(30992) + ' >[/B]',
|
||||||
url=re.sub('&page=([^"]+)', '', item.url) + '&page=' + next_page,
|
url=re.sub('&page=([^"]+)', '', item.url) + '&page=' + next_page,
|
||||||
contentType=item.contentType,
|
contentType=item.contentType,
|
||||||
thumbnail='http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png'))
|
thumbnail=thumb()))
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -356,6 +359,9 @@ def episodios(item):
|
|||||||
fanart=item.thumbnail,
|
fanart=item.thumbnail,
|
||||||
thumbnail=item.thumbnail))
|
thumbnail=item.thumbnail))
|
||||||
|
|
||||||
|
autorenumber.renumber(itemlist, item,'bold')
|
||||||
|
|
||||||
|
|
||||||
# Aggiungi a Libreria
|
# Aggiungi a Libreria
|
||||||
if config.get_videolibrary_support() and len(itemlist) != 0:
|
if config.get_videolibrary_support() and len(itemlist) != 0:
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# --------------------------------------------------------------------------------
|
||||||
|
# autorenumber - Rinomina Automaticamente gli Episodi
|
||||||
|
# --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
try:
|
||||||
|
import xbmcgui
|
||||||
|
except:
|
||||||
|
xbmcgui = None
|
||||||
|
|
||||||
|
from platformcode import config
|
||||||
|
from core import jsontools, tvdb
|
||||||
|
from core.item import Item
|
||||||
|
from platformcode import platformtools
|
||||||
|
from channels.support import typo, log
|
||||||
|
|
||||||
|
TAG_TVSHOW_RENUMERATE = "TVSHOW_AUTORENUMBER"
|
||||||
|
TAG_SEASON_EPISODE = "season_episode"
|
||||||
|
__channel__ = "autorenumber"
|
||||||
|
|
||||||
|
|
||||||
|
def access():
|
||||||
|
allow = False
|
||||||
|
|
||||||
|
if config.is_xbmc():
|
||||||
|
allow = True
|
||||||
|
|
||||||
|
return allow
|
||||||
|
|
||||||
|
|
||||||
|
def context():
|
||||||
|
if access():
|
||||||
|
_context = [{"title": config.get_localized_string(70585),
|
||||||
|
"action": "config_item",
|
||||||
|
"channel": "autorenumber"}]
|
||||||
|
|
||||||
|
return _context
|
||||||
|
|
||||||
|
|
||||||
|
def config_item(item):
|
||||||
|
log(item)
|
||||||
|
tvdb.find_and_set_infoLabels(item)
|
||||||
|
data = ''
|
||||||
|
data = add_season(data)
|
||||||
|
data.append(item.infoLabels['tvdb_id'])
|
||||||
|
write_data(item.from_channel, item.show, data)
|
||||||
|
|
||||||
|
|
||||||
|
def add_season(data=None):
|
||||||
|
log("data= ", data)
|
||||||
|
heading = config.get_localized_string(70686)
|
||||||
|
season = platformtools.dialog_numeric(0, heading)
|
||||||
|
|
||||||
|
if season != "":
|
||||||
|
heading = config.get_localized_string(70687)
|
||||||
|
episode = platformtools.dialog_numeric(0, heading)
|
||||||
|
if episode != "":
|
||||||
|
return [int(season), int(episode)]
|
||||||
|
|
||||||
|
|
||||||
|
def write_data(channel, show, data):
|
||||||
|
log()
|
||||||
|
dict_series = jsontools.get_node_from_file(channel, TAG_TVSHOW_RENUMERATE)
|
||||||
|
tvshow = show.strip()
|
||||||
|
list_season_episode = dict_series.get(tvshow, {}).get(TAG_SEASON_EPISODE, [])
|
||||||
|
|
||||||
|
if data:
|
||||||
|
dict_renumerate = {TAG_SEASON_EPISODE: data}
|
||||||
|
dict_series[tvshow] = dict_renumerate
|
||||||
|
else:
|
||||||
|
dict_series.pop(tvshow, None)
|
||||||
|
|
||||||
|
result, json_data = jsontools.update_node(dict_series, channel, TAG_TVSHOW_RENUMERATE)
|
||||||
|
|
||||||
|
if result:
|
||||||
|
if data:
|
||||||
|
message = config.get_localized_string(60446)
|
||||||
|
else:
|
||||||
|
message = config.get_localized_string(60444)
|
||||||
|
else:
|
||||||
|
message = config.get_localized_string(70593)
|
||||||
|
|
||||||
|
heading = show.strip()
|
||||||
|
platformtools.dialog_notification(heading, message)
|
||||||
|
|
||||||
|
def renumber(itemlist, item='', typography=''):
|
||||||
|
log()
|
||||||
|
|
||||||
|
if item:
|
||||||
|
try:
|
||||||
|
dict_series = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_RENUMERATE)
|
||||||
|
SERIES = dict_series[item.show]['season_episode']
|
||||||
|
S = SERIES[0]
|
||||||
|
E = SERIES[1]
|
||||||
|
ID = SERIES[2]
|
||||||
|
|
||||||
|
logger.info(str(S) + '|' + str(E) + '|' + ID)
|
||||||
|
|
||||||
|
page = 1
|
||||||
|
epList = []
|
||||||
|
exist = True
|
||||||
|
item.infoLabels['tvdb_id'] = ID
|
||||||
|
tvdb.set_infoLabels_item(item)
|
||||||
|
|
||||||
|
while exist:
|
||||||
|
data = tvdb.otvdb_global.get_list_episodes(ID,page)
|
||||||
|
if data:
|
||||||
|
for episodes in data['data']:
|
||||||
|
if episodes['airedSeason'] >= S:
|
||||||
|
if episodes['airedEpisodeNumber'] >= E:
|
||||||
|
epList.append(str(episodes['airedSeason']) + 'x' + str(episodes['airedEpisodeNumber']))
|
||||||
|
page = page + 1
|
||||||
|
else:
|
||||||
|
exist = False
|
||||||
|
logger.info(str(epList))
|
||||||
|
ep = 0
|
||||||
|
for item in itemlist:
|
||||||
|
item.title = typo(epList[ep] + ' - ', typography) + item.title
|
||||||
|
ep = ep + 1
|
||||||
|
except:
|
||||||
|
return itemlist
|
||||||
|
else:
|
||||||
|
for item in itemlist:
|
||||||
|
if item.contentType != 'movie':
|
||||||
|
if item.context:
|
||||||
|
context2 = item.context
|
||||||
|
item.context = context() + context2
|
||||||
|
else:
|
||||||
|
item.context = context()
|
||||||
|
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -5311,8 +5311,8 @@ msgid "Do you want to update Quasar to avoid errors?"
|
|||||||
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
||||||
|
|
||||||
msgctxt "#70585"
|
msgctxt "#70585"
|
||||||
msgid "RENUMERAR"
|
msgid "RENUMBERING"
|
||||||
msgstr ""
|
msgstr "RENUMERAR"
|
||||||
|
|
||||||
msgctxt "#70586"
|
msgctxt "#70586"
|
||||||
msgid "Set up series number..."
|
msgid "Set up series number..."
|
||||||
@@ -5721,3 +5721,15 @@ msgstr "%s se ha agregado"
|
|||||||
msgctxt "#70684"
|
msgctxt "#70684"
|
||||||
msgid "%s has been deleted"
|
msgid "%s has been deleted"
|
||||||
msgstr "%s ha sido eliminado"
|
msgstr "%s ha sido eliminado"
|
||||||
|
|
||||||
|
msgctxt "#70685"
|
||||||
|
msgid "Community"
|
||||||
|
msgstr "Comunidad"
|
||||||
|
|
||||||
|
msgctxt "#70686"
|
||||||
|
msgid "Enter the number of the starting season"
|
||||||
|
msgstr "Ingrese el número de la temporada de inicio"
|
||||||
|
|
||||||
|
msgctxt "#70687"
|
||||||
|
msgid "Enter the number of the starting episode"
|
||||||
|
msgstr "Ingrese el número del episodio inicial"
|
||||||
@@ -10429,3 +10429,11 @@ msgstr ""
|
|||||||
msgctxt "#70685"
|
msgctxt "#70685"
|
||||||
msgid "Community"
|
msgid "Community"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#70686"
|
||||||
|
msgid "Enter the number of the starting season"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#70687"
|
||||||
|
msgid "Enter the number of the starting episode"
|
||||||
|
msgstr ""
|
||||||
@@ -5417,3 +5417,11 @@ msgstr "%s è stato eliminato"
|
|||||||
msgctxt "#70685"
|
msgctxt "#70685"
|
||||||
msgid "Community"
|
msgid "Community"
|
||||||
msgstr "Community"
|
msgstr "Community"
|
||||||
|
|
||||||
|
msgctxt "#70686"
|
||||||
|
msgid "Enter the number of the starting season"
|
||||||
|
msgstr "Inserisci il numero della stagione di partenza"
|
||||||
|
|
||||||
|
msgctxt "#70687"
|
||||||
|
msgid "Enter the number of the starting episode"
|
||||||
|
msgstr "Inserisci il numero dell'episodio di partenza"
|
||||||
@@ -5024,8 +5024,8 @@ msgid "Do you want to update Quasar to avoid errors?"
|
|||||||
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
||||||
|
|
||||||
msgctxt "#70585"
|
msgctxt "#70585"
|
||||||
msgid "RENUMERAR"
|
msgid "RENUMBERING"
|
||||||
msgstr ""
|
msgstr "RENUMERAR"
|
||||||
|
|
||||||
msgctxt "#70586"
|
msgctxt "#70586"
|
||||||
msgid "Set up series number..."
|
msgid "Set up series number..."
|
||||||
@@ -5438,3 +5438,11 @@ msgstr "%s ha sido eliminado"
|
|||||||
msgctxt "#70685"
|
msgctxt "#70685"
|
||||||
msgid "Community"
|
msgid "Community"
|
||||||
msgstr "Comunidad"
|
msgstr "Comunidad"
|
||||||
|
|
||||||
|
msgctxt "#70686"
|
||||||
|
msgid "Enter the number of the starting season"
|
||||||
|
msgstr "Ingrese el número de la temporada de inicio"
|
||||||
|
|
||||||
|
msgctxt "#70687"
|
||||||
|
msgid "Enter the number of the starting episode"
|
||||||
|
msgstr "Ingrese el número del episodio inicial"
|
||||||
@@ -5024,8 +5024,8 @@ msgid "Do you want to update Quasar to avoid errors?"
|
|||||||
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
||||||
|
|
||||||
msgctxt "#70585"
|
msgctxt "#70585"
|
||||||
msgid "RENUMERAR"
|
msgid "RENUMBERING"
|
||||||
msgstr ""
|
msgstr "RENUMERAR"
|
||||||
|
|
||||||
msgctxt "#70586"
|
msgctxt "#70586"
|
||||||
msgid "Set up series number..."
|
msgid "Set up series number..."
|
||||||
@@ -5438,3 +5438,11 @@ msgstr "%s ha sido eliminado"
|
|||||||
msgctxt "#70685"
|
msgctxt "#70685"
|
||||||
msgid "Community"
|
msgid "Community"
|
||||||
msgstr "Comunidad"
|
msgstr "Comunidad"
|
||||||
|
|
||||||
|
msgctxt "#70686"
|
||||||
|
msgid "Enter the number of the starting season"
|
||||||
|
msgstr "Ingrese el número de la temporada de inicio"
|
||||||
|
|
||||||
|
msgctxt "#70687"
|
||||||
|
msgid "Enter the number of the starting episode"
|
||||||
|
msgstr "Ingrese el número del episodio inicial"
|
||||||
@@ -5024,8 +5024,8 @@ msgid "Do you want to update Quasar to avoid errors?"
|
|||||||
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
msgstr "¿Quiere actualizar Quasar para evitar errores?"
|
||||||
|
|
||||||
msgctxt "#70585"
|
msgctxt "#70585"
|
||||||
msgid "RENUMERAR"
|
msgid "RENUMBERING"
|
||||||
msgstr ""
|
msgstr "RENUMERAR"
|
||||||
|
|
||||||
msgctxt "#70586"
|
msgctxt "#70586"
|
||||||
msgid "Set up series number..."
|
msgid "Set up series number..."
|
||||||
@@ -5438,3 +5438,11 @@ msgstr "%s ha sido eliminado"
|
|||||||
msgctxt "#70685"
|
msgctxt "#70685"
|
||||||
msgid "Community"
|
msgid "Community"
|
||||||
msgstr "Comunidad"
|
msgstr "Comunidad"
|
||||||
|
|
||||||
|
msgctxt "#70686"
|
||||||
|
msgid "Enter the number of the starting season"
|
||||||
|
msgstr "Ingrese el número de la temporada de inicio"
|
||||||
|
|
||||||
|
msgctxt "#70687"
|
||||||
|
msgid "Enter the number of the starting episode"
|
||||||
|
msgstr "Ingrese el número del episodio inicial"
|
||||||
Reference in New Issue
Block a user