Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -804,7 +804,8 @@ def download(itemlist, item, typography='', function_level=1, function=''):
|
||||
url=item.url,
|
||||
action='save_download',
|
||||
from_action=from_action,
|
||||
contentTitle=contentTitle
|
||||
contentTitle=contentTitle,
|
||||
path=item.path
|
||||
))
|
||||
if from_action == 'episodios':
|
||||
itemlist.append(
|
||||
@@ -849,7 +850,8 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
contentTitle=item.contentTitle if item.contentTitle else ''
|
||||
|
||||
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:
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
@@ -861,7 +863,8 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
url=item.url,
|
||||
action=action,
|
||||
extra=extra,
|
||||
contentTitle=contentTitle
|
||||
contentTitle=contentTitle,
|
||||
path=item.path
|
||||
))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -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
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ from channelselector import get_thumb
|
||||
from core import channeltools
|
||||
from core import trakt_tools, scrapertoolsV2
|
||||
from core.item import Item
|
||||
from platformcode import logger
|
||||
from platformcode import logger, keymaptools
|
||||
from platformcode import unify
|
||||
|
||||
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)) \
|
||||
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
|
||||
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)" %
|
||||
(sys.argv[0], item.clone(action="add_serie_to_library",
|
||||
from_action=item.action).tourl())))
|
||||
@@ -608,7 +608,7 @@ def set_context_commands(item, parent_item):
|
||||
|
||||
# elif item.contentSerieName:
|
||||
# Descargar serie
|
||||
elif item.contentType == "tvshow" and item.action in ["episodios"]:
|
||||
elif item.contentType == "tvshow" and item.action in ["episodios", "episodesxseason"]:
|
||||
item.contentType == "tvshow"
|
||||
context_commands.append((config.get_localized_string(60355), "XBMC.RunPlugin(%s?%s)" %
|
||||
(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())))
|
||||
|
||||
# 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,
|
||||
# download='season').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"]:
|
||||
@@ -656,12 +656,17 @@ def set_context_commands(item, parent_item):
|
||||
context_commands = sorted(context_commands, key=lambda comand: comand[0])
|
||||
# Menu Rapido
|
||||
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',
|
||||
action="open_menu",
|
||||
parent=parent_item.tourl()).tourl(
|
||||
))))
|
||||
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",
|
||||
parent=item.tojson()).tourl())))
|
||||
return context_commands
|
||||
|
||||
@@ -5660,3 +5660,7 @@ msgstr ""
|
||||
msgctxt "#70735"
|
||||
msgid "%s Special Episode Number"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70737"
|
||||
msgid "[B]SIDE MENU[/B]"
|
||||
msgstr ""
|
||||
@@ -5664,3 +5664,7 @@ msgstr "Numero dell'Episodio Speciale %s"
|
||||
msgctxt "#70736"
|
||||
msgid "Completed Serie"
|
||||
msgstr "Serie Completa"
|
||||
|
||||
msgctxt "#70737"
|
||||
msgid "[B]SIDE MENU[/B]"
|
||||
msgstr "[B]MENU LATERALE[/B]"
|
||||
@@ -3,10 +3,10 @@
|
||||
# -*- Created for Alfa-addon -*-
|
||||
# -*- By the Alfa Develop Group -*-
|
||||
|
||||
import re, urllib, os
|
||||
import re, urllib, os, inspect
|
||||
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.support import typo
|
||||
from channelselector import get_thumb
|
||||
@@ -74,7 +74,7 @@ def show_channels(item):
|
||||
return itemlist
|
||||
|
||||
def load_json(item):
|
||||
|
||||
support.log(item)
|
||||
url= item if type(item) == str else item.url
|
||||
|
||||
if url:
|
||||
@@ -144,7 +144,7 @@ def list_all(item):
|
||||
title = media['title']
|
||||
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)
|
||||
|
||||
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.contentTitle = media['title']
|
||||
new_item.action = 'findvideos'
|
||||
if 'movies_list' in json_data: new_item.contentType = 'movie'
|
||||
else:
|
||||
new_item.url = media['seasons_list']
|
||||
new_item.contentSerieName = media['title']
|
||||
new_item.action = 'seasons'
|
||||
new_item.action = 'get_seasons'
|
||||
|
||||
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
|
||||
return itemlist
|
||||
|
||||
def seasons(item):
|
||||
logger.info()
|
||||
def get_seasons(item):
|
||||
itemlist = []
|
||||
infoLabels = item.infoLabels
|
||||
infoLabels = item.infoLabels if item.infolabels else {}
|
||||
list_seasons = item.url
|
||||
|
||||
for season in list_seasons:
|
||||
support.log()
|
||||
infoLabels['season'] = 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']
|
||||
itemlist.append(Item(channel=item.channel, title=format_title(title), url=url, action='episodesxseason',
|
||||
contentSeasonNumber=season['season'], infoLabels=infoLabels))
|
||||
itemlist.append(Item(channel=item.channel, title=format_title(title), fulltitle=item.fulltitle, show=item.show, url=url, action='episodesxseason',
|
||||
contentSeason=season['season'], infoLabels=infoLabels ,contentType = 'tvshow'))
|
||||
|
||||
tmdb.set_infoLabels(itemlist, seekTmdb=True)
|
||||
itemlist = sorted(itemlist, key=lambda i: i.title)
|
||||
logger.info('CANALE= '+ str(inspect.stack()[1][3]))
|
||||
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
|
||||
|
||||
@@ -199,10 +211,10 @@ def episodesxseason(item):
|
||||
infoLabels['season'] = season_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',
|
||||
contentEpisodeNumber=episode_number, infoLabels=infoLabels))
|
||||
contentSeason= item.contentSeason, contentEpisode=episode_number, infoLabels=infoLabels, contentType = 'episode'))
|
||||
|
||||
tmdb.set_infoLabels(itemlist, seekTmdb=True)
|
||||
return itemlist
|
||||
|
||||
@@ -539,7 +539,10 @@ def download_from_server(item):
|
||||
unsupported_servers = ["torrent"]
|
||||
|
||||
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:
|
||||
|
||||
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}
|
||||
|
||||
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)
|
||||
|
||||
@@ -652,7 +658,10 @@ def select_server(item):
|
||||
"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))
|
||||
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)
|
||||
|
||||
if hasattr(channel, item.contentAction):
|
||||
@@ -720,9 +729,13 @@ def get_episodes(item):
|
||||
# El item es uma serie o temporada
|
||||
if item.contentType in ["tvshow", "season"]:
|
||||
# importamos el canal
|
||||
channel = __import__('channels.%s' % item.contentChannel, None, None, ["channels.%s" % item.contentChannel])
|
||||
# Obtenemos el listado de episodios
|
||||
episodes = getattr(channel, item.contentAction)(item)
|
||||
if item.contentChannel == 'community':
|
||||
channel = __import__('specials.%s' % item.contentChannel, None, None, ["specials.%s" % item.contentChannel])
|
||||
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 = []
|
||||
|
||||
@@ -818,7 +831,7 @@ def save_download(item):
|
||||
item.contentAction = item.from_action if item.from_action else item.action
|
||||
|
||||
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
|
||||
item.dlseason = platformtools.dialog_numeric(0, heading, '')
|
||||
if item.dlseason:
|
||||
|
||||
@@ -104,6 +104,10 @@ def open_menu(item):
|
||||
main.doModal()
|
||||
del main
|
||||
|
||||
def open_shortcut_menu(item):
|
||||
from platformcode import keymaptools
|
||||
keymaptools.open_shortcut_menu()
|
||||
|
||||
|
||||
class Main(xbmcgui.WindowXMLDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -42,7 +42,7 @@ def list_movies(item, silent=False):
|
||||
for f in ficheros:
|
||||
if f.endswith(".nfo"):
|
||||
nfo_path = filetools.join(raiz, f)
|
||||
|
||||
|
||||
#Sincronizamos las películas vistas desde la videoteca de Kodi con la de Alfa
|
||||
try:
|
||||
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)
|
||||
except:
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
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
|
||||
continue
|
||||
|
||||
|
||||
if len(new_item.library_urls) > 1:
|
||||
multicanal = True
|
||||
else:
|
||||
@@ -67,7 +67,10 @@ def list_movies(item, silent=False):
|
||||
for canal_org in new_item.library_urls:
|
||||
canal = generictools.verify_channel(canal_org)
|
||||
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)
|
||||
except:
|
||||
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))):
|
||||
# Si se ha eliminado el strm desde la bilbioteca de kodi, no mostrarlo
|
||||
continue
|
||||
|
||||
|
||||
# Menu contextual: Marcar como visto/no visto
|
||||
visto = new_item.library_playcounts.get(os.path.splitext(f)[0], 0)
|
||||
new_item.infoLabels["playcount"] = visto
|
||||
@@ -165,7 +168,7 @@ def list_tvshows(item):
|
||||
if f == "tvshow.nfo":
|
||||
tvshow_path = filetools.join(raiz, f)
|
||||
# logger.debug(tvshow_path)
|
||||
|
||||
|
||||
#Sincronizamos los episodios vistos desde la videoteca de Kodi con la de Alfa
|
||||
try:
|
||||
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)
|
||||
except:
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
head_nfo, item_tvshow = videolibrarytools.read_nfo(tvshow_path)
|
||||
|
||||
if len(item_tvshow.library_urls) > 1:
|
||||
@@ -187,7 +190,10 @@ def list_tvshows(item):
|
||||
for canal in item_tvshow.library_urls:
|
||||
canal = generictools.verify_channel(canal)
|
||||
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)
|
||||
except:
|
||||
dead_item = Item(multicanal=multicanal,
|
||||
@@ -236,7 +242,7 @@ def list_tvshows(item):
|
||||
else:
|
||||
texto_visto = config.get_localized_string(60021)
|
||||
contador = 1
|
||||
|
||||
|
||||
except:
|
||||
logger.error('Not find: ' + str(tvshow_path))
|
||||
logger.error(traceback.format_exc())
|
||||
@@ -499,15 +505,18 @@ def findvideos(item):
|
||||
for nom_canal, json_path in list_canales.items():
|
||||
if filtro_canal and filtro_canal != nom_canal.capitalize():
|
||||
continue
|
||||
|
||||
|
||||
item_canal = Item()
|
||||
item_canal.channel = nom_canal
|
||||
|
||||
nom_canal = item_canal.channel
|
||||
|
||||
|
||||
# Importamos el canal de la parte seleccionada
|
||||
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:
|
||||
exec "import channels." + nom_canal + " as channel"
|
||||
|
||||
@@ -549,7 +558,7 @@ def findvideos(item):
|
||||
server.channel = "videolibrary"
|
||||
server.nfo = item.nfo
|
||||
server.strm_path = item.strm_path
|
||||
|
||||
|
||||
#### Compatibilidad con Kodi 18: evita que se quede la ruedecedita dando vueltas en enlaces Directos
|
||||
if server.action == 'play':
|
||||
server.folder = False
|
||||
@@ -576,7 +585,10 @@ def play(item):
|
||||
# logger.debug("item:\n" + item.tostring('\n'))
|
||||
|
||||
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"):
|
||||
itemlist = getattr(channel, "play")(item)
|
||||
|
||||
@@ -646,22 +658,22 @@ def update_tvshow(item):
|
||||
|
||||
def verify_playcount_series(item, path):
|
||||
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
|
||||
|
||||
|
||||
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'))
|
||||
|
||||
|
||||
#Si no ha hecho nunca la verificación, lo forzamos
|
||||
estado = config.get_setting("verify_playcount", "videolibrary")
|
||||
if not estado or estado == False:
|
||||
estado = True #Si no ha hecho nunca la verificación, lo forzamos
|
||||
else:
|
||||
estado = False
|
||||
|
||||
|
||||
if item.contentType == 'movie': #Esto es solo para Series
|
||||
return (item, False)
|
||||
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
|
||||
logger.error('** It does not have PlayCount')
|
||||
it.library_playcounts = {}
|
||||
|
||||
|
||||
# Obtenemos los archivos de los episodios
|
||||
raiz, carpetas_series, ficheros = filetools.walk(path).next()
|
||||
# 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
|
||||
it.library_playcounts.update({season_episode: 0}) #actualizamos el playCount del .nfo
|
||||
estado_update = True #Marcamos que hemos actualizado algo
|
||||
|
||||
|
||||
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
|
||||
estado_update = True #Marcamos que hemos actualizado algo
|
||||
|
||||
|
||||
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
|
||||
estado_update = True #Marcamos que hemos actualizado algo
|
||||
|
||||
|
||||
if estado_update:
|
||||
logger.error('** Estado de actualización: ' + str(estado) + ' / PlayCount: ' + str(it.library_playcounts))
|
||||
estado = estado_update
|
||||
@@ -713,35 +725,35 @@ def mark_content_as_watched2(item):
|
||||
# logger.debug("item:\n" + item.tostring('\n'))
|
||||
|
||||
if filetools.exists(item.nfo):
|
||||
head_nfo, it = videolibrarytools.read_nfo(item.nfo)
|
||||
#logger.debug(it)
|
||||
head_nfo, it = videolibrarytools.read_nfo(item.nfo)
|
||||
#logger.debug(it)
|
||||
|
||||
if item.contentType == 'movie':
|
||||
name_file = os.path.splitext(os.path.basename(item.nfo))[0]
|
||||
|
||||
|
||||
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':
|
||||
# elif item.contentType == 'episode':
|
||||
name_file = os.path.splitext(os.path.basename(item.strm_path))[0]
|
||||
num_season = name_file [0]
|
||||
item.__setattr__('contentType', 'episode')
|
||||
item.__setattr__('contentSeason', num_season)
|
||||
#logger.debug(name_file)
|
||||
|
||||
item.__setattr__('contentType', 'episode')
|
||||
item.__setattr__('contentSeason', num_season)
|
||||
#logger.debug(name_file)
|
||||
|
||||
else:
|
||||
name_file = item.contentTitle
|
||||
# logger.debug(name_file)
|
||||
# logger.debug(name_file)
|
||||
|
||||
if not hasattr(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
|
||||
if item.contentType != 'movie':
|
||||
it = check_season_playcount(it, item.contentSeason)
|
||||
#logger.debug(it)
|
||||
#logger.debug(it)
|
||||
|
||||
# Guardamos los cambios en item.nfo
|
||||
if filetools.write(item.nfo, head_nfo + it.tojson()):
|
||||
@@ -756,9 +768,9 @@ def mark_content_as_watched2(item):
|
||||
if config.is_xbmc():
|
||||
from platformcode import xbmc_videolibrary
|
||||
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):
|
||||
@@ -970,7 +982,7 @@ def check_tvshow_playcount(item, season):
|
||||
temporadas_vistas_serie += 1
|
||||
#logger.debug(temporadas_serie)
|
||||
|
||||
if temporadas_serie == temporadas_vistas_serie:
|
||||
if temporadas_serie == temporadas_vistas_serie:
|
||||
item.library_playcounts.update({item.title: 1})
|
||||
else:
|
||||
item.library_playcounts.update({item.title: 0})
|
||||
|
||||
Reference in New Issue
Block a user