- Fix e Migliorie Videoteca
- Server in finestra come default (per canali e videoteca)
This commit is contained in:
@@ -394,6 +394,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
if scraped['episode'] and group and not item.grouped: # some adjustment for grouping feature
|
||||
it.action = function
|
||||
|
||||
it.window = True if item.window_type == 1 or (config.get_setting("window_type") == 0) else False
|
||||
if it.window: it.folder = False
|
||||
# for lg in list(set(listGroups).difference(known_keys)):
|
||||
# it.__setattr__(lg, match[listGroups.index(lg)])
|
||||
for lg in list(set(match.keys()).difference(known_keys)):
|
||||
|
||||
@@ -1002,7 +1002,7 @@ def get_local_files(path, item):
|
||||
sql = 'SELECT c22, uniqueid_value FROM movie_view WHERE uniqueid_type != "kod"'
|
||||
n, records = execute_sql_kodi(sql)
|
||||
if records:
|
||||
local_files['db']= [r[0] for r in records if r[1] in item.infoLabels['code']]
|
||||
local_files['db']= [r[0] for r in records if r[1] in item.infoLabels['code'] and not r[0].endswith('strm')]
|
||||
|
||||
else:
|
||||
# search on path:
|
||||
|
||||
@@ -267,31 +267,77 @@ class addVideo(object):
|
||||
|
||||
def set_tvshow(self):
|
||||
posters, fanarts = get_images(self.item)
|
||||
sql = 'INSERT OR IGNORE INTO tvshow (idMovie, idFile, c00, c01, c03, c05, c06, c08, c09, c11, c12, c14, c15, c16, c18, c19, c20, c21, c22, c23, idSet, premiered)'
|
||||
sql += 'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
params = (self.VideoId, # idMovie
|
||||
self.idFile, # idFile
|
||||
sql = 'INSERT OR IGNORE INTO tvshow (idShow, c00, c01, c02, c04, c05, c06, c08, c09, c11, c12, c13, c14, c16)'
|
||||
sql += 'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
params = (self.VideoId, # idShow
|
||||
self.item.title, # c00
|
||||
self.item.plot.replace('"', "'"), # c01
|
||||
self.info.get('tagline'), # c03
|
||||
self.rating_id, # c05
|
||||
self.info.get('writer','').replace(',', ' /'), # c06
|
||||
posters, # c08
|
||||
self.uniqueID, #c09
|
||||
self.info.get('duration', 0), # c11
|
||||
self.info.get('mpaa'), # c12
|
||||
self.info.get('genre','').replace(',', ' /') if self.info.get('genre') else None, # c14
|
||||
self.info.get('director','').replace(',', ' /') if self.info.get('director') else None, # c15
|
||||
self.info.get('originaltitle'), # c16
|
||||
self.info.get('studio'), # c18
|
||||
self.info.get('trailer'), # c19
|
||||
fanarts, # c20
|
||||
self.info.get('country','').replace(',', ' /') if self.info.get('country') else None, # c21
|
||||
self.path, # c22
|
||||
self.idPath, # c23
|
||||
self.idSet, # idSet
|
||||
self.info.get('premiered')) # premiered
|
||||
nun_records, records = execute_sql_kodi(sql, params, conn)
|
||||
self.item.plot, # c01
|
||||
self.info.get('status'), # c02
|
||||
self.rating_id, # c04
|
||||
self.info.get('premiered'), # c05
|
||||
posters, # c06
|
||||
self.info.get('genre','').replace(',', ' /') if self.info.get('genre') else None, # c08
|
||||
self.info.get('originaltitle'), # c09
|
||||
fanarts, # c11
|
||||
self.uniqueID, #c12
|
||||
self.info.get('mpaa'), # c13
|
||||
self.info.get('studio'), # c14
|
||||
self.info.get('trailer'), # c16
|
||||
)
|
||||
|
||||
if self.item.thumbnail:
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'poster', 'url':self.item.thumbnail})
|
||||
if self.item.fanart:
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'fanart', 'url':self.item.fanart})
|
||||
if self.info.get('landscape'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'landscape', 'url':self.info.get('landscape')})
|
||||
if self.info.get('banner'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'banner', 'url':self.info.get('banner')})
|
||||
if self.info.get('clearlogo'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'clearlogo', 'url':self.info.get('clearlogo')})
|
||||
if self.info.get('clearart'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'clearart', 'url':self.info.get('clearart')})
|
||||
if self.info.get('disc'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'disc', 'url':self.info.get('disc')})
|
||||
|
||||
self.sql_actions.append([sql, params])
|
||||
|
||||
def set_season(self):
|
||||
posters, fanarts = get_images(self.item)
|
||||
sql = 'INSERT OR IGNORE INTO tvshow (idShow, c00, c01, c02, c04, c05, c06, c08, c09, c11, c12, c13, c14, c16)'
|
||||
sql += 'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
params = (self.VideoId, # idShow
|
||||
self.item.title, # c00
|
||||
self.item.plot, # c01
|
||||
self.info.get('status'), # c02
|
||||
self.rating_id, # c04
|
||||
self.info.get('premiered'), # c05
|
||||
posters, # c06
|
||||
self.info.get('genre','').replace(',', ' /') if self.info.get('genre') else None, # c08
|
||||
self.info.get('originaltitle'), # c09
|
||||
fanarts, # c11
|
||||
self.uniqueID, #c12
|
||||
self.info.get('mpaa'), # c13
|
||||
self.info.get('studio'), # c14
|
||||
self.info.get('trailer'), # c16
|
||||
)
|
||||
|
||||
if self.item.thumbnail:
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'poster', 'url':self.item.thumbnail})
|
||||
if self.item.fanart:
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'fanart', 'url':self.item.fanart})
|
||||
if self.info.get('landscape'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'landscape', 'url':self.info.get('landscape')})
|
||||
if self.info.get('banner'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'banner', 'url':self.info.get('banner')})
|
||||
if self.info.get('clearlogo'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'clearlogo', 'url':self.info.get('clearlogo')})
|
||||
if self.info.get('clearart'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'clearart', 'url':self.info.get('clearart')})
|
||||
if self.info.get('disc'):
|
||||
self.art.append({'media_id':self.VideoId, 'media_type': 'movie', 'type':'disc', 'url':self.info.get('disc')})
|
||||
|
||||
self.sql_actions.append([sql, params])
|
||||
|
||||
def set_art(self):
|
||||
params = []
|
||||
|
||||
@@ -226,7 +226,10 @@ def run(item=None):
|
||||
if config.get_setting("max_links", "videolibrary") != 0:
|
||||
itemlist = limit_itemlist(itemlist)
|
||||
|
||||
platformtools.render_items(itemlist, item)
|
||||
if item.window:
|
||||
platformtools.serverwindow(item, itemlist)
|
||||
else:
|
||||
platformtools.render_items(itemlist, item)
|
||||
|
||||
# Special action for adding a movie to the library
|
||||
elif item.action == "add_movie_to_library":
|
||||
@@ -447,9 +450,9 @@ def play_from_library(item):
|
||||
# logger.debug("item: \n" + item.tostring('\n'))
|
||||
# from core.support import dbg; dbg()
|
||||
import xbmc, xbmcgui, xbmcplugin
|
||||
item.window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
|
||||
xbmc.Player().stop()
|
||||
item.window_type = config.get_setting("window_type") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 0
|
||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||
xbmc.Player().stop()
|
||||
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 1:
|
||||
if item.contentType == 'episode':
|
||||
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]
|
||||
|
||||
@@ -279,20 +279,24 @@ def dialog_select_group(heading, _list, preselect=0):
|
||||
|
||||
|
||||
def itemlist_refresh(offset=0):
|
||||
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
|
||||
cid = win.getFocusId()
|
||||
ctl = win.getControl(cid)
|
||||
pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + offset
|
||||
try:
|
||||
_id = xbmcgui.getCurrentWindowId()
|
||||
win = xbmcgui.Window(_id)
|
||||
cid = win.getFocusId()
|
||||
ctl = win.getControl(cid)
|
||||
pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + offset
|
||||
logger.debug('ID:', _id, 'POSITION:', pos)
|
||||
# xbmc.executebuiltin("Container.Refresh")
|
||||
xbmc.executebuiltin('ReloadSkin()')
|
||||
|
||||
# xbmc.executebuiltin("Container.Refresh")
|
||||
xbmc.executebuiltin('ReloadSkin()')
|
||||
while xbmcgui.getCurrentWindowDialogId() != 10138:
|
||||
pass
|
||||
while xbmcgui.getCurrentWindowDialogId() == 10138:
|
||||
pass
|
||||
|
||||
while xbmcgui.getCurrentWindowDialogId() != 10138:
|
||||
pass
|
||||
while xbmcgui.getCurrentWindowDialogId() == 10138:
|
||||
pass
|
||||
|
||||
ctl.selectItem(pos)
|
||||
ctl.selectItem(pos)
|
||||
except:
|
||||
xbmc.executebuiltin('ReloadSkin()')
|
||||
|
||||
|
||||
def itemlist_update(item, replace=False):
|
||||
@@ -382,17 +386,22 @@ def render_items(itemlist, parent_item):
|
||||
listitem.addContextMenuItems(context_commands)
|
||||
return item, item_url, listitem
|
||||
|
||||
# dirItems.append(('%s?%s' % (sys.argv[0], item_url), listitem, item.folder))
|
||||
|
||||
r_list = []
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
searchList = [executor.submit(set_item, i, item) for i, item in enumerate(itemlist)]
|
||||
for res in futures.as_completed(searchList):
|
||||
r_list.append(res.result())
|
||||
r_list.sort(key=lambda it: it[0].itemlistPosition)
|
||||
|
||||
for item, item_url, listitem in r_list:
|
||||
dirItems.append(('%s?%s' % (sys.argv[0], item_url), listitem, item.folder))
|
||||
dirItems.append(('%s?%s' % (sys.argv[0], item_url), listitem, item.folder, len(r_list)))
|
||||
xbmcplugin.addDirectoryItems(_handle, dirItems)
|
||||
|
||||
if parent_item.sorted:
|
||||
if parent_item.sorted == 'year': xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
|
||||
elif parent_item.sorted == 'name': xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE)
|
||||
|
||||
if parent_item.list_type == '':
|
||||
breadcrumb = parent_item.category.capitalize()
|
||||
else:
|
||||
@@ -409,6 +418,7 @@ def render_items(itemlist, parent_item):
|
||||
set_view_mode(itemlist[0], parent_item)
|
||||
|
||||
xbmcplugin.endOfDirectory(_handle)
|
||||
|
||||
logger.debug('END render_items')
|
||||
|
||||
|
||||
@@ -1149,11 +1159,11 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
||||
xbmc_videolibrary.mark_auto_as_watched(item)
|
||||
|
||||
# for cases where the audio playback window appears in place of the video one
|
||||
if item.focusOnVideoPlayer:
|
||||
while is_playing() and xbmcgui.getCurrentWindowId() != 12006:
|
||||
continue
|
||||
xbmc.sleep(500)
|
||||
xbmcgui.Window(12005).show()
|
||||
# if item.focusOnVideoPlayer:
|
||||
# while is_playing() and xbmcgui.getCurrentWindowId() != 12006:
|
||||
# continue
|
||||
# xbmc.sleep(500)
|
||||
# xbmcgui.Window(12005).show()
|
||||
|
||||
|
||||
def add_next_to_playlist(item):
|
||||
@@ -1541,4 +1551,63 @@ def prevent_busy(item):
|
||||
if not item.autoplay and not item.window:
|
||||
xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
||||
xbmc.sleep(200)
|
||||
xbmc.Player().stop()
|
||||
xbmc.Player().stop()
|
||||
|
||||
|
||||
def serverwindow(item, itemlist):
|
||||
from core import filetools, jsontools
|
||||
class ServerWindow(xbmcgui.WindowXMLDialog):
|
||||
def start(self, item, itemlist):
|
||||
self.itemlist = itemlist
|
||||
self.item = item
|
||||
self.servers = []
|
||||
self.selection = -1
|
||||
|
||||
for videoitem in self.itemlist:
|
||||
videoitem.thumbnail = config.get_online_server_thumb(videoitem.server)
|
||||
quality = ' [' + videoitem.quality + ']' if videoitem.quality else ''
|
||||
if videoitem.server:
|
||||
color = scrapertools.find_single_match(videoitem.alive, r'(FF[^\]]+)')
|
||||
path = filetools.join(config.get_runtime_path(), 'servers', videoitem.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('{}{}'.format(name, quality))
|
||||
it.setProperties({'name': self.item.title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
||||
it.setArt({'poster':self.item.contentThumbnail, 'thumb':videoitem.thumbnail, 'fanart':item.fanart})
|
||||
self.servers.append(it)
|
||||
self.doModal()
|
||||
return self.selection
|
||||
|
||||
def onInit(self):
|
||||
self.SERVERS = self.getControl(100)
|
||||
self.SERVERS.reset()
|
||||
self.SERVERS.addItems(self.servers)
|
||||
self.setFocusId(100)
|
||||
|
||||
def onClick(self, control_id):
|
||||
if control_id == 100:
|
||||
self.selection = self.itemlist[self.SERVERS.getSelectedPosition()].clone(window=True)
|
||||
self.close()
|
||||
|
||||
reopen = False
|
||||
if len(itemlist) > 0:
|
||||
reopen = False
|
||||
while not xbmc.Monitor().abortRequested():
|
||||
played = True
|
||||
if not is_playing():
|
||||
if config.get_setting('next_ep') == 3:
|
||||
xbmc.sleep(500)
|
||||
if is_playing():
|
||||
return
|
||||
if config.get_setting('autoplay') or reopen:
|
||||
played_time = get_played_time(item)
|
||||
if not played_time and played:
|
||||
return
|
||||
|
||||
selection = ServerWindow('Servers.xml', config.get_runtime_path()).start(item, itemlist)
|
||||
if selection == -1:
|
||||
return
|
||||
else:
|
||||
from platformcode.launcher import run
|
||||
run(selection)
|
||||
reopen = True
|
||||
@@ -27,7 +27,7 @@ def mark_auto_as_watched(item):
|
||||
actual_time = 0
|
||||
total_time = 0
|
||||
|
||||
time_limit = time.time() + 30
|
||||
time_limit = time.time() + 10
|
||||
while not platformtools.is_playing() and time.time() < time_limit:
|
||||
time.sleep(1)
|
||||
|
||||
@@ -38,6 +38,7 @@ def mark_auto_as_watched(item):
|
||||
|
||||
percentage = float(config.get_setting("watched_setting")) / 100
|
||||
time_from_end = config.get_setting('next_ep_seconds')
|
||||
|
||||
if item.contentType != 'movie' and 0 < config.get_setting('next_ep') < 3:
|
||||
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
|
||||
next_ep_type = config.get_setting('next_ep_type')
|
||||
@@ -46,7 +47,8 @@ def mark_auto_as_watched(item):
|
||||
except: next_episode = False
|
||||
logger.debug(next_episode)
|
||||
|
||||
while platformtools.is_playing():
|
||||
while not xbmc.Monitor().abortRequested():
|
||||
if not platformtools.is_playing(): break
|
||||
try: actual_time = xbmc.Player().getTime()
|
||||
except: pass
|
||||
try: total_time = xbmc.Player().getTotalTime()
|
||||
@@ -95,12 +97,9 @@ def mark_auto_as_watched(item):
|
||||
while platformtools.is_playing():
|
||||
xbmc.sleep(100)
|
||||
|
||||
if not show_server and not item.window and not item.no_return:
|
||||
if not show_server and not item.no_return and not item.window:
|
||||
xbmc.sleep(700)
|
||||
xbmc.executebuiltin('Action(ParentDir)')
|
||||
else:
|
||||
videolibrary.serverwindow.close()
|
||||
|
||||
|
||||
if marked:
|
||||
from specials import videolibrary
|
||||
@@ -264,14 +263,16 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
||||
@param value: > 0 for seen, 0 for not seen
|
||||
"""
|
||||
logger.debug()
|
||||
# from core.support import dbg;dbg()
|
||||
|
||||
conn = sqlite3.connect(get_file_db())
|
||||
view = 'episode' if item.contentType != 'movie' else 'movie'
|
||||
path = '%{}%'.format(item.strm_path.split('\\')[0].split('/')[0] if item.strm_path else item.base_name)
|
||||
|
||||
request_season = ''
|
||||
request_episode = ''
|
||||
if item.contentSeason: request_season = ' and c12= {}'.format(item.contentSeason)
|
||||
if item.contentEpisodeNumber: request_episode = ' and strFileName= "{}"'.format(item.strm_path.split('\\')[-1].split('/')[-1])
|
||||
if item.contentType in ['season', 'episode'] and item.contentSeason: request_season = ' and c12= {}'.format(item.contentSeason)
|
||||
if item.contentType in ['episode'] and item.contentEpisodeNumber: request_episode = ' and strFileName= "{}"'.format(item.strm_path.split('\\')[-1].split('/')[-1])
|
||||
sql = 'select idFile from {}_view where strPath like "{}"{}{}'.format(view, path, request_episode, request_season)
|
||||
|
||||
n, r = execute_sql_kodi(sql, conn=conn)
|
||||
@@ -294,7 +295,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
||||
def set_watched_on_kod(data):
|
||||
from specials import videolibrary
|
||||
from core.videolibrarytools import videolibrarydb
|
||||
# support.dbg()
|
||||
# from core.support import dbg;dbg()
|
||||
|
||||
data = jsontools.load(data)
|
||||
Type = data.get('item', {}).get('type','')
|
||||
@@ -332,6 +333,7 @@ def set_watched_on_kod(data):
|
||||
_id = scrapertools.find_single_match(records[0][0], r'\[([^\]]+)')
|
||||
contents = videolibrarydb[Type].get(_id, {})
|
||||
item = contents.get('item', None)
|
||||
|
||||
if item:
|
||||
item.playcount = playcount
|
||||
item.not_update = True
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<setting id="servers_favorites" visible="eq(-1,true)" subsetting="true" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||
<setting id="servers_blacklist" visible="eq(-2,true)" subsetting="true" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||
|
||||
<setting id="window_type" type="select" label="60621" lvalues="60623|60622" default="0"/>
|
||||
<!-- <setting id="hide_servers" type="bool" label="70747" default="false" visible="eq(-1,true)" subsetting="true"/> -->
|
||||
<setting id="checklinks" type="bool" label="30020" default="false"/>
|
||||
<setting id="checklinks_number" type="slider" option="int" range="5,5,20" label="30021" default="5" visible="eq(-1,true)" subsetting="true"/>
|
||||
|
||||
@@ -139,6 +139,7 @@ class AddonMonitor(xbmc.Monitor):
|
||||
self.settings_pre = config.get_all_settings_addon()
|
||||
|
||||
def onNotification(self, sender, method, data):
|
||||
logger.debug('METODO', method)
|
||||
if method == 'VideoLibrary.OnUpdate':
|
||||
xbmc_videolibrary.set_watched_on_kod(data)
|
||||
logger.debug('AGGIORNO')
|
||||
|
||||
@@ -127,18 +127,6 @@
|
||||
"pt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "window_type",
|
||||
"type": "list",
|
||||
"label": "@60621",
|
||||
"default": 0,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
"@60622",
|
||||
"@60623"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "max_links",
|
||||
"type": "list",
|
||||
|
||||
@@ -172,14 +172,16 @@ def list_movies(item, silent=False):
|
||||
videolibrarydb.close()
|
||||
add_context(itemlist)
|
||||
if silent == False:
|
||||
if item.set: itemlist.sort(key=lambda it: it.infoLabels['year'])
|
||||
else: itemlist.sort(key=lambda it: it.title.lower())
|
||||
if item.set: item.sorted = 'year'
|
||||
else: item.sorted = 'name'
|
||||
return itemlist
|
||||
|
||||
|
||||
def list_tvshows(item):
|
||||
logger.debug()
|
||||
|
||||
item.sorted = 'name'
|
||||
|
||||
itemlist = []
|
||||
|
||||
videos = dict(videolibrarydb['tvshow']).values()
|
||||
@@ -252,6 +254,7 @@ def configure_update_videolibrary(item):
|
||||
|
||||
def get_seasons(item):
|
||||
logger.debug()
|
||||
item.sorted = None
|
||||
|
||||
seasons = videolibrarydb['season'][item.videolibrary_id]
|
||||
videolibrarydb.close()
|
||||
@@ -266,6 +269,7 @@ def get_seasons(item):
|
||||
def get_episodes(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
item.sorted = None
|
||||
|
||||
episodes = videolibrarydb['episode'][item.videolibrary_id]
|
||||
videolibrarydb.close()
|
||||
@@ -277,7 +281,8 @@ def get_episodes(item):
|
||||
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2 or item.all:
|
||||
it.title = '{}x{}'.format(it.contentSeason, it.title)
|
||||
it = get_host(it)
|
||||
if item.window_type == 1 or (config.get_setting("window_type", "videolibrary") == 1):
|
||||
it.window = True if item.window_type == 1 or (config.get_setting("window_type") == 0) else False
|
||||
if it.window:
|
||||
it.folder = False
|
||||
it.from_library = item.from_library
|
||||
return it
|
||||
@@ -299,12 +304,8 @@ def findvideos(item):
|
||||
from core import autoplay
|
||||
from platformcode import platformtools
|
||||
logger.debug()
|
||||
# support.dbg()
|
||||
|
||||
popup = True if item.window_type == 1 or (config.get_setting("window_type", "videolibrary") == 1) else False
|
||||
|
||||
if popup:
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
||||
p_dialog.update(0, '')
|
||||
videolibrarytools.check_renumber_options(item)
|
||||
itemlist = []
|
||||
|
||||
@@ -331,7 +332,7 @@ def findvideos(item):
|
||||
|
||||
videolibrarydb.close()
|
||||
|
||||
if 'local' in videolibrary_items:
|
||||
if videolibrary_items.get('local'):
|
||||
try:
|
||||
item.url = videolibrary_items['local']
|
||||
if not '/' in item.url and not '\\' in item.url:
|
||||
@@ -372,8 +373,6 @@ def findvideos(item):
|
||||
it.title = '[{}] {}'.format(it.ch_name, it.title)
|
||||
|
||||
if config.get_setting('autoplay'):
|
||||
if popup:
|
||||
item.window = True
|
||||
itemlist = autoplay.start(itemlist, item)
|
||||
else:
|
||||
itemlist.sort(key=lambda it: (videolibrarytools.quality_order.index(it.quality.lower()) if it.quality and it.quality.lower() in videolibrarytools.quality_order else 999, it.server))
|
||||
@@ -382,12 +381,8 @@ def findvideos(item):
|
||||
from core import servertools
|
||||
itemlist = servertools.check_list_links(itemlist, config.get_setting('checklinks_number'))
|
||||
|
||||
if popup:
|
||||
item.folder=False
|
||||
item.window = True
|
||||
p_dialog.update(100, ''); xbmc.sleep(500); p_dialog.close()
|
||||
xbmc.executebuiltin('Dialog.Close(all)')
|
||||
serverwindow.start(item, itemlist)
|
||||
if item.window:
|
||||
platformtools.serverwindow(item, itemlist)
|
||||
|
||||
else:
|
||||
add_download_items(item, itemlist)
|
||||
@@ -607,19 +602,23 @@ def mark_content_as_watched(item):
|
||||
self.episodes = videolibrarydb['episode'][self.item.videolibrary_id]
|
||||
|
||||
getattr(self, 'mark_' + self.item.contentType)()
|
||||
|
||||
videolibrarydb.close()
|
||||
# support.dbg()
|
||||
|
||||
if config.is_xbmc() and not self.item.not_update:
|
||||
# support.dbg()
|
||||
from platformcode import xbmc_videolibrary
|
||||
if self.movies:
|
||||
for movie in self.movies:
|
||||
xbmc_videolibrary.mark_content_as_watched_on_kodi(movie, self.playcount)
|
||||
else:
|
||||
xbmc_videolibrary.mark_content_as_watched_on_kodi(self.item, self.playcount)
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
it = None
|
||||
if item.contentType == 'movie': it = self.movie
|
||||
elif item.contentType == 'episode': it = self.episodes['{:d}x{:02d}'.format(self.s, self.e)]['item']
|
||||
elif item.contentType == 'tvshow': it = self.tvshow['item']
|
||||
elif item.contentType == 'season': it = self.seasons[self.s]
|
||||
if it: xbmc_videolibrary.mark_content_as_watched_on_kodi(it, self.playcount)
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
|
||||
def mark_episode(self):
|
||||
current_playcount = self.episodes['{:d}x{:02d}'.format(self.s, self.e)]['item'].infoLabels['playcount']
|
||||
@@ -873,7 +872,6 @@ class set_images(object):
|
||||
if selection >= 0:
|
||||
self.set_art(self.types[selection])
|
||||
|
||||
|
||||
def set_art(self, n):
|
||||
images = []
|
||||
items = []
|
||||
@@ -1309,35 +1307,6 @@ def get_results(nfo_path, root, Type, local=False):
|
||||
# platformtools.itemlist_refresh()
|
||||
|
||||
|
||||
class ServerWindow(xbmcgui.WindowXML):
|
||||
def start(self, item, itemlist):
|
||||
self.itemlist = itemlist
|
||||
self.item = item
|
||||
self.servers = []
|
||||
|
||||
for videoitem in self.itemlist:
|
||||
videoitem.thumbnail = config.get_online_server_thumb(videoitem.server)
|
||||
quality = ' [' + videoitem.quality + ']' if videoitem.quality else ''
|
||||
if videoitem.server:
|
||||
color = scrapertools.find_single_match(videoitem.alive, r'(FF[^\]]+)')
|
||||
path = filetools.join(config.get_runtime_path(), 'servers', videoitem.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('{}{}'.format(name, quality))
|
||||
it.setProperties({'name': self.item.title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
||||
it.setArt({'poster':self.item.contentThumbnail, 'thumb':videoitem.thumbnail, 'fanart':self.item.infoLabels.get('fanart','')})
|
||||
self.servers.append(it)
|
||||
self.doModal()
|
||||
|
||||
def onInit(self):
|
||||
self.SERVERS = self.getControl(100)
|
||||
self.SERVERS.reset()
|
||||
self.SERVERS.addItems(self.servers)
|
||||
self.setFocusId(100)
|
||||
|
||||
def onClick(self, control_id):
|
||||
if control_id == 100:
|
||||
from platformcode.launcher import run
|
||||
run(self.itemlist[self.SERVERS.getSelectedPosition()])
|
||||
|
||||
serverwindow = ServerWindow('Servers.xml', config.get_runtime_path())
|
||||
|
||||
Reference in New Issue
Block a user