KoD 1.0.1

- Fix Trakt e aggiuntoi i segni di spunta (già visto) nei canali
- Fix Segna come già visto
- Aggiunta Disattivazione aggiornamento serie tramite multiselect
- Altri fix e migliorie
This commit is contained in:
marco
2020-05-22 19:27:16 +02:00
parent b73e3156fb
commit 96918d58ca
33 changed files with 585 additions and 459 deletions
+22 -24
View File
@@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
import xbmc, xbmcgui, os
from platformcode import config, platformtools, logger
import xbmc, xbmcgui
from platformcode import config, platformtools
from time import time, sleep
from core import scrapertools
from core import jsontools, filetools
from core.support import log
from core.item import Item
from platformcode.launcher import play_from_library
import sys
if sys.version_info[0] >= 3:
from concurrent import futures
@@ -24,19 +27,18 @@ def check(item):
def return_item(item):
logger.info()
log()
with futures.ThreadPoolExecutor() as executor:
future = executor.submit(next_ep, item)
item = future.result()
return item
def run(item):
logger.info()
log()
with futures.ThreadPoolExecutor() as executor:
future = executor.submit(next_ep, item)
item = future.result()
if item.next_ep:
from platformcode.launcher import play_from_library
return play_from_library(item)
@@ -47,7 +49,7 @@ def videolibrary(item):
def next_ep(item):
logger.info()
log()
condition = config.get_setting('next_ep')
item.next_ep = False
item.show_server = True
@@ -56,16 +58,14 @@ def next_ep(item):
time_over = False
time_limit = time() + 30
time_steps = [20,30,40,50,60,70,80,90,100,110,120]
time_setting = config.get_setting('next_ep_seconds')
TimeFromEnd = time_setting if time_setting > 10 else time_steps[time_setting]
TimeFromEnd = time_setting
# wait until the video plays
while not platformtools.is_playing() and time() < time_limit:
sleep(1)
while platformtools.is_playing() and time_over == False:
while platformtools.is_playing() and not time_over:
try:
Total = xbmc.Player().getTotalTime()
Actual = xbmc.Player().getTime()
@@ -78,11 +78,11 @@ def next_ep(item):
if time_over:
if condition == 1: # hide server afther x second
item.show_server = False
elif condition == 2: # play next fileif exist
elif condition == 2: # play next file if exist
# check i next file exist
current_filename = os.path.basename(item.strm_path)
base_path = os.path.basename(os.path.normpath(os.path.dirname(item.strm_path)))
# check if next file exist
current_filename = filetools.basename(item.strm_path)
base_path = filetools.basename(filetools.dirname(item.strm_path))
path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"),base_path)
fileList = []
for file in filetools.listdir(path):
@@ -96,11 +96,10 @@ def next_ep(item):
next_file = None
else:
next_file = fileList[nextIndex]
logger.info('NEXTFILE' + next_file)
log('Next File:', next_file)
# start next episode window afther x time
if next_file:
from core.item import Item
season_ep = next_file.split('.')[0]
season = season_ep.split('x')[0]
episode = season_ep.split('x')[1]
@@ -111,13 +110,13 @@ def next_ep(item):
contentEpisodeNumber= episode,
contentSeason= season,
contentTitle= next_ep,
contentType= 'tvshow',
infoLabels= {'episode': episode, 'mediatype': 'tvshow', 'season': season, 'title': next_ep},
contentType= 'episode',
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_ep},
strm_path= filetools.join(base_path, next_file))
global INFO
INFO = filetools.join(path, next_file.replace("strm", "nfo"))
logger.info('NEXTINFO' + INFO)
log('Next Info:',INFO)
nextDialog = NextDialog(ND, config.get_runtime_path())
nextDialog.show()
@@ -126,7 +125,7 @@ def next_ep(item):
pass
nextDialog.close()
logger.info('Next Episode: ' +str(nextDialog.stillwatching))
log('Next Episode:', nextDialog.stillwatching)
if nextDialog.stillwatching or nextDialog.continuewatching:
item.next_ep = True
@@ -135,7 +134,6 @@ def next_ep(item):
sleep(1)
xbmc.executebuiltin('Action(Back)')
sleep(0.5)
from platformcode.launcher import play_from_library
return play_from_library(item)
else:
item.show_server = False
@@ -155,7 +153,7 @@ class NextDialog(xbmcgui.WindowXMLDialog):
continuewatching = True
def __init__(self, *args, **kwargs):
logger.info()
log()
self.action_exitkeys_id = [xbmcgui.ACTION_STOP, xbmcgui.ACTION_BACKSPACE, xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK]
self.progress_control = None
@@ -203,7 +201,7 @@ class NextDialog(xbmcgui.WindowXMLDialog):
self.close()
def onAction(self, action):
logger.info()
log()
if action in self.action_exitkeys_id:
self.set_continue_watching(False)
self.close()
+42 -4
View File
@@ -181,6 +181,7 @@ def list_tvshows(item):
itemlist = []
dead_list = []
zombie_list = []
lista = []
# Obtenemos todos los tvshow.nfo de la videoteca de SERIES recursivamente
for raiz, subcarpetas, ficheros in filetools.walk(videolibrarytools.TVSHOWS_PATH):
for s in subcarpetas:
@@ -280,6 +281,7 @@ def list_tvshows(item):
else:
texto_update = config.get_localized_string(60023)
value = 1
item_tvshow.title += " [B]" + u"\u2022".encode('utf-8') + "[/B]"
# item_tvshow.text_color = "0xFFDF7401"
# Menu contextual: Eliminar serie/canal
@@ -323,8 +325,7 @@ def list_tvshows(item):
## verifica la existencia de los canales ##
if len(item_tvshow.library_urls) > 0:
itemlist.append(item_tvshow)
lista.append({'title':item_tvshow.contentTitle,'thumbnail':item_tvshow.thumbnail,'fanart':item_tvshow.fanart, 'active': value, 'nfo':tvshow_path})
if itemlist:
itemlist = sorted(itemlist, key=lambda it: it.title.lower())
@@ -332,8 +333,44 @@ def list_tvshows(item):
itemlist.append(Item(channel=item.channel, action="update_videolibrary", thumbnail=item.thumbnail,
title=typo(config.get_localized_string(70269), 'bold color kod'), folder=False))
itemlist.append(Item(channel=item.channel, action="configure_update_videolibrary", thumbnail=item.thumbnail,
title=typo(config.get_localized_string(60599), 'bold color kod'), lista=lista, folder=False))
return itemlist
def configure_update_videolibrary(item):
import xbmcgui
# Load list of options (active user channels that allow global search)
lista = []
ids = []
preselect = []
for i, item_tvshow in enumerate(item.lista):
it = xbmcgui.ListItem(item_tvshow["title"], '')
it.setArt({'thumb': item_tvshow["thumbnail"], 'fanart': item_tvshow["fanart"]})
lista.append(it)
ids.append(Item(nfo=item_tvshow['nfo']))
if item_tvshow['active']<=0:
preselect.append(i)
# Dialog to select
ret = xbmcgui.Dialog().multiselect(config.get_localized_string(60601), lista, preselect=preselect, useDetails=True)
if ret < 0:
return False # order cancel
seleccionados = [ids[i] for i in ret]
for tvshow in ids:
if tvshow not in seleccionados:
tvshow.active = 0
elif tvshow in seleccionados:
tvshow.active = 1
mark_tvshow_as_updatable(tvshow, silent=True)
platformtools.itemlist_refresh()
return True
def get_seasons(item):
logger.info()
@@ -1076,13 +1113,14 @@ def mark_season_as_watched(item):
platformtools.itemlist_refresh()
def mark_tvshow_as_updatable(item):
def mark_tvshow_as_updatable(item, silent=False):
logger.info()
head_nfo, it = videolibrarytools.read_nfo(item.nfo)
it.active = item.active
filetools.write(item.nfo, head_nfo + it.tojson())
platformtools.itemlist_refresh()
if not silent:
platformtools.itemlist_refresh()
def delete(item):