- Fix item.nfo e item.strm_path

- Fix vari
 - N.B. Ove possibile usare item.clone() al posto di Item()
This commit is contained in:
Alhaziel01
2020-06-19 15:27:20 +02:00
parent a43d0d7050
commit c06bbb9795
30 changed files with 213 additions and 1119 deletions

View File

@@ -1039,40 +1039,11 @@ def resume_playback(item, return_played_time=False):
from core import videolibrarytools, filetools
# if nfo and strm_path not exist
if not item.nfo:
ID = item.infoLabels['IMDBNumber']
if item.contentType == 'movie':
ID = ID if ID else item.infoLabels['tmdb_id']
vl = xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_movies")))
name = item.contentTitle if not config.get_setting('original_title_folder', 'videolibrary') else item.infoLabels['originaltitle']
name = name if not config.get_setting('lowerize_title', 'videolibrary') else name.lower()
path = filetools.validate_path('%s [%s]' % (name, ID))
item.nfo = filetools.join(vl, path, path + '.nfo')
if not item.strm_path: item.strm_path = filetools.join(path, item.contentTitle + '.strm')
else:
ID = ID if ID else 'tmdb_' + item.infoLabels['tmdb_id'] if config.get_setting('scraper_tvshows', 'videolibrary') == 0 else 'tvdb_' + item.infoLabels['tvdb_id']
vl = xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_tvshows")))
name = item.contentSerieName if not config.get_setting('original_title_folder', 'videolibrary') else item.infoLabels['originaltitle']
name = name if not config.get_setting('lowerize_title', 'videolibrary') else name.lower()
path = filetools.validate_path('%s [%s]' % (name, ID))
item.nfo = filetools.join(vl, path, 'tvshow.nfo')
if item.contentSeason and item.contentEpisodeNumber:
title = str(item.contentSeason) + 'x' + str(item.contentEpisodeNumber).zfill(2)
else:
season, episode = scrapertools.find_single_match(item.title, r'(\d+)x(\d+)')
item.contentSeason = int(season)
item.contentEpisodeNumber = int(episode)
title = season + 'x' + episode.zfill(2)
if not item.strm_path: item.strm_path = filetools.join(path, title + '.strm')
# Read NFO FILE
if item.contentType == 'movie':
nfo_path = item.nfo
elif xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_tvshows"))) in item.strm_path:
nfo_path = item.strm_path.replace('strm','nfo')
else:
nfo_path = xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_tvshows"),item.strm_path.replace('strm','nfo')))
nfo_path = item.strm_path.replace('strm','nfo')
if filetools.isfile(nfo_path):
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)