diff --git a/plugin.video.alfa/channels/animeworld.py b/plugin.video.alfa/channels/animeworld.py
index f811f030..34314cfd 100644
--- a/plugin.video.alfa/channels/animeworld.py
+++ b/plugin.video.alfa/channels/animeworld.py
@@ -4,10 +4,10 @@
# ----------------------------------------------------------
import re, urlparse
-from core import httptools, scrapertoolsV2, servertools, tmdb
+from core import httptools, scrapertoolsV2, servertools, tmdb, tvdb
from core.item import Item
from platformcode import logger, config
-from channels import autoplay, filtertools, support
+from channels import autoplay, filtertools, support, autorenumber
from channelselector import thumb
@@ -214,7 +214,8 @@ def lista_anime(item):
plot=scrapedplot,
folder=True))
- tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
+ tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
+ autorenumber.renumber(itemlist)
# Next page
next_page = scrapertoolsV2.find_single_match(data, '[/B]',
url=next_page,
contentType=item.contentType,
- thumbnail='http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png'))
+ thumbnail=thumb()))
return itemlist
@@ -310,9 +311,11 @@ def video(item):
url=scrapedurl,
fulltitle=title,
show=title,
- thumbnail=scrapedthumb))
+ thumbnail=scrapedthumb,
+ context = autoplay.context))
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
+ autorenumber.renumber(itemlist)
# Next page
next_page = scrapertoolsV2.find_single_match(data, '[/B]',
url=re.sub('&page=([^"]+)', '', item.url) + '&page=' + next_page,
contentType=item.contentType,
- thumbnail='http://2.bp.blogspot.com/-fE9tzwmjaeQ/UcM2apxDtjI/AAAAAAAAeeg/WKSGM2TADLM/s1600/pager+old.png'))
+ thumbnail=thumb()))
return itemlist
def episodios(item):
logger.info("[animeworld.py] episodios")
- itemlist = []
+ itemlist = []
data = httptools.downloadpage(item.url).data.replace('\n', '')
data = re.sub(r'>\s*<', '><', data)
@@ -340,7 +343,7 @@ def episodios(item):
patron = r'(.*?)<\/a>'
matches = re.compile(patron, re.DOTALL).findall(block)
-
+
for scrapedurl, scrapedtitle in matches:
scrapedtitle = '[B] Episodio ' + scrapedtitle + '[/B]'
itemlist.append(
@@ -355,7 +358,10 @@ def episodios(item):
plot=item.plot,
fanart=item.thumbnail,
thumbnail=item.thumbnail))
-
+
+ autorenumber.renumber(itemlist, item,'bold')
+
+
# Aggiungi a Libreria
if config.get_videolibrary_support() and len(itemlist) != 0:
itemlist.append(
diff --git a/plugin.video.alfa/channels/autorenumber.py b/plugin.video.alfa/channels/autorenumber.py
new file mode 100644
index 00000000..f72df8e7
--- /dev/null
+++ b/plugin.video.alfa/channels/autorenumber.py
@@ -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
+
+
+
diff --git a/plugin.video.alfa/resources/language/Catalan/strings.po b/plugin.video.alfa/resources/language/Catalan/strings.po
index d62f674e..8a99617a 100644
--- a/plugin.video.alfa/resources/language/Catalan/strings.po
+++ b/plugin.video.alfa/resources/language/Catalan/strings.po
@@ -5311,8 +5311,8 @@ msgid "Do you want to update Quasar to avoid errors?"
msgstr "¿Quiere actualizar Quasar para evitar errores?"
msgctxt "#70585"
-msgid "RENUMERAR"
-msgstr ""
+msgid "RENUMBERING"
+msgstr "RENUMERAR"
msgctxt "#70586"
msgid "Set up series number..."
@@ -5720,4 +5720,16 @@ msgstr "%s se ha agregado"
msgctxt "#70684"
msgid "%s has been deleted"
-msgstr "%s ha sido eliminado"
\ No newline at end of file
+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"
\ No newline at end of file
diff --git a/plugin.video.alfa/resources/language/English/strings.po b/plugin.video.alfa/resources/language/English/strings.po
index c6939f7d..5e9ecccd 100644
--- a/plugin.video.alfa/resources/language/English/strings.po
+++ b/plugin.video.alfa/resources/language/English/strings.po
@@ -10428,4 +10428,12 @@ msgstr ""
msgctxt "#70685"
msgid "Community"
+msgstr ""
+
+msgctxt "#70686"
+msgid "Enter the number of the starting season"
+msgstr ""
+
+msgctxt "#70687"
+msgid "Enter the number of the starting episode"
msgstr ""
\ No newline at end of file
diff --git a/plugin.video.alfa/resources/language/Italian/strings.po b/plugin.video.alfa/resources/language/Italian/strings.po
index 038f70e8..4c6f2a0b 100644
--- a/plugin.video.alfa/resources/language/Italian/strings.po
+++ b/plugin.video.alfa/resources/language/Italian/strings.po
@@ -5416,4 +5416,12 @@ msgstr "%s è stato eliminato"
msgctxt "#70685"
msgid "Community"
-msgstr "Community"
\ No newline at end of file
+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"
\ No newline at end of file
diff --git a/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po b/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po
index 7e0f010a..6e57f3e7 100644
--- a/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po
+++ b/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po
@@ -5024,8 +5024,8 @@ msgid "Do you want to update Quasar to avoid errors?"
msgstr "¿Quiere actualizar Quasar para evitar errores?"
msgctxt "#70585"
-msgid "RENUMERAR"
-msgstr ""
+msgid "RENUMBERING"
+msgstr "RENUMERAR"
msgctxt "#70586"
msgid "Set up series number..."
@@ -5437,4 +5437,12 @@ msgstr "%s ha sido eliminado"
msgctxt "#70685"
msgid "Community"
-msgstr "Comunidad"
\ No newline at end of file
+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"
\ No newline at end of file
diff --git a/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po b/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po
index 7e0f010a..6e57f3e7 100644
--- a/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po
+++ b/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po
@@ -5024,8 +5024,8 @@ msgid "Do you want to update Quasar to avoid errors?"
msgstr "¿Quiere actualizar Quasar para evitar errores?"
msgctxt "#70585"
-msgid "RENUMERAR"
-msgstr ""
+msgid "RENUMBERING"
+msgstr "RENUMERAR"
msgctxt "#70586"
msgid "Set up series number..."
@@ -5437,4 +5437,12 @@ msgstr "%s ha sido eliminado"
msgctxt "#70685"
msgid "Community"
-msgstr "Comunidad"
\ No newline at end of file
+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"
\ No newline at end of file
diff --git a/plugin.video.alfa/resources/language/Spanish/strings.po b/plugin.video.alfa/resources/language/Spanish/strings.po
index 1b4be86c..8b0cfc62 100644
--- a/plugin.video.alfa/resources/language/Spanish/strings.po
+++ b/plugin.video.alfa/resources/language/Spanish/strings.po
@@ -5024,8 +5024,8 @@ msgid "Do you want to update Quasar to avoid errors?"
msgstr "¿Quiere actualizar Quasar para evitar errores?"
msgctxt "#70585"
-msgid "RENUMERAR"
-msgstr ""
+msgid "RENUMBERING"
+msgstr "RENUMERAR"
msgctxt "#70586"
msgid "Set up series number..."
@@ -5437,4 +5437,12 @@ msgstr "%s ha sido eliminado"
msgctxt "#70685"
msgid "Community"
-msgstr "Comunidad"
\ No newline at end of file
+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"
\ No newline at end of file