Conversione videoteca: cambio scraper e progresso
This commit is contained in:
37
service.py
37
service.py
@@ -193,17 +193,41 @@ if __name__ == "__main__":
|
||||
import glob, xbmc
|
||||
from core import videolibrarytools, tmdb
|
||||
from core.item import Item
|
||||
dialog = None
|
||||
path_to_delete = []
|
||||
for film in glob.glob(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'), '*/*.json'))):
|
||||
if not dialog:
|
||||
|
||||
if config.get_setting('videolibrary_kodi') and config.get_setting('show_once'):
|
||||
nun_records, records = xbmc_videolibrary.execute_sql_kodi('select * from path where strPath = "' +
|
||||
filetools.join(config.get_setting('videolibrarypath'),
|
||||
config.get_setting('folder_tvshows')) +
|
||||
'/" and strScraper<>"metadata.local"')
|
||||
if nun_records:
|
||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||
path_to_delete = []
|
||||
film_lst = glob.glob(xbmc.translatePath(
|
||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'),
|
||||
'*/*.json')))
|
||||
tvshow_lst = glob.glob(xbmc.translatePath(
|
||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'),
|
||||
'*/tvshow.nfo')))
|
||||
total = len(film_lst) + len(tvshow_lst)
|
||||
progress = 0
|
||||
|
||||
# set local info only
|
||||
xbmc_videolibrary.execute_sql_kodi(
|
||||
'update path set strScraper="metadata.local", strSettings="" where strPath = "' +
|
||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows')) + '/"')
|
||||
xbmc_videolibrary.execute_sql_kodi(
|
||||
'update path set strScraper="metadata.local", strSettings="" where strPath = "' +
|
||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies')) + '/"')
|
||||
|
||||
for film in film_lst:
|
||||
path_to_delete.append(filetools.dirname(film))
|
||||
it = Item().fromjson(filetools.read(film))
|
||||
it.infoLabels = {'tmdb_id': it.infoLabels['tmdb_id'], 'mediatype':'movie'}
|
||||
tmdb.find_and_set_infoLabels(it)
|
||||
videolibrarytools.save_movie(it)
|
||||
for tvshow in glob.glob(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'), '*/tvshow.nfo'))):
|
||||
progress += 1
|
||||
dialog.update(int(progress / total * 100))
|
||||
for tvshow in tvshow_lst:
|
||||
if not dialog:
|
||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||
js = jsontools.load('\n'.join(filetools.read(tvshow).splitlines()[1:]))
|
||||
@@ -230,9 +254,10 @@ if __name__ == "__main__":
|
||||
logger.debug('EPISODE URL',ep.url)
|
||||
|
||||
videolibrarytools.save_tvshow(it, episodes, True)
|
||||
progress += 1
|
||||
dialog.update(int(progress / total * 100))
|
||||
for path in path_to_delete:
|
||||
filetools.rmdirtree(path, True)
|
||||
if dialog:
|
||||
dialog.close()
|
||||
|
||||
if config.get_setting('autostart'):
|
||||
|
||||
Reference in New Issue
Block a user