Modifiche e Fix a segna come già visto
This commit is contained in:
@@ -52,7 +52,7 @@ def genres(item):
|
||||
args = support.match(data, patronBlock=r'genre-options-json="([^\]]+)\]', patron=r'name"\s*:\s*"([^"]+)').matches
|
||||
for arg in args:
|
||||
itemlist.append(item.clone(title=support.typo(arg, 'bold'), args=arg, action='peliculas'))
|
||||
support.thumb(itemlist, mode='genre')
|
||||
support.thumb(itemlist, genre=True)
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ def peliculas(item):
|
||||
itemlist.append(makeItem(i, it, item))
|
||||
else:
|
||||
recordlist.append(it)
|
||||
|
||||
|
||||
itemlist.sort(key=lambda item: item.n)
|
||||
if recordlist:
|
||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page, records=recordlist))
|
||||
@@ -143,10 +143,7 @@ def makeItem(n, it, item):
|
||||
title, lang = support.match(info['name'], patron=r'([^\[|$]+)(?:\[([^\]]+)\])?').match
|
||||
if not lang:
|
||||
lang = 'ITA'
|
||||
itm = item.clone(title=support.typo(title,'bold') + support.typo(lang,'_ [] color kod bold'))
|
||||
itm.contentType = info['type'].replace('tv', 'tvshow')
|
||||
itm.language = lang
|
||||
itm.year = info['release_date'].split('-')[0]
|
||||
itm = item.clone(title=title, contentType = info['type'].replace('tv', 'tvshow'), contentLanguage = lang, year = info['release_date'].split('-')[0])
|
||||
|
||||
|
||||
if itm.contentType == 'movie':
|
||||
@@ -176,18 +173,15 @@ def episodios(item):
|
||||
for episodes in js:
|
||||
for it in episodes['episodes']:
|
||||
itemlist.append(
|
||||
support.Item(channel=item.channel,
|
||||
title=it['name'],
|
||||
episode = it['number'],
|
||||
season=episodes['number'],
|
||||
item.clone(
|
||||
contentEpisodeNumber = it['number'],
|
||||
contentSeason=episodes['number'],
|
||||
thumbnail=it['images'][0]['original_url'] if 'images' in it and 'original_url' in it['images'][0] else item.thumbnail,
|
||||
fanart=item.fanart,
|
||||
plot=it['plot'],
|
||||
action='findvideos',
|
||||
contentType='episode',
|
||||
contentSeason = int(episodes['number']),
|
||||
contentEpisodeNumber = int(it['number']),
|
||||
contentSerieName=item.fulltitle,
|
||||
contentTitle=support.cleantitle(it['name']),
|
||||
url=host + '/watch/' + str(episodes['title_id']),
|
||||
episodeid= '?e=' + str(it['id'])))
|
||||
|
||||
@@ -215,16 +209,16 @@ def findvideos(item):
|
||||
return s
|
||||
token = calculateToken()
|
||||
|
||||
def videourls(res):
|
||||
newurl = '{}/{}{}'.format(url, res, token)
|
||||
if requests.head(newurl, headers=headers).status_code == 200:
|
||||
video_urls.append({'type':'m3u8', 'res':res, 'url':newurl})
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
for res in ['480p', '720p', '1080p']:
|
||||
executor.submit(videourls, res)
|
||||
# def videourls(res):
|
||||
# newurl = '{}/{}{}'.format(url, res, token)
|
||||
# if requests.head(newurl, headers=headers).status_code == 200:
|
||||
# video_urls.append({'type':'m3u8', 'res':res, 'url':newurl})
|
||||
|
||||
# with futures.ThreadPoolExecutor() as executor:
|
||||
# for res in ['480p', '720p', '1080p']:
|
||||
# executor.submit(videourls, res)
|
||||
|
||||
if not video_urls: video_urls = [{'type':'m3u8', 'url':url + token}]
|
||||
else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match))
|
||||
itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, thumbnail=channeltools.get_channel_parameters(item.channel)["thumbnail"], forcethumb=True)]
|
||||
return support.server(item, itemlist=itemlist)
|
||||
@@ -683,17 +683,7 @@ def sort_servers(servers_list):
|
||||
return []
|
||||
|
||||
blacklisted_servers = config.get_setting("black_list", server='servers', default=[])
|
||||
favorite_servers = config.get_setting('favorites_servers_list', server='servers', default=[])
|
||||
favorite_servers = [s for s in favorite_servers if s not in blacklisted_servers]
|
||||
|
||||
if isinstance(servers_list[0], str):
|
||||
servers_list = sorted(servers_list, key=lambda x: favorite_servers.index(x) if x in favorite_servers else 999)
|
||||
return servers_list
|
||||
|
||||
favorite_quality = ['4k', '2160p', '2160', '4k2160p', '4k2160', '4k 2160p', '4k 2160', '2k',
|
||||
'fullhd', 'fullhd 1080', 'fullhd 1080p', 'full hd', 'full hd 1080', 'full hd 1080p', 'hd1080', 'hd1080p', 'hd 1080', 'hd 1080p', '1080', '1080p',
|
||||
'hd', 'hd720', 'hd720p', 'hd 720', 'hd 720p', '720', '720p', 'hdtv',
|
||||
'sd', '480p', '480', '360p', '360', '240p', '240']
|
||||
favorite_servers = [s for s in config.get_setting('favorites_servers_list', server='servers', default=[]) if s not in blacklisted_servers]
|
||||
|
||||
sorted_list = []
|
||||
inverted = False
|
||||
@@ -721,9 +711,8 @@ def sort_servers(servers_list):
|
||||
continue
|
||||
|
||||
element["index_server"] = index(favorite_servers, item.server.lower())
|
||||
element["index_quality"] = index(favorite_quality, item.quality.lower())
|
||||
element["index_quality"] = platformtools.calcResolution(item.quality)
|
||||
element['index_language'] = 0 if item.contentLanguage == 'ITA' else 1
|
||||
|
||||
element['videoitem'] = item
|
||||
sorted_list.append(element)
|
||||
|
||||
|
||||
@@ -597,7 +597,7 @@ def scrape(func):
|
||||
if anime and inspect.stack()[1][3] not in ['find_episodes']:
|
||||
from platformcode import autorenumber
|
||||
if function == 'episodios': autorenumber.start(itemlist, item)
|
||||
else: autorenumber.start(itemlist)
|
||||
else: autorenumber.start(itemlist, item)
|
||||
|
||||
if action != 'play' and 'patronMenu' not in args and 'patronGenreMenu' not in args and not disabletmdb and inspect.stack()[1][3] not in ['add_tvshow'] and function not in ['episodios', 'mainlist'] or (function in ['episodios'] and config.get_setting('episode_info')): # and function != 'episodios' and item.contentType in ['movie', 'tvshow', 'episode', 'undefined']
|
||||
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||
@@ -1139,12 +1139,10 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
logger.debug()
|
||||
|
||||
if item.contentType == 'movie':
|
||||
action = 'add_movie_to_library'
|
||||
extra = 'findvideos'
|
||||
action = 'add_to_library'
|
||||
contentType = 'movie'
|
||||
else:
|
||||
action = 'add_serie_to_library'
|
||||
extra = 'episodios'
|
||||
action = 'add_to_library'
|
||||
contentType = 'tvshow'
|
||||
|
||||
function = function if function else inspect.stack()[function_level][3]
|
||||
@@ -1176,7 +1174,6 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
url=item.url,
|
||||
action=action,
|
||||
from_action=item.action,
|
||||
extra=extra,
|
||||
path=item.path,
|
||||
thumbnail=thumb('add_to_videolibrary')
|
||||
))
|
||||
|
||||
@@ -687,11 +687,16 @@ def add_to_videolibrary(item, channel):
|
||||
|
||||
|
||||
def add_to_videolibrary(item, channel):
|
||||
itemlist = getattr(channel, item.from_action)(item)
|
||||
if itemlist and itemlist[0].contentType == 'episode':
|
||||
return add_tvshow(item, channel, itemlist)
|
||||
else:
|
||||
if item.contentType == 'movie':
|
||||
return add_movie(item)
|
||||
elif item.contentType == 'tvshow':
|
||||
return add_tvshow(item)
|
||||
else:
|
||||
itemlist = getattr(channel, item.from_action)(item)
|
||||
if itemlist and itemlist[0].contentType == 'episode':
|
||||
return add_tvshow(item, channel, itemlist)
|
||||
else:
|
||||
return add_movie(item)
|
||||
|
||||
|
||||
def add_movie(item):
|
||||
@@ -769,11 +774,6 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
||||
itemlist = [item.clone()]
|
||||
|
||||
else:
|
||||
# This mark is because the item has something else apart in the "extra" attribute
|
||||
# item.action = item.extra if item.extra else item.action
|
||||
if isinstance(item.extra, str) and "###" in item.extra:
|
||||
item.action = item.extra.split("###")[0]
|
||||
item.extra = item.extra.split("###")[1]
|
||||
|
||||
if item.from_action:
|
||||
item.__dict__["action"] = item.__dict__.pop("from_action")
|
||||
@@ -811,7 +811,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
||||
if not check(item, itemlist):
|
||||
action = item.action
|
||||
item.setrenumber = True
|
||||
start(item)
|
||||
start(itemlist, item)
|
||||
item.setrenumber = False
|
||||
item.action = action
|
||||
if not item.exit:
|
||||
@@ -820,8 +820,6 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
||||
else:
|
||||
itemlist = getattr(channel, item.action)(item)
|
||||
|
||||
global magnet_caching
|
||||
magnet_caching = False
|
||||
|
||||
inserted, overwritten, failed, path = save_tvshow(item, itemlist)
|
||||
|
||||
|
||||
@@ -289,9 +289,9 @@ class addMovie(object):
|
||||
|
||||
def set_files(self):
|
||||
self.idFile = get_id('idFile', 'files')
|
||||
if self.item.playcount:
|
||||
if self.info.get('playcount', None):
|
||||
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) VALUES ( ?, ?, ?, ?, ?, ?)'
|
||||
params = (self.idFile, self.idPath, self.strFilename, self.item.playcount, self.item.lastplayed, date)
|
||||
params = (self.idFile, self.idPath, self.strFilename, self.info.get('playcount', None), self.item.lastplayed, date)
|
||||
else:
|
||||
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, dateAdded) VALUES ( ?, ?, ?, ?)'
|
||||
params = (self.idFile, self.idPath, self.strFilename, date)
|
||||
@@ -331,7 +331,7 @@ class addMovie(object):
|
||||
writer_link_params = []
|
||||
directors = self.info.get('director', '').split(', ')
|
||||
directors_image = self.info.get('director_image', [])
|
||||
if not directors_image: writers_image = ['' for d in directors]
|
||||
if not directors_image: directors_image = ['' for d in directors]
|
||||
writers = self.info.get('writer', '').split(', ')
|
||||
writers_image = self.info.get('writer_image', [])
|
||||
if not writers_image: writers_image = ['' for w in writers]
|
||||
@@ -590,13 +590,16 @@ class addTvShow(object):
|
||||
files = {r[1].replace('.strm',''):r[0] for r in records}
|
||||
self.idFiles = {}
|
||||
idFile = get_id('idFile', 'files')
|
||||
# support.dbg()
|
||||
for episode in self.idEpisodes.keys():
|
||||
if episode in files.keys():
|
||||
self.idFiles[episode] = files[episode]
|
||||
sql = 'update files set playCount= {} where idFile= {}'.format(self.episodes[episode]['item'].infoLabels.get('playcount', None), files[episode])
|
||||
self.sql_actions.append([sql, ''])
|
||||
else:
|
||||
if self.item.playcount:
|
||||
if self.episodes[episode]['item'].infoLabels.get('playcount', None):
|
||||
sql = 'INSERT INTO files (idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) VALUES ( ?, ?, ?, ?, ?, ?)'
|
||||
params = (idFile, self.idPath, episode + '.strm', self.item.playcount, self.item.lastplayed, date)
|
||||
params = (idFile, self.idPath, episode + '.strm', self.episodes[episode]['item'].infoLabels.get('playcount', None), self.item.lastplayed, date)
|
||||
else:
|
||||
sql = 'INSERT INTO files (idFile, idPath, strFilename, dateAdded) VALUES ( ?, ?, ?, ?)'
|
||||
params = (idFile, self.idPath, episode + '.strm', date)
|
||||
|
||||
@@ -260,13 +260,8 @@ def run(item=None):
|
||||
elif item.action == "add_serie_to_library":
|
||||
from core import videolibrarytools
|
||||
videolibrarytools.add_tvshow(item, channel)
|
||||
|
||||
# Special action for adding a serie to the library
|
||||
elif item.action == "add_to_library":
|
||||
from core import videolibrarytools
|
||||
videolibrarytools.add_to_videolibrary(item, channel)
|
||||
|
||||
# Special action for adding a undefined to the library
|
||||
# Special action for adding a serie to the library
|
||||
elif item.action == "add_to_library":
|
||||
from core import videolibrarytools
|
||||
videolibrarytools.add_to_videolibrary(item, channel)
|
||||
|
||||
@@ -293,26 +293,28 @@ def dialog_busy(state):
|
||||
else: xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
|
||||
|
||||
|
||||
def itemlist_refresh(offset=0):
|
||||
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)
|
||||
def itemlist_refresh(offset=0, disable=False):
|
||||
if disable:
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
# xbmc.executebuiltin('ReloadSkin()')
|
||||
else:
|
||||
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()')
|
||||
|
||||
while xbmcgui.getCurrentWindowDialogId() != 10138:
|
||||
pass
|
||||
while xbmcgui.getCurrentWindowDialogId() == 10138:
|
||||
pass
|
||||
while xbmcgui.getCurrentWindowDialogId() != 10138:
|
||||
pass
|
||||
while xbmcgui.getCurrentWindowDialogId() == 10138:
|
||||
pass
|
||||
|
||||
ctl.selectItem(pos)
|
||||
except:
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
# xbmc.executebuiltin('ReloadSkin()')
|
||||
ctl.selectItem(pos)
|
||||
except:
|
||||
xbmc.executebuiltin("Container.Refresh")
|
||||
|
||||
|
||||
def itemlist_update(item, replace=False):
|
||||
@@ -427,7 +429,7 @@ def render_items(itemlist, parent_item):
|
||||
# r_list = [set_item(i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||
|
||||
r_list = []
|
||||
position = 0
|
||||
position = None
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
searchList = [executor.submit(set_item, i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||
@@ -438,7 +440,7 @@ def render_items(itemlist, parent_item):
|
||||
|
||||
|
||||
for item, item_url, listitem in r_list:
|
||||
if not position and not item.infoLabels.get('playcount', 0):
|
||||
if position == None and not item.infoLabels.get('playcount', 0) and item.channel != 'downloads':
|
||||
position = item.itemlistPosition
|
||||
dirItems.append(('%s?%s' % (sys.argv[0], item_url), listitem, item.folder, len(r_list)))
|
||||
xbmcplugin.addDirectoryItems(_handle, dirItems)
|
||||
@@ -466,8 +468,7 @@ def render_items(itemlist, parent_item):
|
||||
|
||||
logger.debug('END render_items')
|
||||
|
||||
if parent_item.channel == 'videolibrary' and parent_item.action in ['get_episodes', 'get_season']:
|
||||
|
||||
if parent_item.channel == 'videolibrary' and parent_item.action in ['get_episodes', 'get_seasons'] and position:
|
||||
while xbmcgui.getCurrentWindowDialogId() == 10138:
|
||||
logger.debug('WINDOW ID', xbmcgui.getCurrentWindowDialogId())
|
||||
xbmc.sleep(100)
|
||||
@@ -475,7 +476,7 @@ def render_items(itemlist, parent_item):
|
||||
win = xbmcgui.Window(10025)
|
||||
cid = win.getFocusId()
|
||||
ctl = win.getControl(cid)
|
||||
pos = position + (1 if xbmc.getInfoLabel('Container(10138).HasParent') else 0)
|
||||
pos = position + (1 if xbmc.getInfoLabel('Container(10138).HasParent') else 0)
|
||||
ctl.selectItem(pos)
|
||||
|
||||
|
||||
@@ -711,12 +712,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
|
||||
if item.channel != "videolibrary" and item.videolibrary != False and not item.disable_videolibrary:
|
||||
# Add Series to the video library
|
||||
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(60352), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_serie_to_library&from_action={}&contentChannel=videolibrary'.format(item.action))))
|
||||
# Add Movie to Video Library
|
||||
elif item.action in ["detail", "findvideos"] and item.contentType == 'movie' and item.contentTitle:
|
||||
context_commands.append((config.get_localized_string(60353), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_movie_to_library&from_action={}&contentChannel=videolibrary'.format(item.action))))
|
||||
elif item.action in ['check'] and item.contentTitle or item.contentSerieName:
|
||||
if item.contentTitle or item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(30161), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_to_library&from_action={}&contentChannel=videolibrary'.format(item.action))))
|
||||
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled') and not item.disable_videolibrary:
|
||||
|
||||
@@ -260,33 +260,33 @@ 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)
|
||||
if item.contentType == 'movie':
|
||||
conn = sqlite3.connect(get_file_db())
|
||||
path = '%{}%'.format(item.strm_path.split('\\')[0].split('/')[0] if item.strm_path else item.base_name)
|
||||
sql = 'select idMovie from movie_view where strPath like "{}"'.format(path)
|
||||
|
||||
request_season = ''
|
||||
request_episode = ''
|
||||
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)
|
||||
if r:
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": r[0][0], "playcount": value}, "id": 1}
|
||||
data = get_data(payload)
|
||||
|
||||
n, r = execute_sql_kodi(sql, conn=conn)
|
||||
if r:
|
||||
sql = 'update files set playCount= {} where idFile= {}'
|
||||
sql_actions = [sql.format(value, i[0]) for i in r]
|
||||
else:
|
||||
nun_records, records = execute_sql_kodi('SELECT idShow FROM tvshow_view WHERE uniqueid_value LIKE "{}"'.format(item.videolibrary_id))
|
||||
# delete TV show
|
||||
if records:
|
||||
tvshowid = records[0][0]
|
||||
|
||||
cursor = conn.cursor()
|
||||
for sql in sql_actions:
|
||||
if type(sql) == list:
|
||||
cursor.executemany(sql)
|
||||
else:
|
||||
cursor.execute(sql)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
nun_records, records = execute_sql_kodi('SELECT idFile FROM episode WHERE idShow={}'.format(tvshowid))
|
||||
sql = 'DELETE FROM files WHERE idFile IN (?)'
|
||||
params = [record[0] for record in records]
|
||||
sql = 'DELETE FROM files WHERE idFile IN {}'.format(tuple(params))
|
||||
execute_sql_kodi(sql)
|
||||
|
||||
# platformtools.itemlist_refresh()
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "id": 1, "params": {"tvshowid": tvshowid}}
|
||||
data = get_data(payload)
|
||||
|
||||
from platformcode.dbconverter import add_video;add_video(item)
|
||||
|
||||
|
||||
def set_watched_on_kod(data):
|
||||
|
||||
@@ -331,7 +331,7 @@ def get_episodes(item):
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
from core import autoplay
|
||||
from core import autoplay, servertools
|
||||
from platformcode import platformtools
|
||||
logger.debug()
|
||||
if config.get_setting('next_ep') == 3 and item.contentType != 'movie':
|
||||
@@ -413,10 +413,9 @@ def findvideos(item):
|
||||
if config.get_setting('autoplay'):
|
||||
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))
|
||||
servertools.sort_servers(itemlist)
|
||||
|
||||
if config.get_setting('checklinks') and not config.get_setting('autoplay'):
|
||||
from core import servertools
|
||||
itemlist = servertools.check_list_links(itemlist, config.get_setting('checklinks_number'))
|
||||
|
||||
if item.window:
|
||||
@@ -643,7 +642,7 @@ def mark_content_as_watched(item):
|
||||
self.seasons = videolibrarydb['season'][self.item.videolibrary_id]
|
||||
self.episodes = videolibrarydb['episode'][self.item.videolibrary_id]
|
||||
|
||||
getattr(self, 'mark_' + self.item.contentType)()
|
||||
getattr(self, 'mark_' + (self.item.mark if self.item.mark else self.item.contentType))()
|
||||
videolibrarydb.close()
|
||||
|
||||
if config.is_xbmc() and not self.item.not_update:
|
||||
@@ -653,13 +652,51 @@ def mark_content_as_watched(item):
|
||||
xbmc_videolibrary.mark_content_as_watched_on_kodi(movie, self.playcount)
|
||||
else:
|
||||
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 self.item.contentType == 'movie': it = self.movie['item']
|
||||
elif self.item.contentType == 'episode': it = self.episodes['{:d}x{:02d}'.format(self.s, self.e)]['item']
|
||||
else: it = self.tvshow['item']
|
||||
# elif self.item.contentType == 'season': it = self.seasons[self.s]
|
||||
if it: xbmc_videolibrary.mark_content_as_watched_on_kodi(it, self.playcount)
|
||||
|
||||
platformtools.itemlist_refresh()
|
||||
platformtools.itemlist_refresh(1, True if item.contentType in ['season', 'episode'] else False)
|
||||
|
||||
def mark_previous(self):
|
||||
if self.item.contentType == 'episode':
|
||||
current_episode = current_playcount = self.episodes['{:d}x{:02d}'.format(self.s, self.e)]['item']
|
||||
seasons = [s for s in self.seasons.keys()]
|
||||
seasons.sort()
|
||||
for it in self.episodes.values():
|
||||
if (it['item'].contentSeason == current_episode.contentSeason and it['item'].contentEpisodeNumber < current_episode.contentEpisodeNumber) or it['item'].contentSeason < current_episode.contentSeason:
|
||||
it['item'].infoLabels['playcount'] = 1
|
||||
videolibrarydb['episode'][self.item.videolibrary_id] = self.episodes
|
||||
for s in range(seasons[0], self.item.contentSeason + 1):
|
||||
self.s = s
|
||||
self.check_playcount('episode')
|
||||
elif self.item.contentType == 'season':
|
||||
seasons = [s for s in self.seasons.keys()]
|
||||
seasons.sort()
|
||||
for s in range(seasons[0], self.s):
|
||||
self.s = s
|
||||
self.mark_season()
|
||||
|
||||
def mark_following(self):
|
||||
if self.item.contentType == 'episode':
|
||||
current_episode = current_playcount = self.episodes['{:d}x{:02d}'.format(self.s, self.e)]['item']
|
||||
seasons = [s for s in self.seasons.keys()]
|
||||
seasons.sort()
|
||||
for it in self.episodes.values():
|
||||
if (it['item'].contentSeason == current_episode.contentSeason and it['item'].contentEpisodeNumber > current_episode.contentEpisodeNumber) or it['item'].contentSeason > current_episode.contentSeason:
|
||||
it['item'].infoLabels['playcount'] = 0
|
||||
videolibrarydb['episode'][self.item.videolibrary_id] = self.episodes
|
||||
for s in range(self.item.contentSeason, seasons[-1] + 1):
|
||||
self.s = s
|
||||
self.check_playcount('episode')
|
||||
elif self.item.contentType == 'season':
|
||||
seasons = [s for s in self.seasons.keys()]
|
||||
seasons.sort()
|
||||
for s in range(self.s + 1, seasons[-1] + 1):
|
||||
self.s = s
|
||||
self.mark_season()
|
||||
|
||||
def mark_episode(self):
|
||||
current_playcount = self.episodes['{:d}x{:02d}'.format(self.s, self.e)]['item'].infoLabels['playcount']
|
||||
@@ -683,7 +720,7 @@ def mark_content_as_watched(item):
|
||||
self.seasons[self.s].infoLabels['playcount'] = 0
|
||||
|
||||
videolibrarydb['season'][self.item.videolibrary_id] = self.seasons
|
||||
self.mark_all('episodes')
|
||||
self.mark_all('season_episodes')
|
||||
|
||||
if current_playcount == 0 or self.playcount == 0:
|
||||
self.check_playcount('season')
|
||||
@@ -729,7 +766,10 @@ def mark_content_as_watched(item):
|
||||
if len(watched) == len(episodes):
|
||||
season_playcount = self.playcount
|
||||
self.tvshow['item'].infoLabels['playcount'] = tv_playcount
|
||||
self.seasons[self.s].infoLabels['playcount'] = season_playcount
|
||||
try:
|
||||
self.seasons[self.s].infoLabels['playcount'] = season_playcount
|
||||
except:
|
||||
logger.debug('No Season')
|
||||
videolibrarydb['season'][self.item.videolibrary_id] = self.seasons
|
||||
else:
|
||||
watched = [s for s in self.seasons.values() if s.infoLabels['playcount'] > 0]
|
||||
@@ -739,8 +779,11 @@ def mark_content_as_watched(item):
|
||||
videolibrarydb['tvshow'][self.item.videolibrary_id] = self.tvshow
|
||||
|
||||
def mark_all(self, _type):
|
||||
episodes = [e for e in self.episodes.values() if e['item'].contentSeason == self.s]
|
||||
if _type == 'episodes':
|
||||
if _type == 'season_episodes':
|
||||
episodes = [e for e in self.episodes.values() if e['item'].contentSeason == self.s]
|
||||
for e in episodes:
|
||||
e['item'].infoLabels['playcount'] = self.playcount
|
||||
elif _type == 'episodes':
|
||||
for n, ep in self.episodes.items():
|
||||
self.episodes[n]['item'].infoLabels['playcount'] = self.playcount
|
||||
# self.check_playcount('season')
|
||||
@@ -842,6 +885,7 @@ class subcontext(object):
|
||||
return config.get_localized_string(self.titledict[self.item.contentType][_type])
|
||||
|
||||
def makecontext(self):
|
||||
# support.dbg()
|
||||
# set watched
|
||||
# if not self.item.set:
|
||||
watched = self.item.infoLabels.get('playcount', 0)
|
||||
@@ -852,7 +896,11 @@ class subcontext(object):
|
||||
title = self.title('watched')
|
||||
value = 1
|
||||
self.context.append(title)
|
||||
self.context.append('Segna precedenti come visti')
|
||||
self.context.append('Segna successivi come non visti')
|
||||
self.commands.append(self.item.clone(action='mark_content_as_watched', playcount=value))
|
||||
self.commands.append(self.item.clone(action='mark_content_as_watched', playcount=value, mark='previous'))
|
||||
self.commands.append(self.item.clone(action='mark_content_as_watched', playcount=value, mark='following'))
|
||||
|
||||
if self.item.contentType in ['movie', 'tvshow', 'list']:
|
||||
# delete
|
||||
@@ -1058,7 +1106,8 @@ def delete(item):
|
||||
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)
|
||||
else:
|
||||
platformtools.itemlist_refresh(-1)
|
||||
|
||||
# delete channel from video item
|
||||
if select and select > 0:
|
||||
|
||||
Reference in New Issue
Block a user