Merge remote-tracking branch 'origin/master'

This commit is contained in:
marco
2019-10-17 20:46:21 +02:00
9 changed files with 132 additions and 72 deletions
+6 -3
View File
@@ -804,7 +804,8 @@ def download(itemlist, item, typography='', function_level=1, function=''):
url=item.url, url=item.url,
action='save_download', action='save_download',
from_action=from_action, from_action=from_action,
contentTitle=contentTitle contentTitle=contentTitle,
path=item.path
)) ))
if from_action == 'episodios': if from_action == 'episodios':
itemlist.append( itemlist.append(
@@ -849,7 +850,8 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
contentTitle=item.contentTitle if item.contentTitle else '' contentTitle=item.contentTitle if item.contentTitle else ''
if (function == 'findvideos' and contentType == 'movie') \ if (function == 'findvideos' and contentType == 'movie') \
or (function == 'episodios' and contentType != 'movie'): or (function == 'episodios' and contentType != 'movie') \
or function == 'get_seasons' and item.channel == 'community':
if config.get_videolibrary_support() and len(itemlist) > 0: if config.get_videolibrary_support() and len(itemlist) > 0:
itemlist.append( itemlist.append(
Item(channel=item.channel, Item(channel=item.channel,
@@ -861,7 +863,8 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
url=item.url, url=item.url,
action=action, action=action,
extra=extra, extra=extra,
contentTitle=contentTitle contentTitle=contentTitle,
path=item.path
)) ))
return itemlist return itemlist
+4 -1
View File
@@ -833,7 +833,10 @@ def add_tvshow(item, channel=None):
# del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca # del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca
# Obtiene el listado de episodios # Obtiene el listado de episodios
itemlist = getattr(channel, item.action)(item) if item.channel == 'community':
itemlist = getattr(channel, 'get_seasons')(item)
else:
itemlist = getattr(channel, item.action)(item)
insertados, sobreescritos, fallidos, path = save_tvshow(item, itemlist) insertados, sobreescritos, fallidos, path = save_tvshow(item, itemlist)
+15 -10
View File
@@ -22,7 +22,7 @@ from channelselector import get_thumb
from core import channeltools from core import channeltools
from core import trakt_tools, scrapertoolsV2 from core import trakt_tools, scrapertoolsV2
from core.item import Item from core.item import Item
from platformcode import logger from platformcode import logger, keymaptools
from platformcode import unify from platformcode import unify
addon = xbmcaddon.Addon('plugin.video.kod') addon = xbmcaddon.Addon('plugin.video.kod')
@@ -587,7 +587,7 @@ def set_context_commands(item, parent_item):
if (item.channel != "videolibrary" and not config.get_localized_string(70585) in str(item.context)) \ if (item.channel != "videolibrary" and not config.get_localized_string(70585) in str(item.context)) \
or (item.channel != "videolibrary" and config.get_localized_string(70585) in str(item.context) and config.get_localized_string(70714) in str(item.context)): or (item.channel != "videolibrary" and config.get_localized_string(70585) in str(item.context) and config.get_localized_string(70714) in str(item.context)):
# Añadir Serie a la videoteca # Añadir Serie a la videoteca
if item.action in ["episodios", "get_episodios"] and item.contentSerieName: if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
context_commands.append((config.get_localized_string(60352), "XBMC.RunPlugin(%s?%s)" % context_commands.append((config.get_localized_string(60352), "XBMC.RunPlugin(%s?%s)" %
(sys.argv[0], item.clone(action="add_serie_to_library", (sys.argv[0], item.clone(action="add_serie_to_library",
from_action=item.action).tourl()))) from_action=item.action).tourl())))
@@ -608,7 +608,7 @@ def set_context_commands(item, parent_item):
# elif item.contentSerieName: # elif item.contentSerieName:
# Descargar serie # Descargar serie
elif item.contentType == "tvshow" and item.action in ["episodios"]: elif item.contentType == "tvshow" and item.action in ["episodios", "episodesxseason"]:
item.contentType == "tvshow" item.contentType == "tvshow"
context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s)" % context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s)" %
(sys.argv[0], item.clone(channel="downloads", action="save_download", (sys.argv[0], item.clone(channel="downloads", action="save_download",
@@ -629,12 +629,12 @@ def set_context_commands(item, parent_item):
from_action=item.action).tourl()))) from_action=item.action).tourl())))
# Descargar temporada # Descargar temporada
# elif item.contentType == "season": elif item.contentType == "season":
# context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" % context_commands.append((config.get_localized_string(60357), "XBMC.RunPlugin(%s?%s)" %
# (sys.argv[0], item.clone(channel="downloads", action="save_download", (sys.argv[0], item.clone(channel="downloads", action="save_download",
# from_channel=item.channel, from_channel=item.channel,
# from_action=item.action, from_action=item.action,
# download='season').tourl()))) download='season').tourl())))
# Abrir configuración # Abrir configuración
if parent_item.channel not in ["setting", "news", "search"]: if parent_item.channel not in ["setting", "news", "search"]:
@@ -656,12 +656,17 @@ def set_context_commands(item, parent_item):
context_commands = sorted(context_commands, key=lambda comand: comand[0]) context_commands = sorted(context_commands, key=lambda comand: comand[0])
# Menu Rapido # Menu Rapido
context_commands.insert(0, (config.get_localized_string(60360), context_commands.insert(0, (config.get_localized_string(60360),
"XBMC.RunPlugin(%s?%s)" % (sys.argv[0], Item(channel='side_menu',
action="open_shortcut_menu",
parent=parent_item.tourl()).tourl(
))))
context_commands.insert(1, (config.get_localized_string(70737),
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(channel='side_menu', "XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(channel='side_menu',
action="open_menu", action="open_menu",
parent=parent_item.tourl()).tourl( parent=parent_item.tourl()).tourl(
)))) ))))
if config.dev_mode(): if config.dev_mode():
context_commands.insert(1, ("item info", context_commands.insert(2, ("item info",
"XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", "XBMC.Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo",
parent=item.tojson()).tourl()))) parent=item.tojson()).tourl())))
return context_commands return context_commands
+4
View File
@@ -5660,3 +5660,7 @@ msgstr ""
msgctxt "#70735" msgctxt "#70735"
msgid "%s Special Episode Number" msgid "%s Special Episode Number"
msgstr "" msgstr ""
msgctxt "#70737"
msgid "[B]SIDE MENU[/B]"
msgstr ""
+4
View File
@@ -5664,3 +5664,7 @@ msgstr "Numero dell'Episodio Speciale %s"
msgctxt "#70736" msgctxt "#70736"
msgid "Completed Serie" msgid "Completed Serie"
msgstr "Serie Completa" msgstr "Serie Completa"
msgctxt "#70737"
msgid "[B]SIDE MENU[/B]"
msgstr "[B]MENU LATERALE[/B]"
+26 -14
View File
@@ -3,10 +3,10 @@
# -*- Created for Alfa-addon -*- # -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*- # -*- By the Alfa Develop Group -*-
import re, urllib, os import re, urllib, os, inspect
import requests import requests
from core import httptools, scrapertoolsV2, servertools, jsontools, tmdb from core import httptools, scrapertoolsV2, servertools, jsontools, tmdb, support
from core.item import Item from core.item import Item
from core.support import typo from core.support import typo
from channelselector import get_thumb from channelselector import get_thumb
@@ -74,7 +74,7 @@ def show_channels(item):
return itemlist return itemlist
def load_json(item): def load_json(item):
support.log(item)
url= item if type(item) == str else item.url url= item if type(item) == str else item.url
if url: if url:
@@ -144,7 +144,7 @@ def list_all(item):
title = media['title'] title = media['title']
title = set_title(title, language, quality) title = set_title(title, language, quality)
new_item = Item(channel=item.channel, title=format_title(title), quality=quality, new_item = Item(channel=item.channel, title=format_title(title), fulltitle=title, show=title, quality=quality,
language=language, plot=plot, personal_plot=plot, thumbnail=poster, path=item.path) language=language, plot=plot, personal_plot=plot, thumbnail=poster, path=item.path)
new_item.infoLabels['year'] = media['year'] if 'year' in media else '' new_item.infoLabels['year'] = media['year'] if 'year' in media else ''
@@ -154,10 +154,11 @@ def list_all(item):
new_item.url = media new_item.url = media
new_item.contentTitle = media['title'] new_item.contentTitle = media['title']
new_item.action = 'findvideos' new_item.action = 'findvideos'
if 'movies_list' in json_data: new_item.contentType = 'movie'
else: else:
new_item.url = media['seasons_list'] new_item.url = media['seasons_list']
new_item.contentSerieName = media['title'] new_item.contentSerieName = media['title']
new_item.action = 'seasons' new_item.action = 'get_seasons'
itemlist.append(new_item) itemlist.append(new_item)
@@ -168,20 +169,31 @@ def list_all(item):
item.plot = '\n\n' + typo('','submenu') + '\n' + item.personal_plot + '\n' + typo('','submenu') + '\n\n' + item.plot item.plot = '\n\n' + typo('','submenu') + '\n' + item.personal_plot + '\n' + typo('','submenu') + '\n\n' + item.plot
return itemlist return itemlist
def seasons(item): def get_seasons(item):
logger.info()
itemlist = [] itemlist = []
infoLabels = item.infoLabels infoLabels = item.infoLabels if item.infolabels else {}
list_seasons = item.url list_seasons = item.url
for season in list_seasons: for season in list_seasons:
support.log()
infoLabels['season'] = season['season'] infoLabels['season'] = season['season']
title = config.get_localized_string(60027) % season['season'] title = config.get_localized_string(60027) % season['season']
url = '' if not season['link'] else season['link'] if ':/' in season['link'] else item.path + season['link'] url = '' if not season['link'] else season['link'] if ':/' in season['link'] else item.path + season['link']
itemlist.append(Item(channel=item.channel, title=format_title(title), url=url, action='episodesxseason', itemlist.append(Item(channel=item.channel, title=format_title(title), fulltitle=item.fulltitle, show=item.show, url=url, action='episodesxseason',
contentSeasonNumber=season['season'], infoLabels=infoLabels)) contentSeason=season['season'], infoLabels=infoLabels ,contentType = 'tvshow'))
tmdb.set_infoLabels(itemlist, seekTmdb=True) logger.info('CANALE= '+ str(inspect.stack()[1][3]))
itemlist = sorted(itemlist, key=lambda i: i.title) if inspect.stack()[1][3] in ['add_tvshow', "get_seasons"]:
it = []
for item in itemlist:
logger.info(str(item))
it += episodesxseason(item)
itemlist = it
else:
tmdb.set_infoLabels(itemlist, seekTmdb=True)
itemlist = sorted(itemlist, key=lambda i: i.title)
support.videolibrary(itemlist,item)
return itemlist return itemlist
@@ -199,10 +211,10 @@ def episodesxseason(item):
infoLabels['season'] = season_number infoLabels['season'] = season_number
infoLabels['episode'] = episode_number infoLabels['episode'] = episode_number
title = config.get_localized_string(70677) + ' %s' % (episode_number) title = '%sx%s - %s' % (item.contentSeason, episode_number, episode['title'])
itemlist.append(Item(channel=item.channel, title=format_title(title), url=episode, action='findvideos', itemlist.append(Item(channel=item.channel, title=format_title(title), url=episode, action='findvideos',
contentEpisodeNumber=episode_number, infoLabels=infoLabels)) contentSeason= item.contentSeason, contentEpisode=episode_number, infoLabels=infoLabels, contentType = 'episode'))
tmdb.set_infoLabels(itemlist, seekTmdb=True) tmdb.set_infoLabels(itemlist, seekTmdb=True)
return itemlist return itemlist
+20 -7
View File
@@ -539,7 +539,10 @@ def download_from_server(item):
unsupported_servers = ["torrent"] unsupported_servers = ["torrent"]
progreso = platformtools.dialog_progress(config.get_localized_string(30101), config.get_localized_string(70178) % item.server) progreso = platformtools.dialog_progress(config.get_localized_string(30101), config.get_localized_string(70178) % item.server)
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel]) if item.contentChannel == 'community':
channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel])
else:
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel])
if hasattr(channel, "play") and not item.play_menu: if hasattr(channel, "play") and not item.play_menu:
progreso.update(50, config.get_localized_string(70178) % item.server, config.get_localized_string(60003) % item.contentChannel) progreso.update(50, config.get_localized_string(70178) % item.server, config.get_localized_string(60003) % item.contentChannel)
@@ -606,7 +609,10 @@ def download_from_best_server(item):
result = {"downloadStatus": STATUS_CODES.error} result = {"downloadStatus": STATUS_CODES.error}
progreso = platformtools.dialog_progress(config.get_localized_string(30101), config.get_localized_string(70179)) progreso = platformtools.dialog_progress(config.get_localized_string(30101), config.get_localized_string(70179))
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel]) if item.contentChannel == 'community':
channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel])
else:
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel])
progreso.update(50, config.get_localized_string(70184), config.get_localized_string(70180) % item.contentChannel) progreso.update(50, config.get_localized_string(70184), config.get_localized_string(70180) % item.contentChannel)
@@ -652,7 +658,10 @@ def select_server(item):
"contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url)) "contentAction: %s | contentChannel: %s | url: %s" % (item.contentAction, item.contentChannel, item.url))
progreso = platformtools.dialog_progress(config.get_localized_string(30101), config.get_localized_string(70179)) progreso = platformtools.dialog_progress(config.get_localized_string(30101), config.get_localized_string(70179))
channel = __import__('channels.%s' % item.contentChannel, None, None, ["channels.%s" % item.contentChannel]) if item.contentChannel == 'community':
channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel])
else:
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel])
progreso.update(50, config.get_localized_string(70184), config.get_localized_string(70180) % item.contentChannel) progreso.update(50, config.get_localized_string(70184), config.get_localized_string(70180) % item.contentChannel)
if hasattr(channel, item.contentAction): if hasattr(channel, item.contentAction):
@@ -720,9 +729,13 @@ def get_episodes(item):
# El item es uma serie o temporada # El item es uma serie o temporada
if item.contentType in ["tvshow", "season"]: if item.contentType in ["tvshow", "season"]:
# importamos el canal # importamos el canal
channel = __import__('channels.%s' % item.contentChannel, None, None, ["channels.%s" % item.contentChannel]) if item.contentChannel == 'community':
# Obtenemos el listado de episodios channel = __import__('specials.%s' % item.contentChannel, None, None, ["specials.%s" % item.contentChannel])
episodes = getattr(channel, item.contentAction)(item) episodes = getattr(channel, 'episodesxseason')(item)
else:
channel = __import__('channels.%s' % item.contentChannel, None, None, ["channels.%s" % item.contentChannel])
episodes = getattr(channel, item.contentAction)(item)
itemlist = [] itemlist = []
@@ -818,7 +831,7 @@ def save_download(item):
item.contentAction = item.from_action if item.from_action 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 and item.channel != 'community':
heading = config.get_localized_string(70594) # <- Enter the season number heading = config.get_localized_string(70594) # <- Enter the season number
item.dlseason = platformtools.dialog_numeric(0, heading, '') item.dlseason = platformtools.dialog_numeric(0, heading, '')
if item.dlseason: if item.dlseason:
+4
View File
@@ -104,6 +104,10 @@ def open_menu(item):
main.doModal() main.doModal()
del main del main
def open_shortcut_menu(item):
from platformcode import keymaptools
keymaptools.open_shortcut_menu()
class Main(xbmcgui.WindowXMLDialog): class Main(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
+49 -37
View File
@@ -42,7 +42,7 @@ def list_movies(item, silent=False):
for f in ficheros: for f in ficheros:
if f.endswith(".nfo"): if f.endswith(".nfo"):
nfo_path = filetools.join(raiz, f) nfo_path = filetools.join(raiz, f)
#Sincronizamos las películas vistas desde la videoteca de Kodi con la de Alfa #Sincronizamos las películas vistas desde la videoteca de Kodi con la de Alfa
try: try:
if config.is_xbmc(): #Si es Kodi, lo hacemos if config.is_xbmc(): #Si es Kodi, lo hacemos
@@ -50,12 +50,12 @@ def list_movies(item, silent=False):
xbmc_videolibrary.mark_content_as_watched_on_alfa(nfo_path) xbmc_videolibrary.mark_content_as_watched_on_alfa(nfo_path)
except: except:
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
head_nfo, new_item = videolibrarytools.read_nfo(nfo_path) head_nfo, new_item = videolibrarytools.read_nfo(nfo_path)
if not new_item: #Si no ha leído bien el .nfo, pasamos a la siguiente if not new_item: #Si no ha leído bien el .nfo, pasamos a la siguiente
continue continue
if len(new_item.library_urls) > 1: if len(new_item.library_urls) > 1:
multicanal = True multicanal = True
else: else:
@@ -67,7 +67,10 @@ def list_movies(item, silent=False):
for canal_org in new_item.library_urls: for canal_org in new_item.library_urls:
canal = generictools.verify_channel(canal_org) canal = generictools.verify_channel(canal_org)
try: try:
channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal]) if canal == 'community':
channel_verify = __import__('specials.%s' % canal, fromlist=["channels.%s" % canal])
else:
channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal])
logger.debug('Channel %s seems correct' % channel_verify) logger.debug('Channel %s seems correct' % channel_verify)
except: except:
dead_item = Item(multicanal=multicanal, dead_item = Item(multicanal=multicanal,
@@ -113,7 +116,7 @@ def list_movies(item, silent=False):
if not filetools.exists(filetools.join(new_item.path, filetools.basename(strm_path))): if not filetools.exists(filetools.join(new_item.path, filetools.basename(strm_path))):
# Si se ha eliminado el strm desde la bilbioteca de kodi, no mostrarlo # Si se ha eliminado el strm desde la bilbioteca de kodi, no mostrarlo
continue continue
# Menu contextual: Marcar como visto/no visto # Menu contextual: Marcar como visto/no visto
visto = new_item.library_playcounts.get(os.path.splitext(f)[0], 0) visto = new_item.library_playcounts.get(os.path.splitext(f)[0], 0)
new_item.infoLabels["playcount"] = visto new_item.infoLabels["playcount"] = visto
@@ -165,7 +168,7 @@ def list_tvshows(item):
if f == "tvshow.nfo": if f == "tvshow.nfo":
tvshow_path = filetools.join(raiz, f) tvshow_path = filetools.join(raiz, f)
# logger.debug(tvshow_path) # logger.debug(tvshow_path)
#Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa #Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa
try: try:
if config.is_xbmc(): #Si es Kodi, lo hacemos if config.is_xbmc(): #Si es Kodi, lo hacemos
@@ -173,7 +176,7 @@ def list_tvshows(item):
xbmc_videolibrary.mark_content_as_watched_on_alfa(tvshow_path) xbmc_videolibrary.mark_content_as_watched_on_alfa(tvshow_path)
except: except:
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
head_nfo, item_tvshow = videolibrarytools.read_nfo(tvshow_path) head_nfo, item_tvshow = videolibrarytools.read_nfo(tvshow_path)
if len(item_tvshow.library_urls) > 1: if len(item_tvshow.library_urls) > 1:
@@ -187,7 +190,10 @@ def list_tvshows(item):
for canal in item_tvshow.library_urls: for canal in item_tvshow.library_urls:
canal = generictools.verify_channel(canal) canal = generictools.verify_channel(canal)
try: try:
channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal]) if canal == 'community':
channel_verify = __import__('specials.%s' % canal, fromlist=["channels.%s" % canal])
else:
channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal])
logger.debug('El canal %s parece correcto' % channel_verify) logger.debug('El canal %s parece correcto' % channel_verify)
except: except:
dead_item = Item(multicanal=multicanal, dead_item = Item(multicanal=multicanal,
@@ -236,7 +242,7 @@ def list_tvshows(item):
else: else:
texto_visto = config.get_localized_string(60021) texto_visto = config.get_localized_string(60021)
contador = 1 contador = 1
except: except:
logger.error('Not find: ' + str(tvshow_path)) logger.error('Not find: ' + str(tvshow_path))
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
@@ -499,15 +505,18 @@ def findvideos(item):
for nom_canal, json_path in list_canales.items(): for nom_canal, json_path in list_canales.items():
if filtro_canal and filtro_canal != nom_canal.capitalize(): if filtro_canal and filtro_canal != nom_canal.capitalize():
continue continue
item_canal = Item() item_canal = Item()
item_canal.channel = nom_canal item_canal.channel = nom_canal
nom_canal = item_canal.channel nom_canal = item_canal.channel
# Importamos el canal de la parte seleccionada # Importamos el canal de la parte seleccionada
try: try:
channel = __import__('channels.%s' % nom_canal, fromlist=["channels.%s" % nom_canal]) if nom_canal == 'community':
channel = __import__('specials.%s' % nom_canal, fromlist=["channels.%s" % nom_canal])
else:
channel = __import__('channels.%s' % nom_canal, fromlist=["channels.%s" % nom_canal])
except ImportError: except ImportError:
exec "import channels." + nom_canal + " as channel" exec "import channels." + nom_canal + " as channel"
@@ -549,7 +558,7 @@ def findvideos(item):
server.channel = "videolibrary" server.channel = "videolibrary"
server.nfo = item.nfo server.nfo = item.nfo
server.strm_path = item.strm_path server.strm_path = item.strm_path
#### Compatibilidad con Kodi 18: evita que se quede la ruedecedita dando vueltas en enlaces Directos #### Compatibilidad con Kodi 18: evita que se quede la ruedecedita dando vueltas en enlaces Directos
if server.action == 'play': if server.action == 'play':
server.folder = False server.folder = False
@@ -576,7 +585,10 @@ def play(item):
# logger.debug("item:\n" + item.tostring('\n')) # logger.debug("item:\n" + item.tostring('\n'))
if not item.contentChannel == "local": if not item.contentChannel == "local":
channel = __import__('channels.%s' % item.contentChannel, fromlist=["channels.%s" % item.contentChannel]) if item.contentChannel == 'community':
channel = __import__('specials.%s' % item.contentChannel, fromlist=["channels.%s" % item.contentChannel])
else:
channel = __import__('channels.%s' % item.contentChannel, fromlist=["channels.%s" % item.contentChannel])
if hasattr(channel, "play"): if hasattr(channel, "play"):
itemlist = getattr(channel, "play")(item) itemlist = getattr(channel, "play")(item)
@@ -646,22 +658,22 @@ def update_tvshow(item):
def verify_playcount_series(item, path): def verify_playcount_series(item, path):
logger.info() logger.info()
""" """
Este método revisa y repara el PlayCount de una serie que se haya desincronizado de la lista real de episodios en su carpeta. Las entradas de episodios, temporadas o serie que falten, son creado con la marca de "no visto". Posteriormente se envia a verificar los contadores de Temporadas y Serie Este método revisa y repara el PlayCount de una serie que se haya desincronizado de la lista real de episodios en su carpeta. Las entradas de episodios, temporadas o serie que falten, son creado con la marca de "no visto". Posteriormente se envia a verificar los contadores de Temporadas y Serie
En el retorno envía de estado de True si se actualizado o False si no, normalmente por error. Con este estado, el caller puede actualizar el estado de la opción "verify_playcount" en "videolibrary.py". La intención de este método es la de dar una pasada que repare todos los errores y luego desactivarse. Se puede volver a activar en el menú de Videoteca de Alfa. En el retorno envía de estado de True si se actualizado o False si no, normalmente por error. Con este estado, el caller puede actualizar el estado de la opción "verify_playcount" en "videolibrary.py". La intención de este método es la de dar una pasada que repare todos los errores y luego desactivarse. Se puede volver a activar en el menú de Videoteca de Alfa.
""" """
#logger.debug("item:\n" + item.tostring('\n')) #logger.debug("item:\n" + item.tostring('\n'))
#Si no ha hecho nunca la verificación, lo forzamos #Si no ha hecho nunca la verificación, lo forzamos
estado = config.get_setting("verify_playcount", "videolibrary") estado = config.get_setting("verify_playcount", "videolibrary")
if not estado or estado == False: if not estado or estado == False:
estado = True #Si no ha hecho nunca la verificación, lo forzamos estado = True #Si no ha hecho nunca la verificación, lo forzamos
else: else:
estado = False estado = False
if item.contentType == 'movie': #Esto es solo para Series if item.contentType == 'movie': #Esto es solo para Series
return (item, False) return (item, False)
if filetools.exists(path): if filetools.exists(path):
@@ -670,7 +682,7 @@ def verify_playcount_series(item, path):
if not hasattr(it, 'library_playcounts') or not it.library_playcounts: #Si el .nfo no tiene library_playcounts se lo creamos if not hasattr(it, 'library_playcounts') or not it.library_playcounts: #Si el .nfo no tiene library_playcounts se lo creamos
logger.error('** It does not have PlayCount') logger.error('** It does not have PlayCount')
it.library_playcounts = {} it.library_playcounts = {}
# Obtenemos los archivos de los episodios # Obtenemos los archivos de los episodios
raiz, carpetas_series, ficheros = filetools.walk(path).next() raiz, carpetas_series, ficheros = filetools.walk(path).next()
# Crear un item en la lista para cada strm encontrado # Crear un item en la lista para cada strm encontrado
@@ -685,15 +697,15 @@ def verify_playcount_series(item, path):
if season_episode not in it.library_playcounts: #No está incluido el episodio if season_episode not in it.library_playcounts: #No está incluido el episodio
it.library_playcounts.update({season_episode: 0}) #actualizamos el playCount del .nfo it.library_playcounts.update({season_episode: 0}) #actualizamos el playCount del .nfo
estado_update = True #Marcamos que hemos actualizado algo estado_update = True #Marcamos que hemos actualizado algo
if 'season %s' % season not in it.library_playcounts: #No está incluida la Temporada if 'season %s' % season not in it.library_playcounts: #No está incluida la Temporada
it.library_playcounts.update({'season %s' % season: 0}) #actualizamos el playCount del .nfo it.library_playcounts.update({'season %s' % season: 0}) #actualizamos el playCount del .nfo
estado_update = True #Marcamos que hemos actualizado algo estado_update = True #Marcamos que hemos actualizado algo
if it.contentSerieName not in it.library_playcounts: #No está incluida la Serie if it.contentSerieName not in it.library_playcounts: #No está incluida la Serie
it.library_playcounts.update({item.contentSerieName: 0}) #actualizamos el playCount del .nfo it.library_playcounts.update({item.contentSerieName: 0}) #actualizamos el playCount del .nfo
estado_update = True #Marcamos que hemos actualizado algo estado_update = True #Marcamos que hemos actualizado algo
if estado_update: if estado_update:
logger.error('** Estado de actualización: ' + str(estado) + ' / PlayCount: ' + str(it.library_playcounts)) logger.error('** Estado de actualización: ' + str(estado) + ' / PlayCount: ' + str(it.library_playcounts))
estado = estado_update estado = estado_update
@@ -713,35 +725,35 @@ def mark_content_as_watched2(item):
# logger.debug("item:\n" + item.tostring('\n')) # logger.debug("item:\n" + item.tostring('\n'))
if filetools.exists(item.nfo): if filetools.exists(item.nfo):
head_nfo, it = videolibrarytools.read_nfo(item.nfo) head_nfo, it = videolibrarytools.read_nfo(item.nfo)
#logger.debug(it) #logger.debug(it)
if item.contentType == 'movie': if item.contentType == 'movie':
name_file = os.path.splitext(os.path.basename(item.nfo))[0] name_file = os.path.splitext(os.path.basename(item.nfo))[0]
if name_file != 'tvshow' : if name_file != 'tvshow' :
it.library_playcounts.update({name_file: item.playcount}) it.library_playcounts.update({name_file: item.playcount})
if item.contentType == 'episode' or item.contentType == 'tvshow' or item.contentType == 'list' or name_file == 'tvshow': if item.contentType == 'episode' or item.contentType == 'tvshow' or item.contentType == 'list' or name_file == 'tvshow':
# elif item.contentType == 'episode': # elif item.contentType == 'episode':
name_file = os.path.splitext(os.path.basename(item.strm_path))[0] name_file = os.path.splitext(os.path.basename(item.strm_path))[0]
num_season = name_file [0] num_season = name_file [0]
item.__setattr__('contentType', 'episode') item.__setattr__('contentType', 'episode')
item.__setattr__('contentSeason', num_season) item.__setattr__('contentSeason', num_season)
#logger.debug(name_file) #logger.debug(name_file)
else: else:
name_file = item.contentTitle name_file = item.contentTitle
# logger.debug(name_file) # logger.debug(name_file)
if not hasattr(it, 'library_playcounts'): if not hasattr(it, 'library_playcounts'):
it.library_playcounts = {} it.library_playcounts = {}
it.library_playcounts.update({name_file: item.playcount}) it.library_playcounts.update({name_file: item.playcount})
# se comprueba que si todos los episodios de una temporada están marcados, se marque tb la temporada # se comprueba que si todos los episodios de una temporada están marcados, se marque tb la temporada
if item.contentType != 'movie': if item.contentType != 'movie':
it = check_season_playcount(it, item.contentSeason) it = check_season_playcount(it, item.contentSeason)
#logger.debug(it) #logger.debug(it)
# Guardamos los cambios en item.nfo # Guardamos los cambios en item.nfo
if filetools.write(item.nfo, head_nfo + it.tojson()): if filetools.write(item.nfo, head_nfo + it.tojson()):
@@ -756,9 +768,9 @@ def mark_content_as_watched2(item):
if config.is_xbmc(): if config.is_xbmc():
from platformcode import xbmc_videolibrary from platformcode import xbmc_videolibrary
xbmc_videolibrary.mark_content_as_watched_on_kodi(item , item.playcount) xbmc_videolibrary.mark_content_as_watched_on_kodi(item , item.playcount)
# logger.debug(item) # logger.debug(item)
platformtools.itemlist_refresh() platformtools.itemlist_refresh()
def mark_content_as_watched(item): def mark_content_as_watched(item):
@@ -970,7 +982,7 @@ def check_tvshow_playcount(item, season):
temporadas_vistas_serie += 1 temporadas_vistas_serie += 1
#logger.debug(temporadas_serie) #logger.debug(temporadas_serie)
if temporadas_serie == temporadas_vistas_serie: if temporadas_serie == temporadas_vistas_serie:
item.library_playcounts.update({item.title: 1}) item.library_playcounts.update({item.title: 1})
else: else:
item.library_playcounts.update({item.title: 0}) item.library_playcounts.update({item.title: 0})