Correzioni videoteca

This commit is contained in:
Alhaziel01
2021-05-21 17:35:03 +02:00
parent 6b8305f7ae
commit 529e24e4c1
7 changed files with 206 additions and 370 deletions

View File

@@ -278,11 +278,11 @@ def dialog_select_group(heading, _list, preselect=0):
return dialog
def itemlist_refresh():
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
pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition + offset
xbmc.executebuiltin("Container.Refresh")
@@ -503,29 +503,20 @@ def set_infolabels(listitem, item, player=False):
@type item: item
"""
infoLabels_dict = {'aired': 'aired', 'album': 'album', 'artist': 'artist', 'cast': 'cast',
'castandrole': 'castandrole', 'tmdb_id': 'code', 'code': 'code', 'country': 'country',
'credits': 'credits', 'release_date': 'dateadded', 'dateadded': 'dateadded', 'dbid': 'dbid',
'director': 'director', 'duration': 'duration', 'episode': 'episode',
'episodio_sinopsis': 'episodeguide', 'episodio_air_date': 'None', 'episodio_imagen': 'None',
'episodio_titulo': 'title', 'episodio_vote_average': 'rating', 'episodio_vote_count': 'votes',
'fanart': 'None', 'genre': 'genre', 'homepage': 'None', 'imdb_id': 'imdbnumber',
'imdbnumber': 'imdbnumber', 'in_production': 'None', 'last_air_date': 'lastplayed',
'mediatype': 'mediatype', 'mpaa': 'mpaa', 'number_of_episodes': 'None',
'number_of_seasons': 'None', 'original_language': 'None', 'originaltitle': 'originaltitle',
'overlay': 'overlay', 'poster_path': 'path', 'popularity': 'None', 'playcount': 'playcount',
'plot': 'plot', 'plotoutline': 'plotoutline', 'premiered': 'premiered', 'quality': 'None',
'rating': 'rating', 'season': 'season', 'set': 'set', 'setid': 'setid',
'setoverview': 'setoverview', 'showlink': 'showlink', 'sortepisode': 'sortepisode',
'sortseason': 'sortseason', 'sorttitle': 'sorttitle', 'status': 'status', 'studio': 'studio',
'tag': 'tag', 'tagline': 'tagline', 'temporada_air_date': 'None', 'temporada_nombre': 'None',
'temporada_num_episodios': 'None', 'temporada_poster': 'None', 'title': 'title',
'top250': 'top250', 'tracknumber': 'tracknumber', 'trailer': 'trailer', 'thumbnail': 'None',
'tvdb_id': 'None', 'tvshowtitle': 'tvshowtitle', 'type': 'None', 'userrating': 'userrating',
'url_scraper': 'None', 'votes': 'votes', 'writer': 'writer', 'year': 'year'}
infoLabels_dict = {'aired': 'aired', 'album': 'album', 'artist': 'artist', 'cast': 'cast', 'castandrole': 'castandrole',
'tmdb_id': 'code', 'code': 'code', 'country': 'country', 'credits': 'credits', 'release_date': 'dateadded',
'dateadded': 'dateadded', 'dbid': 'dbid', 'director': 'director', 'duration': 'duration', 'episode': 'episode',
'episode_plot': 'episodeguide', 'episode_title': 'title', 'episode_vote_average': 'rating', 'episode_vote_count': 'votes',
'genre': 'genre', 'imdb_id': 'imdbnumber', 'imdbnumber': 'imdbnumber', 'last_air_date': 'lastplayed', 'mediatype': 'mediatype',
'mpaa': 'mpaa', 'originaltitle': 'originaltitle', 'overlay': 'overlay', 'poster_path': 'path', 'playcount': 'playcount',
'plot': 'plot', 'plotoutline': 'plotoutline', 'premiered': 'premiered', 'rating': 'rating', 'season': 'season', 'set': 'set',
'setid': 'setid', 'setoverview': 'setoverview', 'showlink': 'showlink', 'sortepisode': 'sortepisode', 'sortseason': 'sortseason',
'sorttitle': 'sorttitle', 'status': 'status', 'studio': 'studio', 'tag': 'tag', 'tagline': 'tagline', 'title': 'title',
'top250': 'top250', 'tracknumber': 'tracknumber', 'trailer': 'trailer', 'tvshowtitle': 'tvshowtitle', 'userrating': 'userrating',
'votes': 'votes', 'writer': 'writer', 'year': 'year'}
# if item.infoLabels:
try:
infoLabels_kodi = {infoLabels_dict[label_tag]: item.infoLabels[label_tag] for label_tag, label_value in list(item.infoLabels.items()) if infoLabels_dict[label_tag] != 'None' and label_tag in infoLabels_dict}
infoLabels_kodi = {infoLabels_dict[label_tag]: item.infoLabels[label_tag] for label_tag, label_value in list(item.infoLabels.items()) if label_tag in infoLabels_dict}
listitem.setInfo("video", infoLabels_kodi)
except:
listitem.setInfo("video", item.infoLabels)

View File

@@ -263,6 +263,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
@param value: > 0 for seen, 0 for not seen
"""
logger.debug()
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)
@@ -272,13 +273,12 @@ def mark_content_as_watched_on_kodi(item, value=1):
if 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)
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]
conn = sqlite3.connect(get_file_db())
cursor = conn.cursor()
cursor = conn.cursor()
for sql in sql_actions:
if type(sql) == list:
cursor.executemany(sql)
@@ -286,36 +286,9 @@ def mark_content_as_watched_on_kodi(item, value=1):
cursor.execute(sql)
conn.commit()
conn.close()
platformtools.itemlist_refresh()
def mark_season_as_watched_on_kodi(item, value=1):
"""
mark the entire season as seen or unseen in the Kodi library
@type item: item
@param item: element to mark
@type value: int
@param value: > 0 for seen, 0 for not seen
"""
logger.debug()
# support.dbg()
# logger.debug("item:\n" + item.tostring('\n'))
# We can only mark the season as seen in the Kodi database if the database is local, in case of sharing database this functionality will not work
if config.get_setting("db_mode", "videolibrary"):
return
if value == 0:
value = 'Null'
request_season = ''
if item.contentSeason > -1:
request_season = ' and c12= %s' % item.contentSeason
tvshows_path = filetools.join(config.config.get_videolibrary_config_path(), config.get_setting("folder_tvshows"))
sql = 'update files set playCount= %s where idFile in (select idfile from episode_view where (strPath like "%s" or strPath like "%s")%s)' % (value, request_season)
execute_sql_kodi(sql)
def set_watched_on_kod(data):
from specials import videolibrary
@@ -380,8 +353,6 @@ def set_watched_on_kod(data):
def mark_content_as_watched_on_kod(path):
from specials import videolibrary
from core import videolibrarytools
"""
mark the entire series or movie as viewed or unseen in the Alpha Video Library based on their status in the Kodi Video Library
@type str: path