Migliorie e correzioni alla videoteca

This commit is contained in:
Alhaziel01
2021-05-25 20:00:11 +02:00
parent 228c7bbd79
commit 753f915e5a
7 changed files with 496 additions and 293 deletions

View File

@@ -181,114 +181,152 @@ def save_movie(item, silent=False):
logger.debug("Could not create directory")
videolibrarydb.close()
return 0, 0, -1, path
try:
# set nfo and strm paths
nfo_path = filetools.join(base_name, "{}.nfo".format(base_name))
strm_path = filetools.join(base_name, "{}.strm".format(base_name))
# try:
# set nfo and strm paths
nfo_path = filetools.join(base_name, "{}.nfo".format(base_name))
strm_path = filetools.join(base_name, "{}.strm".format(base_name))
# check if nfo and strm file exist
nfo_exists = filetools.exists(filetools.join(MOVIES_PATH, nfo_path))
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
# check if nfo and strm file exist
nfo_exists = filetools.exists(filetools.join(MOVIES_PATH, nfo_path))
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
if not head_nfo:
head_nfo = scraper.get_nfo(item)
if not head_nfo:
head_nfo = scraper.get_nfo(item)
# get extra info from fanart tv
# support.dbg()
extra_info = get_fanart_tv(item)
if not item.infoLabels.get('posters'): item.infoLabels['posters'] = []
item.infoLabels['posters'] += extra_info['poster']
if not item.infoLabels.get('fanarts'): item.infoLabels['fanarts'] = []
item.infoLabels['fanarts'] += extra_info['fanart']
if not item.infoLabels.get('clearlogos'): item.infoLabels['clearlogos'] = []
item.infoLabels['clearlogos'] += extra_info['clearlogo']
if not item.infoLabels.get('cleararts'): item.infoLabels['cleararts'] = []
item.infoLabels['cleararts'] += extra_info['clearart']
if not item.infoLabels.get('landscapes'): item.infoLabels['landscapes'] = []
item.infoLabels['landscapes'] += extra_info['landscape']
if not item.infoLabels.get('banners'): item.infoLabels['banners'] = []
item.infoLabels['banners'] += extra_info['banner']
# get extra info from fanart tv
# support.dbg()
extra_info = get_fanart_tv(item)
if not item.infoLabels.get('posters', []): item.infoLabels['posters'] = []
item.infoLabels['posters'] += extra_info['poster']
if not item.infoLabels.get('fanarts', []): item.infoLabels['fanarts'] = []
item.infoLabels['fanarts'] += extra_info['fanart']
if not item.infoLabels.get('clearlogos', []): item.infoLabels['clearlogos'] = []
item.infoLabels['clearlogos'] += extra_info['clearlogo']
if not item.infoLabels.get('cleararts', []): item.infoLabels['cleararts'] = []
item.infoLabels['cleararts'] += extra_info['clearart']
if not item.infoLabels.get('landscapes', []): item.infoLabels['landscapes'] = []
item.infoLabels['landscapes'] += extra_info['landscape']
if not item.infoLabels.get('banners', []): item.infoLabels['banners'] = []
item.infoLabels['banners'] += extra_info['banner']
if not item.infoLabels.get('discs', []): item.infoLabels['discs'] = []
item.infoLabels['discs'] += extra_info['disc']
# Make or update Videolibrary Movie Item
movie_item.channel = "videolibrary"
movie_item.action = 'findvideos'
movie_item.infoLabels = item.infoLabels
movie_item.infoLabels['playcount'] = 0
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.videolibrary_id: movie_item.videolibrary_id = _id
if not movie_item.strm_path: movie_item.strm_path = strm_path
if not movie_item.nfo_path: movie_item.nfo_path = nfo_path
if not movie_item.base_name: movie_item.base_name = base_name
if not movie_item.thumbnail: movie_item.thumbnail = item.infoLabels['thumbnail']
if not movie_item.fanart: movie_item.fanart = item.infoLabels['fanart']
if not movie_item.landscape: movie_item.landscape = item.infoLabels['landscapes'][0] if item.infoLabels['landscapes'] else item.infoLabels['fanart']
if not movie_item.banner and item.infoLabels['banners']: movie_item.clearart = item.infoLabels['banners'][0]
if not movie_item.clearart and item.infoLabels['cleararts']: movie_item.clearart = item.infoLabels['cleararts'][0]
if not movie_item.clearlogo and item.infoLabels['clearlogos']: movie_item.clearlogo = item.infoLabels['clearlogos'][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.lang_list: movie_item.lang_list = []
# if not movie_item.info: movie_item.info = extra_info(_id)
if 'setid' in item.infoLabels:
collection = videolibrarydb['collection'].get(item.infoLabels['setid'], None)
if not collection:
collection = Item(title=item.infoLabels['set'],
plot=item.infoLabels['setoverview'],
infoLabels={},
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,
videolibrary_id = item.infoLabels['setid'],
set = item.infoLabels['setid'],
channel = "videolibrary",
action='list_movies')
if not item.contentLanguage: item.contentLanguage = 'ITA'
if not item.contentLanguage in movie_item.lang_list: movie_item.lang_list.append(item.contentLanguage)
if not collection.infoLabels.get('posters') and item.infoLabels.get('setposters'):
collection.infoLabels['posters'] = item.infoLabels['setposters']
if not collection.infoLabels.get('fanarts') and item.infoLabels.get('fanarts'):
collection.infoLabels['fanarts'] = item.infoLabels['setfanarts']
if not collection.infoLabels.get('clearlogos') and extra_info.get('setclearlogo'):
collection.infoLabels['clearlogos'] = extra_info['setclearlogo']
collection.infoLabels['clearlogo'] = extra_info['setclearlogo'][0]
if not collection.infoLabels.get('cleararts') and extra_info.get('setclearart'):
collection.infoLabels['cleararts'] = extra_info['setclearart']
collection.infoLabels['clearart'] = extra_info['setclearart'][0]
if not collection.infoLabels.get('landscapes') and extra_info.get('setlandscape'):
collection.infoLabels['landscapes'] = extra_info['setlandscape']
collection.infoLabels['landscape'] = extra_info['setlandscape'][0]
if not collection.infoLabels.get('banners') and extra_info.get('setbanner'):
collection.infoLabels['banners'] = extra_info['setbanner']
collection.infoLabels['banner'] = extra_info['setbanner'][0]
if not collection.infoLabels.get('discs') and extra_info.get('setdisc'):
collection.infoLabels['discs'] = extra_info['setdisc']
collection.infoLabels['disc'] = extra_info['setdisc'][0]
videolibrarydb['collection'][item.infoLabels['setid']] = collection
if len(movie_item.lang_list) > 1:
movie_item.prefered_lang = movie_item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), movie_item.lang_list)]
# Make or update Videolibrary Movie Item
movie_item.channel = "videolibrary"
movie_item.action = 'findvideos'
movie_item.infoLabels = item.infoLabels
movie_item.infoLabels['playcount'] = 0
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.videolibrary_id: movie_item.videolibrary_id = _id
if not movie_item.strm_path: movie_item.strm_path = strm_path
if not movie_item.nfo_path: movie_item.nfo_path = nfo_path
if not movie_item.base_name: movie_item.base_name = base_name
if not movie_item.thumbnail: movie_item.thumbnail = item.infoLabels['thumbnail']
if not movie_item.fanart: movie_item.fanart = item.infoLabels['fanart']
if not movie_item.infoLabels['landscape'] and item.infoLabels['landscapes']: movie_item.infoLabels['landscape'] = item.infoLabels['landscapes'][0]
if not movie_item.infoLabels['banner'] and item.infoLabels['banners']: movie_item.infoLabels['banner']= item.infoLabels['banners'][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['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.lang_list: movie_item.lang_list = []
# if not movie_item.info: movie_item.info = extra_info(_id)
if not item.contentLanguage: item.contentLanguage = 'ITA'
if not item.contentLanguage in movie_item.lang_list: movie_item.lang_list.append(item.contentLanguage)
if len(movie_item.lang_list) > 1:
movie_item.prefered_lang = movie_item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), movie_item.lang_list)]
else:
movie_item.prefered_lang = movie_item.lang_list[0]
# create nfo file if it does not exist
# support.dbg()
if not nfo_exists:
# data = dicttoxml(movie_item)
filetools.write(filetools.join(MOVIES_PATH, movie_item.nfo_path), head_nfo)
# create strm file if it does not exist
if not strm_exists:
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)
strm_exists = filetools.write(filetools.join(MOVIES_PATH, movie_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
# checks if the content already exists
if videolibrarydb['movie'].get(_id, {}):
logger.debug("The file exists. Is overwritten")
overwritten += 1
else:
logger.debug("Creating .nfo: " + nfo_path)
inserted += 1
remove_host(item)
# write on db
if item.channel in channels and item.channel != 'download':
channels_url = [u.url for u in channels[item.channel]]
if item.url not in channels_url:
channels[item.channel].append(item)
else:
movie_item.prefered_lang = movie_item.lang_list[0]
del channels[item.channel][channels_url.index(item.url)]
channels[item.channel].append(item)
else:
channels[item.channel] = [item]
# create nfo file if it does not exist
# support.dbg()
if not nfo_exists:
# data = dicttoxml(movie_item)
filetools.write(filetools.join(MOVIES_PATH, movie_item.nfo_path), head_nfo)
moviedb['item'] = movie_item
moviedb['channels'] = channels
# create strm file if it does not exist
if not strm_exists:
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)
strm_exists = filetools.write(filetools.join(MOVIES_PATH, movie_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
# checks if the content already exists
if videolibrarydb['movie'].get(_id, {}):
logger.debug("The file exists. Is overwritten")
overwritten += 1
else:
logger.debug("Creating .nfo: " + nfo_path)
inserted += 1
remove_host(item)
# write on db
if item.channel in channels and item.channel != 'download':
channels_url = [u.url for u in channels[item.channel]]
if item.url not in channels_url:
channels[item.channel].append(item)
else:
del channels[item.channel][channels_url.index(item.url)]
channels[item.channel].append(item)
else:
channels[item.channel] = [item]
moviedb['item'] = movie_item
moviedb['channels'] = channels
videolibrarydb['movie'][_id] = moviedb
except:
failed += 1
videolibrarydb['movie'][_id] = moviedb
# except:
# failed += 1
videolibrarydb.close()
# Only if movie_item and .strm exist we continue
if movie_item and strm_exists:
if not silent:
p_dialog.update(100, item.contentTitle)
p_dialog.close()
# Update Kodi Library
# from platformcode.dbconverter import add_video
# add_video(movie_item)
from platformcode.dbconverter import add_video
add_video(movie_item)
# if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent and inserted:
# from platformcode.xbmc_videolibrary import update
# update(MOVIES_PATH)
@@ -979,7 +1017,7 @@ def get_local_files(item):
if included_files:
return included_files, 1
def get_fanart_tv(item):
def get_fanart_tv(item, set='', ret={}):
def set_dict(l):
d = {}
for k in l:
@@ -987,8 +1025,7 @@ def get_fanart_tv(item):
o.append(k['url'])
d[k['season']] = o
return d
# support.dbg()
ret = {}
_id = item.infoLabels.get('tvdb_id', item.infoLabels.get('tmdb_id'))
if _id:
@@ -997,8 +1034,8 @@ def get_fanart_tv(item):
url = host.format(_type, _id)
res = httptools.downloadpage(url).json
if _type == 'tv':
ret['clearlogo'] = [k.get('url') for k in res.get('hdtvlogo', [])]
ret['clearart'] = [k.get('url') for k in res.get('hdclearart', [])]
ret['clearlogo'] = [k.get('url') for k in res.get('hdtvlogo', [])] + [k.get('url') for k in res.get('tvlogo', [])]
ret['clearart'] = [k.get('url') for k in res.get('hdclearart', [])] + [k.get('url') for k in res.get('hdclearart', [])]
ret['fanart'] = set_dict(res.get('showbackground', []))
ret['poster'] = set_dict(res.get('seasonposter', []))
ret['poster']['all'] = [k.get('url') for k in res.get('tvposter', [])]
@@ -1008,11 +1045,15 @@ def get_fanart_tv(item):
ret['banner']['all'] = [k.get('url') for k in res.get('tvbanner', [])]
elif _type == 'movies':
ret['clearlogo'] = [k.get('url') for k in res.get('hdmovielogo', [])]
ret['poster'] = [k.get('url') for k in res.get('movieposter', [])]
ret['fanart'] = [k.get('url') for k in res.get('moviebackground', [])]
ret['clearart'] = [k.get('url') for k in res.get('hdmovieclearart', [])]
ret['landscape'] = [k.get('url') for k in res.get('moviethumb', [])]
ret['banner'] = [k.get('url') for k in res.get('moviebanner', [])]
ret[set + 'clearlogo'] = [k.get('url') for k in res.get('hdmovielogo', [])] + [k.get('url') for k in res.get('movielogo', [])]
ret[set + 'poster'] = [k.get('url') for k in res.get('movieposter', [])]
ret[set + 'fanart'] = [k.get('url') for k in res.get('moviebackground', [])]
ret[set + 'clearart'] = [k.get('url') for k in res.get('hdmovieclearart', [])] + [k.get('url') for k in res.get('movieclearart', [])]
ret[set + 'landscape'] = [k.get('url') for k in res.get('moviethumb', [])]
ret[set + 'banner'] = [k.get('url') for k in res.get('moviebanner', [])]
ret[set + 'disc'] = [k.get('url') for k in res.get('moviedisc', [])]
if item.infoLabels.get('setid'):
it = item.clone(infoLabels = {'tmdb_id':item.infoLabels['setid']})
get_fanart_tv(it, 'set', ret)
return ret

View File

@@ -24,6 +24,7 @@ class addVideo(object):
self.strPath, self.parentPath, self.strFilename, self.path = get_path(self.item)
self.date = strftime('%Y-%m-%d %H:%M:%S', localtime(float(time())))
if self.item.contentType == 'movie':
self.set_path()
self.set_sets()
@@ -50,15 +51,17 @@ class addVideo(object):
cursor.execute(sql, params)
conn.commit()
xbmc.executebuiltin('ReloadSkin()')
# payload = {
# "jsonrpc": "2.0",
# "method": "VideoLibrary.Scan",
# "directory": self.strPath,
# "id": 1
# }
# get_data(payload)
# need if no movie in kodi library
if self.VideoId == 1:
payload = {
"jsonrpc": "2.0",
"method": "VideoLibrary.Scan",
"directory": self.strPath,
"id": 1
}
get_data(payload)
else:
xbmc.executebuiltin('ReloadSkin()')
conn.close()
def get_id(self):
@@ -96,7 +99,7 @@ class addVideo(object):
self.idSet = None
if self.info.get('set'):
sql = 'SELECT idSet from sets where (strSet = "{}") limit 1'.format(self.info.get('set'))
# params = self.info.get('set')
collection_info = videolibrarydb['collection'][self.info.get('setid')].infoLabels
nun_records, records = execute_sql_kodi(sql, conn=conn)
if records:
self.idSet = records[0][0]
@@ -105,10 +108,20 @@ class addVideo(object):
sql = 'INSERT OR IGNORE INTO sets (idSet, strSet, strOvervieW) VALUES ( ?, ?, ?)'
params = (self.idSet, self.info.get('set'), self.info.get('setoverview'))
self.sql_actions.append([sql, params])
if self.info.get('setposters'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'poster', 'url':self.info.get('setposters')[0]})
if self.info.get('setfanarts'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'fanart', 'url':self.info.get('setfanarts')[0]})
if collection_info.get('poster'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'poster', 'url':collection_info.get('poster')})
if collection_info.get('fanart'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'fanart', 'url':collection_info.get('fanart')})
if collection_info.get('landscape'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'landscape', 'url':collection_info.get('landscape')})
if collection_info.get('banner'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'banner', 'url':collection_info.get('banner')})
if collection_info.get('clearlogo'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearlogo', 'url':collection_info.get('clearlogo')})
if collection_info.get('clearart'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearart', 'url':collection_info.get('clearart')})
if collection_info.get('disc'):
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearart', 'url':collection_info.get('disc')})
def set_files(self):
self.idFile = get_id('idFile', 'files')
@@ -237,6 +250,16 @@ class addVideo(object):
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])
@@ -304,7 +327,7 @@ def add_video(item):
for episode in episodes:
addVideo(item=episode['item'])
# progress.update(int(math.ceil((i + 1) * t)))
# progress.close()
# progress.close()
def get_path(item):
filepath = filetools.join(config.get_videolibrary_config_path(), config.get_setting("folder_{}s".format(item.contentType)), item.strm_path)
@@ -333,17 +356,54 @@ def get_images(item):
posters = ''
fanarts = ''
setposters = item.infoLabels.get('setposters',[])
setfanarts = item.infoLabels.get('setfanarts',[])
videoposters = [item.thumbnail] + item.infoLabels.get('posters',[])
videofanarts = [item.fanart] + item.infoLabels.get('fanarts',[])
videoclearlogos = item.infoLabels.get('clearlogos',[])
videocleararts = item.infoLabels.get('cleararts',[])
videolanscapes = item.infoLabels.get('lanscapes',[])
videobanners = item.infoLabels.get('banners',[])
videodiscs = item.infoLabels.get('discs',[])
for p in setposters:
if p: posters += pstring.format('set.poster', p.replace('original', 'w500'), p)
for p in setfanarts:
if p: posters += pstring.format('set.fanart', p.replace('original', 'w500'), p)
for p in videoposters:
for p in videoposters:
if p: posters += pstring.format('poster', p.replace('original', 'w500'), p)
for p in videoclearlogos:
if p: posters += pstring.format('clearlogo', '', p)
for p in videocleararts:
if p: posters += pstring.format('clearart', '', p)
for p in videolanscapes:
if p: posters += pstring.format('lanscape', '', p)
for p in videobanners:
if p: posters += pstring.format('banner', '', p)
for p in videodiscs:
if p: posters += pstring.format('disc', '', p)
if item.infoLabels['setid']:
collection = videolibrarydb['collection'].get(item.infoLabels['setid'], {})
setposters = collection.infoLabels.get('posters',[])
setfanarts = collection.infoLabels.get('fanarts',[])
setclearlogos = collection.infoLabels.get('clearlogos',[])
setcleararts = collection.infoLabels.get('cleararts',[])
setlanscapes = collection.infoLabels.get('lanscapes',[])
setbanners = collection.infoLabels.get('banners',[])
setdiscs = collection.infoLabels.get('discs',[])
for p in setposters:
if p: posters += pstring.format('set.poster', p.replace('original', 'w500'), p)
for p in setfanarts:
if p: posters += pstring.format('set.fanart', p.replace('original', 'w500'), p)
for p in setclearlogos:
if p: posters += pstring.format('set.clearlogo', '', p)
for p in setcleararts:
if p: posters += pstring.format('set.clearart', '', p)
for p in setlanscapes:
if p: posters += pstring.format('set.lanscape', '', p)
for p in setbanners:
if p: posters += pstring.format('set.banner', '', p)
for p in setdiscs:
if p: posters += pstring.format('set.disc', '', p)
fanarts += '<fanart>'
for f in videofanarts:

View File

@@ -355,10 +355,11 @@ def render_items(itemlist, parent_item):
icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png"
listitem = xbmcgui.ListItem(item.title)
art = {'icon': icon_image, 'thumb': item.thumbnail, 'poster': item.thumbnail, 'fanart': item.fanart if item.fanart else default_fanart}
if item.landscape: art['landscape'] = item.landscape
if item.clearlogo: art['clearlogo'] = item.clearlogo
if item.clearart: art['clearart'] = item.clearart
if item.banner: art['banner'] = item.banner
if item.infoLabels.get('landscape'): art['landscape'] = item.infoLabels['landscape']
if item.infoLabels.get('clearlogo'): art['clearlogo'] = item.infoLabels['clearlogo']
if item.infoLabels.get('clearart'): art['clearart'] = item.infoLabels['clearart']
if item.infoLabels.get('banner'): art['banner'] = item.infoLabels['banner']
if item.infoLabels.get('disc'): art['banner'] = item.infoLabels['disc']
listitem.setArt(art)
listitem.setProperty('IsPlayable', str(config.get_setting("player_mode") == 1 and item.action == "play" and not item.nfo).lower())
@@ -524,6 +525,7 @@ def set_infolabels(listitem, item, player=False):
# if item.infoLabels.get('castandrole'):
# cast = [{'name':c[0], 'role':c[1], 'thumbnail':c[2], 'order':c[3]} for c in item.infoLabels.get("castandrole", [])]
# listitem.setCast(cast)
# listitem.setInfo("video", item.infoLabels)
def set_context_commands(item, item_url, parent_item, **kwargs):

View File

@@ -199,6 +199,14 @@ msgctxt "#30046"
msgid "Resume from start"
msgstr ""
msgctxt "#30047"
msgid "Group by collection"
msgstr ""
msgctxt "#30048"
msgid "Delete collection"
msgstr ""
msgctxt "#30050"
msgid "Server connection error"
msgstr ""

View File

@@ -199,6 +199,14 @@ msgctxt "#30046"
msgid "Resume from start"
msgstr "Riprendi dall'inizio"
msgctxt "#30047"
msgid "Group by collection"
msgstr "Ragruppa per collezione"
msgctxt "#30048"
msgid "Delete collection"
msgstr "Elimina collezione"
msgctxt "#30050"
msgid "Server connection error"
msgstr "Errore connessione server"

View File

@@ -37,6 +37,7 @@
<setting id="folder_tvshows" type="text" label="70118" default="Serie TV"/>
<setting id="folder_movies" type="text" label="70119" default="Film"/>
<setting id="videolibrary_kodi" type="bool" label="70120" default="false"/>
<setting id="collection" type="bool" label="30047" default="false"/>
<setting label="59997" type="lsep"/>
<setting id="videolibrary_max_quality" type="bool" label="70729" default="false" visible="true"/>
<setting id="next_ep" type="select" label="70748" lvalues="70832|70833|70732|70834" default="1"/>

View File

@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
#from builtins import str
from logging import RootLogger
from platformcode.xbmc_videolibrary import set_content
import sys, xbmcgui
from core import httptools, support
from core import httptools, jsontools, support
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
@@ -12,7 +13,7 @@ import xbmc, os, traceback
from core import filetools, scrapertools, videolibrarytools
from core.support import typo, thumb
from core.item import Item
from core.item import InfoLabels, Item
from platformcode import config, launcher, logger, platformtools
from core.videolibrarytools import videolibrarydb
@@ -24,131 +25,189 @@ else:
import urlparse
def mainlist(item):
logger.debug()
itemlist = [Item(channel=item.channel, title='Generi', action='list_genres', contentType='movie', thumbnail=support.thumb('movie_genre')),
Item(channel=item.channel, action='list_movies', title=config.get_localized_string(60509), contentType='movie',
category=config.get_localized_string(70270), thumbnail=thumb('videolibrary_movie')),
Item(channel=item.channel, action='list_tvshows',title=config.get_localized_string(60600),
category=config.get_localized_string(70271), thumbnail=thumb('videolibrary_tvshow'),
context=[{'channel':'videolibrary', 'action':'update_videolibrary', 'title':config.get_localized_string(70269), 'forced':True}]),
Item(channel='shortcuts', action='SettingOnPosition', title=typo(config.get_localized_string(70287),'bold color kod'),
category=2, setting=1, thumbnail = thumb('setting_0'),folder=False)]
itemlist = [item.clone(title=config.get_localized_string(60509), contentType='movie', action='list_movies', thumbnail=thumb('videolibrary_movie')),
item.clone(title=typo(config.get_localized_string(70741) % config.get_localized_string(30122) + '...', 'submenu'), contentType='movie',action='search_list', thumbnail=thumb('search_movie')),
item.clone(title=config.get_localized_string(60600), contentType='tvshow', action='list_tvshows', thumbnail=thumb('videolibrary_tvshow'),
context=[{'channel':'videolibrary', 'action':'update_videolibrary', 'title':config.get_localized_string(70269), 'forced':True}]),
item.clone(title=typo(config.get_localized_string(70741) % config.get_localized_string(30123) + '...', 'submenu'),contentType='tvshow', action='search_list', thumbnail=thumb('search_tvshow')),
item.clone(channel='shortcuts', title=typo(config.get_localized_string(70287),'bold color kod'), action='SettingOnPosition',
category=2, setting=1, thumbnail = thumb('setting_0'),folder=False)]
return itemlist
def search_list(item):
itemlist = [item.clone(title=config.get_localized_string(70032), action='list_genres', thumbnail=thumb('{}_genre'.format(item.contentType))),
item.clone(title=config.get_localized_string(70042), action='list_years', thumbnail=thumb('{}_year'.format(item.contentType))),
item.clone(title=config.get_localized_string(70314), action='list_az', next_action='list_actors', thumbnail=thumb('star')),
item.clone(title=config.get_localized_string(70473), action='list_ratings', thumbnail=thumb('{}_top'.format(item.contentType))),
item.clone(title='Registi', action='list_az', next_action='list_directors', thumbnail=thumb('directors')),
item.clone(title=config.get_localized_string(30980), action='search', thumbnail=thumb('search_{}'.format(item.contentType)))]
if item.contentType == 'movie':
itemlist.insert(0, item.clone(title='Collezioni', action='list_sets', thumbnail=thumb('{}_genre'.format(item.contentType))))
return itemlist
def channel_config(item):
return platformtools.show_channel_settings(channelpath=os.path.join(config.get_runtime_path(), 'channels', item.channel), caption=config.get_localized_string(60598))
def list_genres(item):
# support.dbg()
movies = dict(videolibrarydb[item.contentType]).values()
def list_az(item):
return [item.clone(title=i, action=item.next_action) for i in ['A','B','C','D','I','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']]
def list_genres(item):
videos = dict(videolibrarydb[item.contentType]).values()
videolibrarydb.close()
genres = []
for v in movies:
for v in videos:
genres += v['item'].infoLabels['genre'].split(',')
itemlist = []
for g in genres:
g = g.strip()
if g and g not in [it.genre for it in itemlist]:
it = item.clone(title = g, action='list_movies', genre=g)
it = item.clone(title = g, action='list_{}s'.format(item.contentType), genre=g)
itemlist.append(it)
itemlist.sort(key=lambda it: it.genre)
support.thumb(itemlist, True)
thumb(itemlist, True)
return itemlist
def list_sets(item):
videos = dict(videolibrarydb['collection']).values()
videolibrarydb.close()
itemlist = [v for v in videos]
itemlist.sort(key=lambda it: it.title)
add_context(itemlist)
return itemlist
def list_directors(item):
videos = dict(videolibrarydb[item.contentType]).values()
videolibrarydb.close()
directors = []
for v in videos:
directors += v['item'].infoLabels['director'].split(',')
itemlist = []
for d in directors:
d = d.strip()
if d and d[0][0] == item.title and d not in [it.director for it in itemlist]:
it = item.clone(title = d, action='list_{}s'.format(item.contentType), director=d)
itemlist.append(it)
itemlist.sort(key=lambda it: it.director)
return itemlist
def list_years(item):
videos = dict(videolibrarydb[item.contentType]).values()
videolibrarydb.close()
years = [v['item'].infoLabels['year'] for v in videos]
itemlist = []
for y in years:
if y and y not in [it.year for it in itemlist]:
it = item.clone(title = str(y), action='list_{}s'.format(item.contentType), year=y)
itemlist.append(it)
itemlist.sort(key=lambda it: it.year, reverse=True)
return itemlist
def list_ratings(item):
videos = dict(videolibrarydb[item.contentType]).values()
videolibrarydb.close()
ratings = [int(float(v['item'].infoLabels['rating'])) for v in videos]
itemlist = []
for r in ratings:
if r and r not in [it.rating for it in itemlist]:
it = item.clone(title = str(r), action='list_{}s'.format(item.contentType), rating=r)
itemlist.append(it)
itemlist.sort(key=lambda it: it.rating, reverse=True)
return itemlist
def list_actors(item):
videos = dict(videolibrarydb[item.contentType]).values()
videolibrarydb.close()
actors = []
for v in videos:
actors += [[a[0].strip(), a[2].strip(), a[4].strip()] for a in v['item'].infoLabels['castandrole']]
itemlist = []
for a in actors:
if a and a[0][0] == item.title and a[0] not in [it.initial for it in itemlist]:
it = item.clone(title = a[0], action='list_{}s'.format(item.contentType), initial=a[0], thumbnail=a[1])
itemlist.append(it)
itemlist.sort(key=lambda it: it.actor)
return itemlist
def search(item, text):
item.text = text
if item.contentType == 'movie':
return list_movies(item)
else:
return list_tvshows(item)
def list_movies(item, silent=False):
from core import jsontools
logger.debug()
# itemlist = []
videos = dict(videolibrarydb['movie']).values()
# for root, folders, files in filetools.walk(videolibrarytools.MOVIES_PATH):
# for f in folders:
# ID = scrapertools.find_single_match(f, r'\[([^\]]+)')
# if ID:
# ids.append(ID)
# if ID not in videolibrarydb['movie']:
# ids.append(ID)
# movies_path += [filetools.join(root, f, f + '.nfo')]
# local = False
# for f in filetools.listdir(filetools.join(root, f)):
# if f.split('.')[-1] not in ['nfo','json','strm']:
# local= True
# break
# with futures.ThreadPoolExecutor() as executor:
# itlist = [executor.submit(get_results, movie_path, root, 'movie', local) for movie_path in movies_path]
# for res in futures.as_completed(itlist):
# item_movie, value = res.result()
# # verify the existence of the channels
# if item_movie.library_urls and len(item_movie.library_urls) > 0:
# code = scrapertools.find_single_match(item_movie.strm_path, r'\[([^\]]+)')
# videolibrarydb['movie'][code] = {'item':jsontools.load(item_movie.tojson())}
movies = dict(videolibrarydb['movie'])
if item.year: itemlist = [v['item'] for v in videos if item.year == v['item'].infoLabels['year']]
elif item.rating: itemlist = [v['item'] for v in videos if item.rating == int(float(v['item'].infoLabels['rating']))]
elif item.genre: itemlist = [v['item'] for v in videos if item.genre in v['item'].infoLabels['genre']]
elif item.actor: itemlist = [v['item'] for v in videos if item.actor in str(v['item'].infoLabels['castandrole'])]
elif item.director: itemlist = [v['item'] for v in videos if item.actor in v['item'].infoLabels['director']]
elif item.set: itemlist = [v['item'] for v in videos if item.set == v['item'].infoLabels.get('setid', '')]
elif config.get_setting('collection') and not item.text: itemlist = [v['item'] for v in videos if (item.text.lower() in v['item'].title.lower() and not 'setid' in v['item'].infoLabels)] + [v for v in dict(videolibrarydb['collection']).values()]
else: itemlist = [v['item'] for v in videos if item.text.lower() in v['item'].title.lower()]
videolibrarydb.close()
itemlist = [value['item'] for value in movies.values() if item.genre in value['item'].infoLabels['genre']]
add_context(itemlist)
if silent == False:
itemlist.sort(key=lambda it: it.title.lower())
if item.set: itemlist.sort(key=lambda it: it.infoLabels['year'])
else: itemlist.sort(key=lambda it: it.title.lower())
return itemlist
def list_tvshows(item):
logger.debug()
itemlist = []
tvshows_path = []
ids = []
# lista = []
root = videolibrarytools.TVSHOWS_PATH
# start = time()
# for root, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH):
# for f in folders:
# ID = scrapertools.find_single_match(f, r'\[([^\]]+)')
# if ID:
# ids.append(ID)
# if ID not in videolibrarydb['movie']:
# ids.append(ID)
# tvshows_path += [filetools.join(root, f, f + '.nfo')]
# local = False
# for f in filetools.listdir(filetools.join(root, f)):
# if f.split('.')[-1] not in ['nfo','json','strm']:
# local= True
# break
# with futures.ThreadPoolExecutor() as executor:
# itlist = [executor.submit(get_results, tvshow_path, root, 'tvshow', local) for tvshow_path in tvshows_path]
# itlist = [executor.submit(get_results, filetools.join(root, folder, 'tvshow.nfo'), root, 'tvshow') for folder in filetools.listdir(root)]
# for res in futures.as_completed(itlist):
# item_tvshow, value = res.result()
# # verify the existence of the channels
# if item_tvshow.library_urls and len(item_tvshow.library_urls) > 0:
# code = scrapertools.find_single_match(item_tvshow.strm_path, r'\[([^\]]+)')
# db['tvshow'][code] = {'item':jsontools.load(item_tvshow.tojson())}
# # itemlist += [item_tvshow]
# lista += [{'title':item_tvshow.contentTitle,'thumbnail':item_tvshow.thumbnail,'fanart':item_tvshow.fanart, 'active': value, 'nfo':item_tvshow.nfo}]
# logger.debug('load list',time() - start)
videos = dict(videolibrarydb['tvshow']).values()
series = dict(videolibrarydb['tvshow'])
videolibrarydb.close()
if item.year: series = [v['item'] for v in videos if item.year == v['item'].infoLabels['year']]
elif item.rating: series = [v['item'] for v in videos if item.rating == int(float(v['item'].infoLabels['rating']))]
elif item.genre: series = [v['item'] for v in videos if item.genre in v['item'].infoLabels['genre']]
elif item.actor: series = [v['item'] for v in videos if item.actor in str(v['item'].infoLabels['castandrole'])]
elif item.director: series = [v['item'] for v in videos if item.actor in v['item'].infoLabels['director']]
else: series = [v['item'] for v in videos if item.text.lower() in v['item'].title.lower()]
def sub_thread(it):
it = it['item']
it.contentType = 'tvshow'
seasons = videolibrarydb['season'][it.videolibrary_id]
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2 or config.get_setting('no_pile_on_seasons', 'videolibrary') == 1 and len(seasons) == 1:
it.action = 'get_episodes'
it.all = True
if not it.active: it.title = '{} {}'.format(it.title, support.typo('','bullet bold'))
return it
with futures.ThreadPoolExecutor() as executor:
_list = [executor.submit(sub_thread, it) for it in series.values()]
_list = [executor.submit(sub_thread, it) for it in series]
for res in futures.as_completed(_list):
itemlist.append(res.result())
@@ -159,6 +218,7 @@ def list_tvshows(item):
itemlist += [Item(channel=item.channel, action='update_videolibrary', thumbnail=item.thumbnail,
fanart=item.thumbnail, landscape=item.thumbnail, forced=True,
title=typo(config.get_localized_string(70269), 'bold color kod'), folder=False)]
videolibrarydb.close()
return itemlist
@@ -292,33 +352,13 @@ def configure_update_videolibrary(item):
def get_seasons(item):
logger.debug()
itemlist = []
dict_temp = {}
seasons = videolibrarydb['season'][item.videolibrary_id]
videolibrarydb.close()
itemlist = sorted(seasons.values(), key=lambda it: int(it.contentSeason))
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2: # Ever
return get_episodes(item)
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 1 and len(dict_temp) == 1: # Only if there is a season
item.from_library = True
return get_episodes(item)
else:
from core import tmdb
seasons = videolibrarydb['season'][item.videolibrary_id]
videolibrarydb.close()
if len(seasons) == 1:
return get_episodes(list(seasons.values())[0])
itemlist = sorted(seasons.values(), key=lambda it: int(it.contentSeason))
add_context(itemlist)
if config.get_setting('show_all_seasons', 'videolibrary'):
it = item.clone(action='get_episodes', title=config.get_localized_string(60030), all=True)
it.infoLabels['playcount'] = 0
itemlist.insert(0, it)
add_download_items(item, itemlist)
add_context(itemlist)
add_download_items(item, itemlist)
return itemlist
@@ -848,70 +888,104 @@ def delete(item):
from platformcode import xbmc_videolibrary
select = None
delete = None
# get videolibrary path
if item.contentType == 'movie':
library_path = videolibrarytools.MOVIES_PATH
head = 70084
else:
library_path = videolibrarytools.TVSHOWS_PATH
head = 70085
from core import channeltools
# load channel in videoitem
from core import channeltools
channels = [c for c in videolibrarydb[item.contentType].get(item.videolibrary_id,{}).get('channels',{}).keys()]
channels.sort()
option_list = [config.get_localized_string(head)]
for channel in channels:
option_list.append(channeltools.get_channel_parameters(channel)['title'])
# If there are more channels shows the dialogue of choice
if len(option_list) > 2:
select = platformtools.dialog_select(config.get_localized_string(70088) % item.infoLabels['title'], option_list)
else:
delete = platformtools.dialog_yesno(config.get_localized_string(head), config.get_localized_string(70088) % item.infoLabels['title'])
# If you have chosen to delete the movie, the collection or the series
if select == 0 or delete:
del videolibrarydb[item.contentType][item.videolibrary_id]
if item.contentType == 'tvshow':
del videolibrarydb['season'][item.videolibrary_id]
del videolibrarydb['episode'][item.videolibrary_id]
path = filetools.join(library_path, item.base_name)
# delete collection
if item.set:
del videolibrarydb['collection'][item.set]
for k, v in dict(videolibrarydb['movie']).items():
if v['item'].infoLabels.get('setid') == item.set:
del videolibrarydb['movie'][k]
platformtools.itemlist_refresh(-1)
else:
# delete movie or series
del videolibrarydb[item.contentType][item.videolibrary_id]
filetools.rmdirtree(path)
if config.is_xbmc() and config.get_setting('videolibrary_kodi'):
from platformcode import xbmc_videolibrary
xbmc_videolibrary.clean_by_id(item)
platformtools.itemlist_refresh(-1)
if select and select > 0:
# check if there is movies in collection
if item.contentType == 'movie':
if item.infoLabels.get('setid'):
find = 0
for v in dict(videolibrarydb['movie']).values():
if v['item'].infoLabels.get('setid') == item.infoLabels.get('setid'):
find += 1
if find == 0:
del videolibrarydb['collection'][item.infoLabels.get('setid')]
channel_name = channels[select - 1]
# delete seasons and episodes
if item.contentType == 'tvshow':
del videolibrarydb['season'][item.videolibrary_id]
del videolibrarydb['episode'][item.videolibrary_id]
if item.contentType != 'movie':
episodes = videolibrarydb['episode'][item.videolibrary_id]
seasons = videolibrarydb['season'][item.videolibrary_id]
episodes_dict = dict(episodes)
seasons_dict = dict(seasons)
# remove files
path = filetools.join(library_path, item.base_name)
for key, episode in episodes_dict.items():
if len(episode['channels']) > 1 and channel_name in episode['channels']:
del episode['channels'][channel_name]
elif channel_name in episode['channels']:
xbmc_videolibrary.clean_by_id(episodes[key]['item'])
del episodes[key]
videolibrarydb['episode'][item.videolibrary_id] = episodes
seasons_list = []
filetools.rmdirtree(path)
if config.is_xbmc() and config.get_setting('videolibrary_kodi'):
from platformcode import xbmc_videolibrary
xbmc_videolibrary.clean_by_id(item)
platformtools.itemlist_refresh(-1)
for episode in episodes:
season = int(episode.split('x')[0])
if season not in seasons_list:
seasons_list.append(season)
# delete channel from video item
if select and select > 0:
channel_name = channels[select - 1]
for season in seasons_dict.keys():
if season not in seasons_list:
xbmc_videolibrary.clean_by_id(seasons[season])
del seasons[season]
videolibrarydb['season'][item.videolibrary_id] = seasons
channel = videolibrarydb[item.contentType][item.videolibrary_id]
channels = channel['channels']
del channels[channel_name]
channel['channels'] = channels
videolibrarydb[item.contentType][item.videolibrary_id] = channel
if item.contentType != 'movie':
episodes = videolibrarydb['episode'][item.videolibrary_id]
seasons = videolibrarydb['season'][item.videolibrary_id]
episodes_dict = dict(episodes)
seasons_dict = dict(seasons)
# delete episodes if they have no channels
for key, episode in episodes_dict.items():
if len(episode['channels']) > 1 and channel_name in episode['channels']:
del episode['channels'][channel_name]
elif channel_name in episode['channels']:
xbmc_videolibrary.clean_by_id(episodes[key]['item'])
del episodes[key]
videolibrarydb['episode'][item.videolibrary_id] = episodes
seasons_list = []
# delete seasons if they have no channels
for episode in episodes:
season = int(episode.split('x')[0])
if season not in seasons_list:
seasons_list.append(season)
for season in seasons_dict.keys():
if season not in seasons_list:
xbmc_videolibrary.clean_by_id(seasons[season])
del seasons[season]
videolibrarydb['season'][item.videolibrary_id] = seasons
channel = videolibrarydb[item.contentType][item.videolibrary_id]
channels = channel['channels']
del channels[channel_name]
channel['channels'] = channels
videolibrarydb[item.contentType][item.videolibrary_id] = channel
videolibrarydb.close()
@@ -1009,6 +1083,7 @@ def set_active(item):
def add_context(itemlist, title=config.get_localized_string(30052)):
title += '...'
for item in itemlist:
item.infoLabels['title'] = item.infoLabels.get('title', item.title)
item.context = [{'title':title, 'channel':'videolibrary', 'action':'subcontext'}]
class subcontext(object):
@@ -1019,7 +1094,8 @@ class subcontext(object):
self.titledict = {'movie':{'images':60240, 'notwatched':60016, 'watched':60017, 'delete':70084, 'lang':70246},
'tvshow':{'images':60240, 'notwatched':60020, 'watched':60021, 'delete':70085, 'lang':70246, 'notactive':60022, 'active': 60023, 'update':70269},
'season':{'images':60240, 'notwatched':60028, 'watched':60029},
'episode':{'images':60240, 'notwatched':60032, 'watched':60033}}
'episode':{'images':60240, 'notwatched':60032, 'watched':60033},
'list':{'images':60240, 'delete':30048}}
self.makecontext()
self.run()
@@ -1028,17 +1104,18 @@ class subcontext(object):
def makecontext(self):
# set watched
watched = self.item.infoLabels.get('playcount', 0)
if watched > 0:
title = self.title('notwatched')
value = 0
else:
title = self.title('watched')
value = 1
self.context.append(title)
self.commands.append(self.item.clone(action='mark_content_as_watched', playcount=value))
if not self.item.set:
watched = self.item.infoLabels.get('playcount', 0)
if watched > 0:
title = self.title('notwatched')
value = 0
else:
title = self.title('watched')
value = 1
self.context.append(title)
self.commands.append(self.item.clone(action='mark_content_as_watched', playcount=value))
if self.item.contentType in ['movie', 'tvshow']:
if self.item.contentType in ['movie', 'tvshow', 'list']:
# delete
self.context.append(self.title('delete'))
self.commands.append(self.item.clone(action='delete'))
@@ -1070,8 +1147,9 @@ class subcontext(object):
class set_images(object):
def __init__(self, item):
self.item = item
self.item_type = self.item.contentType if self.item.contentType != 'list' else 'collection'
self.type_dict = {'posters':'Poster', 'fanarts':'Fanart', 'banners':'Banner', 'landscapes':'Landscape', 'clearlogos':'ClearLogo'}
self.video = videolibrarydb[self.item.contentType][self.item.videolibrary_id]
self.video = videolibrarydb[self.item_type][self.item.videolibrary_id]
self.select_type()
videolibrarydb.close()
@@ -1082,7 +1160,7 @@ class set_images(object):
for k, v in self.type_dict.items():
if self.item.infoLabels.get(k):
it = xbmcgui.ListItem(v)
it.setArt({'thumb': self.item.infoLabels[k][0]})
it.setArt({'thumb': self.item.infoLabels[k[:-1].replace('poster', 'thumbnail')]})
types.append(it)
self.types.append(k)
self.list.append(self.item.infoLabels[k])
@@ -1096,7 +1174,7 @@ class set_images(object):
items = []
t = n[:-1].replace('poster', 'thumbnail')
for i, a in enumerate(self.item.infoLabels[n]):
for i, a in enumerate([self.item.infoLabels[t]] + self.item.infoLabels[n]):
title = 'Remote' if i > 0 else 'Current'
it = xbmcgui.ListItem(title)
it.setArt({'thumb': a})
@@ -1108,13 +1186,18 @@ class set_images(object):
selected = images[selection]
index = None
if self.item.contentType == 'episode':
if self.item_type == 'collection':
self.video.infoLabels[t] = selected
if t == 'thumbnail': self.video.thumbnail = selected
if t == 'fanart': self.video.fanart = selected
elif self.item_type == 'episode':
index = '{}x{:02d}'.format(self.item.contentSeason, self.item.contentEpisodeNumber)
self.video[index]['item'].infoLabels[t] = selected
if t == 'thumbnail': self.video[index]['item'].thumbnail = selected
if t == 'fanart': self.video[index]['item'].fanart = selected
elif self.item.contentType == 'season':
elif self.item_type == 'season':
index = self.item.contentSeason
self.video[index].infoLabels[t] = selected
if t == 'thumbnail': self.video[index].thumbnail = selected
@@ -1125,7 +1208,7 @@ class set_images(object):
if t == 'thumbnail': self.video['item'].thumbnail = selected
if t == 'fanart': self.video['item'].fanart = selected
videolibrarydb[self.item.contentType][self.item.videolibrary_id] = self.video
videolibrarydb[self.item_type][self.item.videolibrary_id] = self.video
platformtools.itemlist_refresh()
# if index:
# video = self.video[index]