Fix e migliorie Videoteca
This commit is contained in:
@@ -1224,6 +1224,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
videoitem.quality = quality
|
videoitem.quality = quality
|
||||||
videoitem.referer = item.referer if item.referer else item.url
|
videoitem.referer = item.referer if item.referer else item.url
|
||||||
videoitem.action = "play"
|
videoitem.action = "play"
|
||||||
|
videoitem.videolibrary_id = item.videolibrary_id
|
||||||
# videoitem.nfo = item.nfo
|
# videoitem.nfo = item.nfo
|
||||||
# videoitem.strm_path = item.strm_path
|
# videoitem.strm_path = item.strm_path
|
||||||
return videoitem
|
return videoitem
|
||||||
|
|||||||
+46
-25
@@ -193,6 +193,7 @@ def save_movie(item, silent=False):
|
|||||||
if not head_nfo:
|
if not head_nfo:
|
||||||
head_nfo = scraper.get_nfo(item)
|
head_nfo = scraper.get_nfo(item)
|
||||||
|
|
||||||
|
|
||||||
# get extra info from fanart tv
|
# get extra info from fanart tv
|
||||||
# support.dbg()
|
# support.dbg()
|
||||||
extra_info = get_fanart_tv(item)
|
extra_info = get_fanart_tv(item)
|
||||||
@@ -212,17 +213,23 @@ def save_movie(item, silent=False):
|
|||||||
item.infoLabels['discs'] += extra_info['disc']
|
item.infoLabels['discs'] += extra_info['disc']
|
||||||
|
|
||||||
if 'setid' in item.infoLabels:
|
if 'setid' in item.infoLabels:
|
||||||
|
c_playcount = 0
|
||||||
collection = videolibrarydb['collection'].get(item.infoLabels['setid'], None)
|
collection = videolibrarydb['collection'].get(item.infoLabels['setid'], None)
|
||||||
|
if item.infoLabels.get('playcount') > 0:
|
||||||
|
collections = [c for c in dict(videolibrarydb['collection']).values() if c.infoLabels.get('setid') == item.infoLabels['setid']]
|
||||||
|
viewed = [c for c in collections if c.infoLabels.get('playcount') > 0]
|
||||||
|
if len(collections) == len(viewed):
|
||||||
|
c_playcount = 1
|
||||||
if not collection:
|
if not collection:
|
||||||
collection = Item(title=item.infoLabels['set'],
|
collection = Item(title=item.infoLabels['set'],
|
||||||
plot=item.infoLabels['setoverview'],
|
plot=item.infoLabels['setoverview'],
|
||||||
infoLabels={},
|
infoLabels={'playcount':c_playcount},
|
||||||
thumbnail=item.infoLabels.get('setposters')[0] if item.infoLabels.get('setposters') else item.thumbnail,
|
thumbnail=item.infoLabels.get('setposters')[0] if item.infoLabels.get('setposters') else item.thumbnail,
|
||||||
fanart=item.infoLabels.get('setfanarts')[0] if item.infoLabels.get('setfanarts') else item.fanart,
|
fanart=item.infoLabels.get('setfanarts')[0] if item.infoLabels.get('setfanarts') else item.fanart,
|
||||||
videolibrary_id = item.infoLabels['setid'],
|
videolibrary_id = item.infoLabels['setid'],
|
||||||
set = item.infoLabels['setid'],
|
set = item.infoLabels['setid'],
|
||||||
channel = "videolibrary",
|
channel = "videolibrary",
|
||||||
action='list_movies')
|
action='list_movies')
|
||||||
|
|
||||||
if not collection.infoLabels.get('posters') and item.infoLabels.get('setposters'):
|
if not collection.infoLabels.get('posters') and item.infoLabels.get('setposters'):
|
||||||
collection.infoLabels['posters'] = item.infoLabels['setposters']
|
collection.infoLabels['posters'] = item.infoLabels['setposters']
|
||||||
@@ -245,11 +252,12 @@ def save_movie(item, silent=False):
|
|||||||
collection.infoLabels['disc'] = extra_info['setdisc'][0]
|
collection.infoLabels['disc'] = extra_info['setdisc'][0]
|
||||||
videolibrarydb['collection'][item.infoLabels['setid']] = collection
|
videolibrarydb['collection'][item.infoLabels['setid']] = collection
|
||||||
|
|
||||||
|
|
||||||
# Make or update Videolibrary Movie Item
|
# Make or update Videolibrary Movie Item
|
||||||
movie_item.channel = "videolibrary"
|
movie_item.channel = "videolibrary"
|
||||||
movie_item.action = 'findvideos'
|
movie_item.action = 'findvideos'
|
||||||
movie_item.infoLabels = item.infoLabels
|
movie_item.infoLabels = item.infoLabels
|
||||||
movie_item.infoLabels['playcount'] = 0
|
movie_item.infoLabels['playcount'] = item.infoLabels.get('playcount',0)
|
||||||
if not movie_item.head_nfo: movie_item.head_nfo = head_nfo
|
if not movie_item.head_nfo: movie_item.head_nfo = head_nfo
|
||||||
if not movie_item.title: movie_item.title = item.contentTitle
|
if not movie_item.title: movie_item.title = item.contentTitle
|
||||||
if not movie_item.videolibrary_id: movie_item.videolibrary_id = _id
|
if not movie_item.videolibrary_id: movie_item.videolibrary_id = _id
|
||||||
@@ -263,8 +271,6 @@ def save_movie(item, silent=False):
|
|||||||
if not movie_item.infoLabels['clearart'] and item.infoLabels['cleararts']: movie_item.infoLabels['clearart'] = item.infoLabels['cleararts'][0]
|
if not movie_item.infoLabels['clearart'] and item.infoLabels['cleararts']: movie_item.infoLabels['clearart'] = item.infoLabels['cleararts'][0]
|
||||||
if not movie_item.infoLabels['clearlogo'] and item.infoLabels['clearlogos']: movie_item.infoLabels['clearlogo'] = item.infoLabels['clearlogos'][0]
|
if not movie_item.infoLabels['clearlogo'] and item.infoLabels['clearlogos']: movie_item.infoLabels['clearlogo'] = item.infoLabels['clearlogos'][0]
|
||||||
if not movie_item.infoLabels['disc'] and item.infoLabels['discs']: movie_item.infoLabels['disc'] = item.infoLabels['discs'][0]
|
if not movie_item.infoLabels['disc'] and item.infoLabels['discs']: movie_item.infoLabels['disc'] = item.infoLabels['discs'][0]
|
||||||
if not movie_item.playtime: movie_item.playtime = 0,
|
|
||||||
if not movie_item.playcounts: movie_item.playcounts = 0,
|
|
||||||
if not movie_item.prefered_lang: movie_item.prefered_lang = ''
|
if not movie_item.prefered_lang: movie_item.prefered_lang = ''
|
||||||
if not movie_item.lang_list: movie_item.lang_list = []
|
if not movie_item.lang_list: movie_item.lang_list = []
|
||||||
# if not movie_item.info: movie_item.info = extra_info(_id)
|
# if not movie_item.info: movie_item.info = extra_info(_id)
|
||||||
@@ -286,7 +292,7 @@ def save_movie(item, silent=False):
|
|||||||
# create strm file if it does not exist
|
# create strm file if it does not exist
|
||||||
if not strm_exists:
|
if not strm_exists:
|
||||||
logger.debug("Creating .strm: " + strm_path)
|
logger.debug("Creating .strm: " + strm_path)
|
||||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=movie_item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibraryd_id=item.videolibrary_id)
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=movie_item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=movie_item.videolibrary_id)
|
||||||
strm_exists = filetools.write(filetools.join(MOVIES_PATH, movie_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
strm_exists = filetools.write(filetools.join(MOVIES_PATH, movie_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
|
|
||||||
# checks if the content already exists
|
# checks if the content already exists
|
||||||
@@ -617,7 +623,7 @@ def save_episodes(item, episodelist, extra_info, host, silent=False):
|
|||||||
|
|
||||||
if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
|
if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
|
||||||
logger.debug("Creating .strm: " + strm_path)
|
logger.debug("Creating .strm: " + strm_path)
|
||||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibraryd_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
|
||||||
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
# if not filetools.exists(filetools.join(TVSHOWS_PATH, nfo_path)):
|
# if not filetools.exists(filetools.join(TVSHOWS_PATH, nfo_path)):
|
||||||
# filetools.write(filetools.join(TVSHOWS_PATH, nfo_path), head_nfo)
|
# filetools.write(filetools.join(TVSHOWS_PATH, nfo_path), head_nfo)
|
||||||
@@ -626,7 +632,7 @@ def save_episodes(item, episodelist, extra_info, host, silent=False):
|
|||||||
failed += 1
|
failed += 1
|
||||||
return item, episode, season_episode, e.contentLanguage, inserted, overwritten, failed
|
return item, episode, season_episode, e.contentLanguage, inserted, overwritten, failed
|
||||||
|
|
||||||
def save_season(item, seasons, s):
|
def save_season(item, seasons, s, w):
|
||||||
tmdb_info = tmdb.Tmdb(id_Tmdb = item.infoLabels['tmdb_id'], search_type='tv')
|
tmdb_info = tmdb.Tmdb(id_Tmdb = item.infoLabels['tmdb_id'], search_type='tv')
|
||||||
seasoninfo = tmdb.get_season_dic(tmdb_info.get_season(s))
|
seasoninfo = tmdb.get_season_dic(tmdb_info.get_season(s))
|
||||||
infoLabels = {}
|
infoLabels = {}
|
||||||
@@ -638,7 +644,7 @@ def save_episodes(item, episodelist, extra_info, host, silent=False):
|
|||||||
infoLabels['banners'] = extra_info['banner'].get(str(s), [])
|
infoLabels['banners'] = extra_info['banner'].get(str(s), [])
|
||||||
infoLabels['clearlogos'] = item.infoLabels.get('clearlogos', [])
|
infoLabels['clearlogos'] = item.infoLabels.get('clearlogos', [])
|
||||||
infoLabels['cleararts'] = item.infoLabels.get('cleararts', [])
|
infoLabels['cleararts'] = item.infoLabels.get('cleararts', [])
|
||||||
if s in seasons: infoLabels['playcount'] = seasons[s].infoLabels.get('playcount', 0)
|
infoLabels['playcount'] = w
|
||||||
|
|
||||||
season_item = Item(action="get_episodes",
|
season_item = Item(action="get_episodes",
|
||||||
channel='videolibrary',
|
channel='videolibrary',
|
||||||
@@ -649,8 +655,7 @@ def save_episodes(item, episodelist, extra_info, host, silent=False):
|
|||||||
contentType = 'season',
|
contentType = 'season',
|
||||||
infoLabels = infoLabels,
|
infoLabels = infoLabels,
|
||||||
contentSeason = s,
|
contentSeason = s,
|
||||||
videolibrary_id = item.videolibrary_id,
|
videolibrary_id = item.videolibrary_id)
|
||||||
playcount=0)
|
|
||||||
|
|
||||||
if infoLabels['clearlogos']: season_item.clearlogo = infoLabels['clearlogos'][0]
|
if infoLabels['clearlogos']: season_item.clearlogo = infoLabels['clearlogos'][0]
|
||||||
if infoLabels['cleararts']: season_item.clearart = infoLabels['cleararts'][0]
|
if infoLabels['cleararts']: season_item.clearart = infoLabels['cleararts'][0]
|
||||||
@@ -717,13 +722,35 @@ def save_episodes(item, episodelist, extra_info, host, silent=False):
|
|||||||
i += 1
|
i += 1
|
||||||
p_dialog.update(int(math.ceil(i * t)), message=e.title)
|
p_dialog.update(int(math.ceil(i * t)), message=e.title)
|
||||||
|
|
||||||
|
def watched_season(s):
|
||||||
|
w = 0
|
||||||
|
s_ep = [e['item'] for e in episodes.values() if e['item'].contentSeason == s]
|
||||||
|
w_ep = [e for e in s_ep if e.infoLabels.get('playcount') > 0]
|
||||||
|
if len(s_ep) == len(w_ep): w = 1
|
||||||
|
return s, w
|
||||||
|
|
||||||
|
add_seasons = {}
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
itlist = [executor.submit(save_season, item, seasons, s) for s in current_seasons]
|
itlist = [executor.submit(watched_season, s) for s in current_seasons]
|
||||||
|
for res in futures.as_completed(itlist):
|
||||||
|
add_seasons[res.result()[0]] = res.result()[1]
|
||||||
|
|
||||||
|
for s in current_seasons:
|
||||||
|
watched = 0
|
||||||
|
s_ep = [e['item'] for e in episodes.values() if e['item'].contentSeason == s]
|
||||||
|
w_ep = [e for e in s_ep if e.infoLabels.get('playcount') > 0]
|
||||||
|
if len(s_ep) == len(w_ep): watched = 1
|
||||||
|
add_seasons[s] = watched
|
||||||
|
|
||||||
|
|
||||||
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
|
itlist = [executor.submit(save_season, item, seasons, s, w) for s, w in add_seasons.items()]
|
||||||
for res in futures.as_completed(itlist):
|
for res in futures.as_completed(itlist):
|
||||||
if res.result():
|
if res.result():
|
||||||
s, season_item = res.result()
|
s, season_item = res.result()
|
||||||
seasons[s] = season_item
|
seasons[s] = season_item
|
||||||
|
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
if len(item.lang_list) > 1:
|
if len(item.lang_list) > 1:
|
||||||
item.prefered_lang = item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), item.lang_list)]
|
item.prefered_lang = item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), item.lang_list)]
|
||||||
@@ -989,7 +1016,6 @@ def add_tvshow(item, channel=None):
|
|||||||
|
|
||||||
|
|
||||||
def remove_host(item):
|
def remove_host(item):
|
||||||
|
|
||||||
if PY3: import urllib.parse as urlparse # It is very slow in PY2. In PY3 it is native
|
if PY3: import urllib.parse as urlparse # It is very slow in PY2. In PY3 it is native
|
||||||
else: import urlparse # We use the native of PY2 which is faster
|
else: import urlparse # We use the native of PY2 which is faster
|
||||||
parsed_url = urlparse.urlparse(item.url)
|
parsed_url = urlparse.urlparse(item.url)
|
||||||
@@ -997,12 +1023,7 @@ def remove_host(item):
|
|||||||
|
|
||||||
|
|
||||||
def get_id(item):
|
def get_id(item):
|
||||||
_id = ''
|
return item.infoLabels.get('tmdb_id')
|
||||||
for i in item.infoLabels['code']:
|
|
||||||
if i or i != 'None':
|
|
||||||
_id = i
|
|
||||||
break
|
|
||||||
return _id
|
|
||||||
|
|
||||||
|
|
||||||
def get_local_files(item):
|
def get_local_files(item):
|
||||||
|
|||||||
+103
-83
@@ -3,12 +3,13 @@
|
|||||||
# XBMC Launcher (xbmc / kodi)
|
# XBMC Launcher (xbmc / kodi)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
|
from specials import videolibrary
|
||||||
import sys, os
|
import sys, os
|
||||||
PY3 = False
|
PY3 = False
|
||||||
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
||||||
|
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from core import filetools, jsontools
|
from core import filetools, jsontools, videolibrarydb
|
||||||
from platformcode import config, logger, platformtools
|
from platformcode import config, logger, platformtools
|
||||||
from platformcode.logger import WebErrorException
|
from platformcode.logger import WebErrorException
|
||||||
temp_search_file = config.get_temp_file('temp-search')
|
temp_search_file = config.get_temp_file('temp-search')
|
||||||
@@ -429,94 +430,113 @@ def play_from_library(item):
|
|||||||
@param item: item with information
|
@param item: item with information
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_played_time(item):
|
# def get_played_time(item):
|
||||||
if item.contentType == 'movie': nfo_path = item.nfo
|
# if item.contentType == 'movie': nfo_path = item.nfo
|
||||||
else: nfo_path = item.strm_path.replace('strm','nfo')
|
# else: nfo_path = item.strm_path.replace('strm','nfo')
|
||||||
if nfo_path and filetools.isfile(nfo_path):
|
# if nfo_path and filetools.isfile(nfo_path):
|
||||||
from core import videolibrarytools
|
# from core import videolibrarytools
|
||||||
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
|
# head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
|
||||||
sleep(1)
|
# sleep(1)
|
||||||
played_time = platformtools.get_played_time(item_nfo)
|
# played_time = platformtools.get_played_time(item_nfo)
|
||||||
else: played_time = 0
|
# else: played_time = 0
|
||||||
return played_time
|
# return played_time
|
||||||
|
|
||||||
import xbmcgui, xbmcplugin, xbmc
|
|
||||||
from time import sleep
|
# from time import sleep
|
||||||
|
|
||||||
# logger.debug("item: \n" + item.tostring('\n'))
|
# logger.debug("item: \n" + item.tostring('\n'))
|
||||||
platformtools.prevent_busy(item)
|
# from core.support import dbg; dbg()
|
||||||
|
import xbmc
|
||||||
itemlist=[]
|
item.window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
|
||||||
item.fromLibrary = True
|
|
||||||
item.window = True
|
|
||||||
logger.debug()
|
|
||||||
|
|
||||||
# Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
|
|
||||||
item.action = "findvideos"
|
|
||||||
|
|
||||||
window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
|
|
||||||
|
|
||||||
# and launch kodi again
|
|
||||||
if xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1:
|
|
||||||
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
|
||||||
|
|
||||||
|
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 1:
|
||||||
|
import xbmcgui, xbmcplugin
|
||||||
|
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||||
|
xbmc.Player().stop()
|
||||||
|
if item.contentType == 'episode':
|
||||||
|
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]
|
||||||
|
else:
|
||||||
|
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['item']
|
||||||
|
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + it.tourl() + ")")
|
||||||
|
videolibrarydb.videolibrarydb.close()
|
||||||
else:
|
else:
|
||||||
# Pop-up window
|
return videolibrary.findvideos(item)
|
||||||
from specials import videolibrary
|
# else:
|
||||||
from core.channeltools import get_channel_parameters
|
# xbmc.executebuiltin('ActivateWindow(10025,' + sys.argv[0] + "?" + item.tourl() + ")")
|
||||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
# itemlist = videolibrary.findvideos(it)
|
||||||
p_dialog.update(0, '')
|
# platformtools.render_items(itemlist, item)
|
||||||
item.play_from = 'window'
|
|
||||||
itemlist = videolibrary.findvideos(item)
|
|
||||||
p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
|
|
||||||
played = False
|
|
||||||
|
|
||||||
# The number of links to show is limited
|
# itemlist=[]
|
||||||
if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
|
# item.fromLibrary = True
|
||||||
# The list of links is slightly "cleaned"
|
# item.window = True
|
||||||
if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
|
# logger.debug()
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
if len(itemlist) > 0:
|
|
||||||
reopen = False
|
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
while not xbmc.Monitor().abortRequested():
|
|
||||||
played = True
|
|
||||||
# if config.get_setting('next_ep') == 3 and xbmc.Player().playnext:
|
|
||||||
# return
|
|
||||||
# The user chooses the mirror
|
|
||||||
if not platformtools.is_playing():
|
|
||||||
if config.get_setting('next_ep') == 3:
|
|
||||||
xbmc.sleep(500)
|
|
||||||
if platformtools.is_playing():
|
|
||||||
return
|
|
||||||
if config.get_setting('autoplay') or reopen:
|
|
||||||
played_time = get_played_time(item)
|
|
||||||
if not played_time and played:
|
|
||||||
return
|
|
||||||
|
|
||||||
options = []
|
# # Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
|
||||||
selection_implementation = 0
|
# item.action = "findvideos"
|
||||||
for item in itemlist:
|
|
||||||
item.thumbnail = config.get_online_server_thumb(item.server)
|
# window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
|
||||||
quality = '[B][' + item.quality + '][/B]' if item.quality else ''
|
|
||||||
if item.server:
|
# # and launch kodi again
|
||||||
path = filetools.join(config.get_runtime_path(), 'servers', item.server.lower() + '.json')
|
# if xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1:
|
||||||
name = jsontools.load(open(path, "rb").read())['name']
|
# xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
||||||
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
|
||||||
it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s [%s]' % (name, quality, item.contentTitle, get_channel_parameters(item.channel).get('title', '')))
|
# else:
|
||||||
it.setArt({'thumb':item.thumbnail})
|
# # Pop-up window
|
||||||
options.append(it)
|
# from specials import videolibrary
|
||||||
else:
|
# from core.channeltools import get_channel_parameters
|
||||||
selection_implementation += 1
|
# p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
||||||
# The selection window opens
|
# p_dialog.update(0, '')
|
||||||
if (item.contentSerieName and item.contentSeason and item.contentEpisodeNumber): head = ("%s - %sx%s | %s" % (item.contentSerieName, item.contentSeason, item.contentEpisodeNumber, config.get_localized_string(30163)))
|
# item.play_from = 'window'
|
||||||
else: head = config.get_localized_string(30163)
|
# itemlist = videolibrary.findvideos(item)
|
||||||
selection = platformtools.dialog_select(head, options, preselect= -1, useDetails=True)
|
# p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
|
||||||
if selection == -1:
|
# played = False
|
||||||
return
|
|
||||||
else:
|
# # The number of links to show is limited
|
||||||
item = videolibrary.play(itemlist[selection + selection_implementation])[0]
|
# if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
|
||||||
platformtools.play_video(item)
|
# # The list of links is slightly "cleaned"
|
||||||
reopen = True
|
# if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
|
||||||
|
# # from core.support import dbg;dbg()
|
||||||
|
# if len(itemlist) > 0:
|
||||||
|
# reopen = False
|
||||||
|
# # from core.support import dbg;dbg()
|
||||||
|
# while not xbmc.Monitor().abortRequested():
|
||||||
|
# played = True
|
||||||
|
# # if config.get_setting('next_ep') == 3 and xbmc.Player().playnext:
|
||||||
|
# # return
|
||||||
|
# # The user chooses the mirror
|
||||||
|
# if not platformtools.is_playing():
|
||||||
|
# if config.get_setting('next_ep') == 3:
|
||||||
|
# xbmc.sleep(500)
|
||||||
|
# if platformtools.is_playing():
|
||||||
|
# return
|
||||||
|
# # if config.get_setting('autoplay') or reopen:
|
||||||
|
# # played_time = get_played_time(item)
|
||||||
|
# # if not played_time and played:
|
||||||
|
# # return
|
||||||
|
|
||||||
|
# options = []
|
||||||
|
# selection_implementation = 0
|
||||||
|
# for item in itemlist:
|
||||||
|
# item.thumbnail = config.get_online_server_thumb(item.server)
|
||||||
|
# quality = '[B][' + item.quality + '][/B]' if item.quality else ''
|
||||||
|
# if item.server:
|
||||||
|
# path = filetools.join(config.get_runtime_path(), 'servers', item.server.lower() + '.json')
|
||||||
|
# name = jsontools.load(open(path, "rb").read())['name']
|
||||||
|
# if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
||||||
|
# it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s [%s]' % (name, quality, item.contentTitle, get_channel_parameters(item.channel).get('title', '')))
|
||||||
|
# it.setArt({'thumb':item.thumbnail})
|
||||||
|
# options.append(it)
|
||||||
|
# else:
|
||||||
|
# selection_implementation += 1
|
||||||
|
# # The selection window opens
|
||||||
|
# if (item.contentSerieName and item.contentSeason and item.contentEpisodeNumber): head = ("%s - %sx%s | %s" % (item.contentSerieName, item.contentSeason, item.contentEpisodeNumber, config.get_localized_string(30163)))
|
||||||
|
# else: head = config.get_localized_string(30163)
|
||||||
|
# selection = platformtools.dialog_select(head, options, preselect= -1, useDetails=True)
|
||||||
|
# if selection == -1:
|
||||||
|
# return
|
||||||
|
# else:
|
||||||
|
# item = videolibrary.play(itemlist[selection + selection_implementation])[0]
|
||||||
|
# platformtools.play_video(item)
|
||||||
|
# reopen = True
|
||||||
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break
|
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,8 @@ def itemlist_refresh(offset=0):
|
|||||||
ctl = win.getControl(cid)
|
ctl = win.getControl(cid)
|
||||||
pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + offset
|
pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + offset
|
||||||
|
|
||||||
xbmc.executebuiltin("Container.Refresh")
|
# xbmc.executebuiltin("Container.Refresh")
|
||||||
|
xbmc.executebuiltin('ReloadSkin()')
|
||||||
|
|
||||||
while xbmcgui.getCurrentWindowDialogId() != 10138:
|
while xbmcgui.getCurrentWindowDialogId() != 10138:
|
||||||
pass
|
pass
|
||||||
@@ -684,7 +685,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
|
|
||||||
def play():
|
def play():
|
||||||
if item.channel == 'downloads':
|
if item.channel == 'downloads':
|
||||||
logger.debug("Play local video: %s [%s]" % (item.title, item.url))
|
logger.debug("Play local video: %s [%s]" % (item.fulltitle, item.url))
|
||||||
xlistitem = xbmcgui.ListItem(path=item.url)
|
xlistitem = xbmcgui.ListItem(path=item.url)
|
||||||
xlistitem.setArt({"thumb": item.thumbnail})
|
xlistitem.setArt({"thumb": item.thumbnail})
|
||||||
set_infolabels(xlistitem, item, True)
|
set_infolabels(xlistitem, item, True)
|
||||||
@@ -720,7 +721,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
if not mediaurl: return
|
if not mediaurl: return
|
||||||
|
|
||||||
# video information is obtained.
|
# video information is obtained.
|
||||||
xlistitem = xbmcgui.ListItem(path=item.url)
|
xlistitem = xbmcgui.ListItem(item.title, path=item.url)
|
||||||
xlistitem.setArt({"thumb": item.contentThumbnail if item.contentThumbnail else item.thumbnail})
|
xlistitem.setArt({"thumb": item.contentThumbnail if item.contentThumbnail else item.thumbnail})
|
||||||
set_infolabels(xlistitem, item, True)
|
set_infolabels(xlistitem, item, True)
|
||||||
|
|
||||||
@@ -1084,6 +1085,7 @@ def get_video_seleccionado(item, seleccion, video_urls, autoplay=False):
|
|||||||
|
|
||||||
def set_player(item, xlistitem, mediaurl, view, strm):
|
def set_player(item, xlistitem, mediaurl, view, strm):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
# from core.support import dbg;dbg()
|
||||||
item.options = {'strm':False}
|
item.options = {'strm':False}
|
||||||
# logger.debug("item:\n" + item.tostring('\n'))
|
# logger.debug("item:\n" + item.tostring('\n'))
|
||||||
|
|
||||||
@@ -1538,11 +1540,6 @@ def set_played_time(item):
|
|||||||
def prevent_busy(item):
|
def prevent_busy(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
if not item.autoplay and not item.window:
|
if not item.autoplay and not item.window:
|
||||||
if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
||||||
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
|
||||||
xbmc.sleep(200)
|
xbmc.sleep(200)
|
||||||
xbmc.Player().stop()
|
xbmc.Player().stop()
|
||||||
# xbmc.executebuiltin('Action(Stop)')
|
|
||||||
# xbmc.sleep(500)
|
|
||||||
# xbmc.Player().stop()
|
|
||||||
# xbmc.sleep(500)
|
|
||||||
@@ -31,7 +31,6 @@ def mark_auto_as_watched(item):
|
|||||||
while not platformtools.is_playing() and time.time() < time_limit:
|
while not platformtools.is_playing() and time.time() < time_limit:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
marked = False
|
marked = False
|
||||||
sync = False
|
sync = False
|
||||||
next_episode = None
|
next_episode = None
|
||||||
@@ -100,7 +99,7 @@ def mark_auto_as_watched(item):
|
|||||||
xbmc.sleep(700)
|
xbmc.sleep(700)
|
||||||
xbmc.executebuiltin('Action(ParentDir)')
|
xbmc.executebuiltin('Action(ParentDir)')
|
||||||
# xbmc.sleep(500)
|
# xbmc.sleep(500)
|
||||||
|
|
||||||
if marked:
|
if marked:
|
||||||
from specials import videolibrary
|
from specials import videolibrary
|
||||||
videolibrary.mark_content_as_watched(item)
|
videolibrary.mark_content_as_watched(item)
|
||||||
@@ -287,7 +286,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
platformtools.itemlist_refresh()
|
# platformtools.itemlist_refresh()
|
||||||
|
|
||||||
|
|
||||||
def set_watched_on_kod(data):
|
def set_watched_on_kod(data):
|
||||||
|
|||||||
+579
-507
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user