Fix e migliorie Videoteca
- aggiunti in settings: - Converti Videoteca - Ripristina Videoteca da DB
This commit is contained in:
+2
-2
@@ -33,6 +33,7 @@
|
|||||||
"piratestreaming": "https://www.piratestreaming.shop",
|
"piratestreaming": "https://www.piratestreaming.shop",
|
||||||
"polpotv": "https://roma.polpo.tv",
|
"polpotv": "https://roma.polpo.tv",
|
||||||
"raiplay": "https://www.raiplay.it",
|
"raiplay": "https://www.raiplay.it",
|
||||||
|
"seriehd": "https://seriehd.cam",
|
||||||
"serietvonline": "https://serietvonline.art",
|
"serietvonline": "https://serietvonline.art",
|
||||||
"serietvsubita": "http://serietvsubita.xyz",
|
"serietvsubita": "http://serietvsubita.xyz",
|
||||||
"serietvu": "https://www.serietvu.link",
|
"serietvu": "https://www.serietvu.link",
|
||||||
@@ -46,7 +47,6 @@
|
|||||||
"findhost": {
|
"findhost": {
|
||||||
"altadefinizioneclick": "https://altadefinizione-nuovo.click",
|
"altadefinizioneclick": "https://altadefinizione-nuovo.click",
|
||||||
"animealtadefinizione": "https://www.animealtadefinizione.it",
|
"animealtadefinizione": "https://www.animealtadefinizione.it",
|
||||||
"filmpertutti": "https://filmpertuttiii.nuovo.live",
|
"filmpertutti": "https://filmpertuttiii.nuovo.live"
|
||||||
"seriehd": "https://nuovoindirizzo.info/seriehd"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "seriehd",
|
"id": "seriehd",
|
||||||
"name": "SerieHD",
|
"name": "SerieHD",
|
||||||
"active": false,
|
"active": true,
|
||||||
"language": ["ita"],
|
"language": ["ita"],
|
||||||
"thumbnail": "seriehd.png",
|
"thumbnail": "seriehd.png",
|
||||||
"banner": "seriehd.png",
|
"banner": "seriehd.png",
|
||||||
|
|||||||
+3
-3
@@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
|
|
||||||
from core import support
|
from core import support
|
||||||
def findhost(url):
|
# def findhost(url):
|
||||||
return support.match(url, patron=r'<h2[^>]+><a href="([^"]+)"').match
|
# return support.match(url, patron=r'<h2[^>]+><a href="([^"]+)"').match
|
||||||
|
|
||||||
host = support.config.get_channel_url(findhost)
|
host = support.config.get_channel_url()
|
||||||
headers = [['Referer', host]]
|
headers = [['Referer', host]]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+130
-7
@@ -15,7 +15,7 @@ import math, traceback, re, os
|
|||||||
from core import filetools, scraper, scrapertools, support, httptools, tmdb
|
from core import filetools, scraper, scrapertools, support, httptools, tmdb
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from lib import generictools
|
from lib import generictools
|
||||||
from platformcode import config, logger, platformtools
|
from platformcode import config, dbconverter, logger, platformtools
|
||||||
from platformcode.autorenumber import RENUMBER
|
from platformcode.autorenumber import RENUMBER
|
||||||
from core.videolibrarydb import videolibrarydb
|
from core.videolibrarydb import videolibrarydb
|
||||||
|
|
||||||
@@ -265,9 +265,10 @@ def save_movie(item, silent=False):
|
|||||||
if not silent:
|
if not silent:
|
||||||
p_dialog.update(100, item.contentTitle)
|
p_dialog.update(100, item.contentTitle)
|
||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
# Update Kodi Library
|
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not item.not_add:
|
||||||
from platformcode.dbconverter import add_video
|
# Update Kodi Library
|
||||||
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:
|
# if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent and inserted:
|
||||||
# from platformcode.xbmc_videolibrary import update
|
# from platformcode.xbmc_videolibrary import update
|
||||||
# update(MOVIES_PATH)
|
# update(MOVIES_PATH)
|
||||||
@@ -429,7 +430,7 @@ def save_tvshow(item, episodelist, silent=False):
|
|||||||
logger.debug()
|
logger.debug()
|
||||||
inserted, overwritten, failed = save_episodes(tvshow_item, episodelist, extra_info, item.host, local_files, silent=silent)
|
inserted, overwritten, failed = save_episodes(tvshow_item, episodelist, extra_info, item.host, local_files, silent=silent)
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent:# and inserted:
|
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not item.not_add:
|
||||||
from platformcode.dbconverter import add_video
|
from platformcode.dbconverter import add_video
|
||||||
add_video(tvshow_item)
|
add_video(tvshow_item)
|
||||||
|
|
||||||
@@ -682,7 +683,7 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
|||||||
def add_to_videolibrary(item, channel):
|
def add_to_videolibrary(item, channel):
|
||||||
itemlist = getattr(channel, item.from_action)(item)
|
itemlist = getattr(channel, item.from_action)(item)
|
||||||
if itemlist and itemlist[0].contentType == 'episode':
|
if itemlist and itemlist[0].contentType == 'episode':
|
||||||
return add_tvshow(item, itemlist)
|
return add_tvshow(item, itemlist=itemlist)
|
||||||
elif itemlist and itemlist[0].server:
|
elif itemlist and itemlist[0].server:
|
||||||
return add_movie(item)
|
return add_movie(item)
|
||||||
else:
|
else:
|
||||||
@@ -1066,4 +1067,126 @@ def set_base_name(item, _id):
|
|||||||
if config.get_setting("lowerize_title", "videolibrary"):
|
if config.get_setting("lowerize_title", "videolibrary"):
|
||||||
base_name = base_name.lower()
|
base_name = base_name.lower()
|
||||||
|
|
||||||
return '{} [{}]'.format(base_name, _id)
|
return '{} [{}]'.format(base_name, _id)
|
||||||
|
|
||||||
|
|
||||||
|
def restore_videolibrary():
|
||||||
|
movies = [x['item'] for x in dict(videolibrarydb['movie']).values()]
|
||||||
|
tvshows = [x['item'] for x in dict(videolibrarydb['tvshow']).values()]
|
||||||
|
total = len(movies) + len(tvshows)
|
||||||
|
progress = 0
|
||||||
|
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Ripristino videoteca in corso')
|
||||||
|
try: os.mkdir(MOVIES_PATH)
|
||||||
|
except: pass
|
||||||
|
try: os.mkdir(TVSHOWS_PATH)
|
||||||
|
except: pass
|
||||||
|
|
||||||
|
for item in movies:
|
||||||
|
base_name = set_base_name(item, item.videolibrary_id)
|
||||||
|
path = filetools.join(MOVIES_PATH, base_name)
|
||||||
|
try: os.mkdir(path)
|
||||||
|
except: pass
|
||||||
|
nfo_path = filetools.join(base_name, "{}.nfo".format(base_name))
|
||||||
|
strm_path = filetools.join(base_name, "{}.strm".format(base_name))
|
||||||
|
nfo_exists = filetools.exists(filetools.join(MOVIES_PATH, nfo_path))
|
||||||
|
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
|
||||||
|
local = True if 'local' in videolibrarydb['movie'][item.videolibrary_id]['channels'] else False
|
||||||
|
if not nfo_exists:
|
||||||
|
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
|
||||||
|
filetools.write(filetools.join(MOVIES_PATH, item.nfo_path), item.head_nfo)
|
||||||
|
if not strm_exists and not local:
|
||||||
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
|
||||||
|
filetools.write(filetools.join(MOVIES_PATH, item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
|
progress += 1
|
||||||
|
dialog.update(int(progress / total * 100))
|
||||||
|
|
||||||
|
for item in tvshows:
|
||||||
|
base_name = set_base_name(item, item.videolibrary_id)
|
||||||
|
path = filetools.join(TVSHOWS_PATH, base_name)
|
||||||
|
try: os.mkdir(path)
|
||||||
|
except: pass
|
||||||
|
nfo_path = filetools.join(base_name, "tvshow.nfo")
|
||||||
|
nfo_exists = filetools.exists(filetools.join(TVSHOWS_PATH, nfo_path))
|
||||||
|
if not nfo_exists:
|
||||||
|
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
|
||||||
|
filetools.write(filetools.join(TVSHOWS_PATH, item.nfo_path), item.head_nfo)
|
||||||
|
|
||||||
|
episodes = [x['item'] for x in dict(videolibrarydb['episode'][item.videolibrary_id]).values()]
|
||||||
|
for e in episodes:
|
||||||
|
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
||||||
|
strm_path = filetools.join(item.base_name, "{}.strm".format(season_episode))
|
||||||
|
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
|
||||||
|
local = True if 'local' in videolibrarydb['episode'][item.videolibrary_id][season_episode]['channels'] else False
|
||||||
|
if not strm_exists and not local:
|
||||||
|
logger.debug("Creating .strm: " + strm_path)
|
||||||
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
|
||||||
|
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
|
progress += 1
|
||||||
|
dialog.update(int(progress / total * 100))
|
||||||
|
videolibrarydb.close()
|
||||||
|
|
||||||
|
dbconverter.save_all()
|
||||||
|
|
||||||
|
def convert_videolibrary():
|
||||||
|
import glob, xbmc
|
||||||
|
from platformcode import xbmc_videolibrary
|
||||||
|
from core import jsontools
|
||||||
|
|
||||||
|
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||||
|
path_to_delete = []
|
||||||
|
film_lst = glob.glob(filetools.join(MOVIES_PATH, '*/*.json'))
|
||||||
|
tvshow_lst = glob.glob((filetools.join(TVSHOWS_PATH, '*/tvshow.nfo')))
|
||||||
|
total = len(film_lst) + len(tvshow_lst)
|
||||||
|
progress = 0
|
||||||
|
|
||||||
|
tvPath = filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'))
|
||||||
|
moviePath = filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'))
|
||||||
|
|
||||||
|
# set local info only
|
||||||
|
xbmc_videolibrary.execute_sql_kodi('update path set strScraper="metadata.local", strSettings="" where strPath = "{}{}"'.format(tvPath, '/' if '/' in tvPath else '\\'))
|
||||||
|
xbmc_videolibrary.execute_sql_kodi('update path set strScraper="metadata.local", strSettings="" where strPath = "{}{}"'.format(moviePath, '/' if '/' in moviePath else '\\'))
|
||||||
|
|
||||||
|
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)
|
||||||
|
it.no_reload = True
|
||||||
|
save_movie(it)
|
||||||
|
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:]))
|
||||||
|
channels_dict = js.get('library_urls')
|
||||||
|
if channels_dict:
|
||||||
|
for ch, url in channels_dict.items():
|
||||||
|
dir = filetools.listdir(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'), js['path'])))
|
||||||
|
json_files = [f for f in dir if f.endswith('.json')]
|
||||||
|
if json_files:
|
||||||
|
path_to_delete.append(filetools.dirname(tvshow))
|
||||||
|
nfo, it = read_nfo(tvshow)
|
||||||
|
it.infoLabels = {'tmdb_id': it.infoLabels['tmdb_id'], 'mediatype':'tvshow'}
|
||||||
|
it.contentType = 'tvshow'
|
||||||
|
it.channel = ch
|
||||||
|
it.url = channels_dict[ch]
|
||||||
|
remove_host(it)
|
||||||
|
tmdb.find_and_set_infoLabels(it)
|
||||||
|
try: channel = __import__('channels.%s' % ch, fromlist=['channels.%s' % ch])
|
||||||
|
except: channel = __import__('specials.%s' % ch, fromlist=['specials.%s' % ch])
|
||||||
|
it.host = channel.host
|
||||||
|
it.url = channel.host + it.url
|
||||||
|
episodes = getattr(channel, 'episodios')(it)
|
||||||
|
for ep in episodes:
|
||||||
|
logger.debug('EPISODE URL', ep.url)
|
||||||
|
it.no_reload = True
|
||||||
|
save_tvshow(it, episodes, True)
|
||||||
|
progress += 1
|
||||||
|
dialog.update(int(progress / total * 100))
|
||||||
|
for path in path_to_delete:
|
||||||
|
filetools.rmdirtree(path, True)
|
||||||
|
dialog.close()
|
||||||
|
if path_to_delete:
|
||||||
|
dbconverter.save_all()
|
||||||
+24
-20
@@ -14,6 +14,7 @@ def save_all():
|
|||||||
movies = dict(videolibrarydb['movie'])
|
movies = dict(videolibrarydb['movie'])
|
||||||
tvshows = dict(videolibrarydb['tvshow'])
|
tvshows = dict(videolibrarydb['tvshow'])
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
|
|
||||||
for movie in movies.values():
|
for movie in movies.values():
|
||||||
item = movie['item']
|
item = movie['item']
|
||||||
item.no_reload = True
|
item.no_reload = True
|
||||||
@@ -29,24 +30,23 @@ def save_all():
|
|||||||
def reload():
|
def reload():
|
||||||
movieid = get_id('idMovie', 'movie')
|
movieid = get_id('idMovie', 'movie')
|
||||||
showid = get_id('idShow', 'tvshow')
|
showid = get_id('idShow', 'tvshow')
|
||||||
|
payload = {"jsonrpc": "2.0",
|
||||||
|
"method": "VideoLibrary.Scan",
|
||||||
|
"id": 1}
|
||||||
|
|
||||||
if movieid > 0 and showid > 0:
|
while xbmc.getCondVisibility('Library.IsScanningVideo()'): pass
|
||||||
xbmc.executebuiltin('ReloadSkin()')
|
|
||||||
else:
|
payload["directory"] = videolibrarytools.FOLDER_TVSHOWS
|
||||||
payload = {
|
get_data(payload)
|
||||||
"jsonrpc": "2.0",
|
|
||||||
"method": "VideoLibrary.Scan",
|
while xbmc.getCondVisibility('Library.IsScanningVideo()'): pass
|
||||||
"directory": videolibrarytools.FOLDER_TVSHOWS,
|
|
||||||
"id": 1
|
payload["directory"] = videolibrarytools.FOLDER_MOVIES
|
||||||
}
|
get_data(payload)
|
||||||
get_data(payload)
|
|
||||||
payload = {
|
while xbmc.getCondVisibility('Library.IsScanningVideo()'): pass
|
||||||
"jsonrpc": "2.0",
|
|
||||||
"method": "VideoLibrary.Scan",
|
xbmc.executebuiltin('ReloadSkin()')
|
||||||
"directory": videolibrarytools.FOLDER_MOVIES,
|
|
||||||
"id": 1
|
|
||||||
}
|
|
||||||
get_data(payload)
|
|
||||||
|
|
||||||
|
|
||||||
def add_video(item):
|
def add_video(item):
|
||||||
@@ -223,7 +223,7 @@ class addMovie(object):
|
|||||||
get_data(payload)
|
get_data(payload)
|
||||||
else:
|
else:
|
||||||
xbmc.executebuiltin('ReloadSkin()')
|
xbmc.executebuiltin('ReloadSkin()')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
Type = 'id' + self.item.contentType.replace('tv', '').capitalize()
|
Type = 'id' + self.item.contentType.replace('tv', '').capitalize()
|
||||||
@@ -243,7 +243,9 @@ class addMovie(object):
|
|||||||
if records:
|
if records:
|
||||||
self.idParentPath = records[0][0]
|
self.idParentPath = records[0][0]
|
||||||
else:
|
else:
|
||||||
return
|
self.idParentPath = get_id('idPath', 'path')
|
||||||
|
sql = 'INSERT OR IGNORE INTO path (idPath, strPath, strContent, strScraper, noUpdate) VALUES ({}, "{}", "{}", "{}", {})'.format(self.idParentPath, self.parentPath, 'movies', 'meatadata.local', 0)
|
||||||
|
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
||||||
|
|
||||||
sql = 'select idPath from path where (strPath = "{}") limit 1'.format(self.strPath)
|
sql = 'select idPath from path where (strPath = "{}") limit 1'.format(self.strPath)
|
||||||
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
||||||
@@ -559,7 +561,9 @@ class addTvShow(object):
|
|||||||
if records:
|
if records:
|
||||||
self.idParentPath = records[0][0]
|
self.idParentPath = records[0][0]
|
||||||
else:
|
else:
|
||||||
return
|
self.idParentPath = get_id('idPath', 'path')
|
||||||
|
sql = 'INSERT OR IGNORE INTO path (idPath, strPath, strContent, strScraper, noUpdate) VALUES ({}, "{}", "{}", "{}", {})'.format(self.idParentPath, self.parentPath, 'tvshows', 'meatadata.local', 0)
|
||||||
|
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
||||||
|
|
||||||
sql = 'select idPath from path where (strPath = "{}") limit 1'.format(self.strPath)
|
sql = 'select idPath from path where (strPath = "{}") limit 1'.format(self.strPath)
|
||||||
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
||||||
|
|||||||
@@ -6167,6 +6167,14 @@ msgctxt "#70838"
|
|||||||
msgid "There are no valid content for: %s"
|
msgid "There are no valid content for: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#70839"
|
||||||
|
msgid "Convert Videolibrary"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#70840"
|
||||||
|
msgid "Restore Video Library from DB"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
# DNS start [ settings and declaration ]
|
# DNS start [ settings and declaration ]
|
||||||
msgctxt "#707401"
|
msgctxt "#707401"
|
||||||
msgid "Enable DNS check alert"
|
msgid "Enable DNS check alert"
|
||||||
|
|||||||
@@ -6166,7 +6166,15 @@ msgstr "Abilita/Disabilita Canali"
|
|||||||
|
|
||||||
msgctxt "#70838"
|
msgctxt "#70838"
|
||||||
msgid "There are no valid content for: %s"
|
msgid "There are no valid content for: %s"
|
||||||
msgstr "Non ci sono contenti validi per: %s"
|
msgstr "Non ci sono contenuti validi per: %s"
|
||||||
|
|
||||||
|
msgctxt "#70839"
|
||||||
|
msgid "Convert Videolibrary"
|
||||||
|
msgstr "Converti Videoteca"
|
||||||
|
|
||||||
|
msgctxt "#70840"
|
||||||
|
msgid "Restore Video Library from DB"
|
||||||
|
msgstr "Ripristina Videoteca da DB"
|
||||||
|
|
||||||
# DNS start [ settings and declaration ]
|
# DNS start [ settings and declaration ]
|
||||||
msgctxt "#707401"
|
msgctxt "#707401"
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
<setting id="vidolibrary_export" type="action" label="80000" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiZXhwb3J0X3ZpZGVvbGlicmFyeSIsDQogICAgImNoYW5uZWwiOiAiYmFja3VwIg0KfQ==)"/>
|
<setting id="vidolibrary_export" type="action" label="80000" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiZXhwb3J0X3ZpZGVvbGlicmFyeSIsDQogICAgImNoYW5uZWwiOiAiYmFja3VwIg0KfQ==)"/>
|
||||||
<setting id="vidolibrary_import" type="action" label="80001" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiaW1wb3J0X3ZpZGVvbGlicmFyeSIsDQogICAgImNoYW5uZWwiOiAiYmFja3VwIg0KfQ==)"/>
|
<setting id="vidolibrary_import" type="action" label="80001" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiaW1wb3J0X3ZpZGVvbGlicmFyeSIsDQogICAgImNoYW5uZWwiOiAiYmFja3VwIg0KfQ==)"/>
|
||||||
<setting id="vidolibrary_delete" type="action" label="80036" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiZGVsZXRlX3ZpZGVvbGlicmFyeSIsDQogICAgImNoYW5uZWwiOiAidmlkZW9saWJyYXJ5Ig0KfQ==)"/>
|
<setting id="vidolibrary_delete" type="action" label="80036" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiZGVsZXRlX3ZpZGVvbGlicmFyeSIsDQogICAgImNoYW5uZWwiOiAidmlkZW9saWJyYXJ5Ig0KfQ==)"/>
|
||||||
|
<setting id="vidolibrary_convert" type="action" label="70839" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiY29udmVydF92aWRlb2xpYnJhcnkiLA0KICAgICJjaGFubmVsIjogInZpZGVvbGlicmFyeSINCn0=)"/>
|
||||||
|
<setting id="vidolibrary_restore" type="action" label="70840" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAicmVzdG9yZV92aWRlb2xpYnJhcnkiLA0KICAgICJjaGFubmVsIjogInZpZGVvbGlicmFyeSINCn0=)"/>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<!-- Channels -->
|
<!-- Channels -->
|
||||||
|
|||||||
+57
-56
@@ -200,65 +200,66 @@ if __name__ == "__main__":
|
|||||||
config.get_setting('folder_tvshows')) +
|
config.get_setting('folder_tvshows')) +
|
||||||
'/" and strScraper<>"metadata.local"')
|
'/" and strScraper<>"metadata.local"')
|
||||||
if nun_records:
|
if nun_records:
|
||||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
videolibrarytools.convert_videolibrary()
|
||||||
path_to_delete = []
|
# dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||||
film_lst = glob.glob(xbmc.translatePath(
|
# path_to_delete = []
|
||||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'),
|
# film_lst = glob.glob(xbmc.translatePath(
|
||||||
'*/*.json')))
|
# filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'),
|
||||||
tvshow_lst = glob.glob(xbmc.translatePath(
|
# '*/*.json')))
|
||||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'),
|
# tvshow_lst = glob.glob(xbmc.translatePath(
|
||||||
'*/tvshow.nfo')))
|
# filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'),
|
||||||
total = len(film_lst) + len(tvshow_lst)
|
# '*/tvshow.nfo')))
|
||||||
progress = 0
|
# total = len(film_lst) + len(tvshow_lst)
|
||||||
|
# progress = 0
|
||||||
|
|
||||||
# set local info only
|
# # set local info only
|
||||||
xbmc_videolibrary.execute_sql_kodi(
|
# xbmc_videolibrary.execute_sql_kodi(
|
||||||
'update path set strScraper="metadata.local", strSettings="" where strPath = "' +
|
# 'update path set strScraper="metadata.local", strSettings="" where strPath = "' +
|
||||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows')) + '/"')
|
# filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows')) + '/"')
|
||||||
xbmc_videolibrary.execute_sql_kodi(
|
# xbmc_videolibrary.execute_sql_kodi(
|
||||||
'update path set strScraper="metadata.local", strSettings="" where strPath = "' +
|
# 'update path set strScraper="metadata.local", strSettings="" where strPath = "' +
|
||||||
filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies')) + '/"')
|
# filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies')) + '/"')
|
||||||
|
|
||||||
for film in film_lst:
|
# for film in film_lst:
|
||||||
path_to_delete.append(filetools.dirname(film))
|
# path_to_delete.append(filetools.dirname(film))
|
||||||
it = Item().fromjson(filetools.read(film))
|
# it = Item().fromjson(filetools.read(film))
|
||||||
it.infoLabels = {'tmdb_id': it.infoLabels['tmdb_id'], 'mediatype':'movie'}
|
# it.infoLabels = {'tmdb_id': it.infoLabels['tmdb_id'], 'mediatype':'movie'}
|
||||||
tmdb.find_and_set_infoLabels(it)
|
# tmdb.find_and_set_infoLabels(it)
|
||||||
videolibrarytools.save_movie(it)
|
# videolibrarytools.save_movie(it)
|
||||||
progress += 1
|
# progress += 1
|
||||||
dialog.update(int(progress / total * 100))
|
# dialog.update(int(progress / total * 100))
|
||||||
for tvshow in tvshow_lst:
|
# for tvshow in tvshow_lst:
|
||||||
if not dialog:
|
# if not dialog:
|
||||||
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
# dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
|
||||||
js = jsontools.load('\n'.join(filetools.read(tvshow).splitlines()[1:]))
|
# js = jsontools.load('\n'.join(filetools.read(tvshow).splitlines()[1:]))
|
||||||
channels_dict = js.get('library_urls')
|
# channels_dict = js.get('library_urls')
|
||||||
if channels_dict:
|
# if channels_dict:
|
||||||
for ch, url in channels_dict.items():
|
# for ch, url in channels_dict.items():
|
||||||
dir = filetools.listdir(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'), js['path'])))
|
# dir = filetools.listdir(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'), js['path'])))
|
||||||
json_files = [f for f in dir if f.endswith('.json')]
|
# json_files = [f for f in dir if f.endswith('.json')]
|
||||||
if json_files:
|
# if json_files:
|
||||||
path_to_delete.append(filetools.dirname(tvshow))
|
# path_to_delete.append(filetools.dirname(tvshow))
|
||||||
nfo, it = videolibrarytools.read_nfo(tvshow)
|
# nfo, it = videolibrarytools.read_nfo(tvshow)
|
||||||
it.infoLabels = {'tmdb_id': it.infoLabels['tmdb_id'], 'mediatype':'tvshow'}
|
# it.infoLabels = {'tmdb_id': it.infoLabels['tmdb_id'], 'mediatype':'tvshow'}
|
||||||
it.contentType = 'tvshow'
|
# it.contentType = 'tvshow'
|
||||||
it.channel = ch
|
# it.channel = ch
|
||||||
it.url = channels_dict[ch]
|
# it.url = channels_dict[ch]
|
||||||
tmdb.find_and_set_infoLabels(it)
|
# tmdb.find_and_set_infoLabels(it)
|
||||||
try:
|
# try:
|
||||||
channel = __import__('channels.%s' % ch, fromlist=['channels.%s' % ch])
|
# channel = __import__('channels.%s' % ch, fromlist=['channels.%s' % ch])
|
||||||
except:
|
# except:
|
||||||
channel = __import__('specials.%s' % ch, fromlist=['specials.%s' % ch])
|
# channel = __import__('specials.%s' % ch, fromlist=['specials.%s' % ch])
|
||||||
it.host = channel.host
|
# it.host = channel.host
|
||||||
episodes = getattr(channel, 'episodios')(it)
|
# episodes = getattr(channel, 'episodios')(it)
|
||||||
for ep in episodes:
|
# for ep in episodes:
|
||||||
logger.debug('EPISODE URL',ep.url)
|
# logger.debug('EPISODE URL',ep.url)
|
||||||
|
|
||||||
videolibrarytools.save_tvshow(it, episodes, True)
|
# videolibrarytools.save_tvshow(it, episodes, True)
|
||||||
progress += 1
|
# progress += 1
|
||||||
dialog.update(int(progress / total * 100))
|
# dialog.update(int(progress / total * 100))
|
||||||
for path in path_to_delete:
|
# for path in path_to_delete:
|
||||||
filetools.rmdirtree(path, True)
|
# filetools.rmdirtree(path, True)
|
||||||
dialog.close()
|
# dialog.close()
|
||||||
|
|
||||||
if config.get_setting('autostart'):
|
if config.get_setting('autostart'):
|
||||||
xbmc.executebuiltin('RunAddon(plugin.video.' + config.PLUGIN_NAME + ')')
|
xbmc.executebuiltin('RunAddon(plugin.video.' + config.PLUGIN_NAME + ')')
|
||||||
|
|||||||
@@ -1325,3 +1325,8 @@ def get_results(nfo_path, root, Type, local=False):
|
|||||||
|
|
||||||
# platformtools.itemlist_refresh()
|
# platformtools.itemlist_refresh()
|
||||||
|
|
||||||
|
def convert_videolibrary(item):
|
||||||
|
videolibrarytools.convert_videolibrary()
|
||||||
|
|
||||||
|
def restore_videolibrary(item):
|
||||||
|
videolibrarytools.restore_videolibrary()
|
||||||
|
|||||||
Reference in New Issue
Block a user