Selezione Scraper (TMDb TvSows come default)
This commit is contained in:
@@ -613,115 +613,29 @@ def set_content(content_type, silent=False, custom=False):
|
|||||||
msg_text = ""
|
msg_text = ""
|
||||||
videolibrarypath = config.get_setting("videolibrarypath")
|
videolibrarypath = config.get_setting("videolibrarypath")
|
||||||
|
|
||||||
if content_type == 'movie':
|
scraper = []
|
||||||
scraper = [config.get_localized_string(70093), config.get_localized_string(70096)]
|
values = []
|
||||||
if not custom:
|
# from core.support import dbg;dbg()
|
||||||
seleccion = 0 # tmdb
|
rpc = '{ "jsonrpc": "2.0", "method": "Addons.GetAddons","params":{"type":"xbmc.metadata.scraper.' + content_type + 's", "properties":["name"]}, "id": "1"}'
|
||||||
|
response = jsontools.load(xbmc.executeJSONRPC(rpc))['result']['addons']
|
||||||
|
for r in response:
|
||||||
|
scraper.append(r['name'])
|
||||||
|
values.append(r['addonid'])
|
||||||
|
if not custom:
|
||||||
|
if content_type == 'movie':
|
||||||
|
seleccion = values.index('metadata.themoviedb.org')
|
||||||
else:
|
else:
|
||||||
seleccion = platformtools.dialog_select(config.get_localized_string(70094), scraper)
|
seleccion = values.index('metadata.tvshows.themoviedb.org.python')
|
||||||
|
else:
|
||||||
|
seleccion = platformtools.dialog_select(config.get_localized_string(70094), scraper)
|
||||||
|
|
||||||
|
# Configure scraper
|
||||||
|
if seleccion != -1:
|
||||||
|
xbmc.executebuiltin(f'Addon.OpenSettings({values[seleccion]})', True)
|
||||||
|
else:
|
||||||
|
continuar = False
|
||||||
|
|
||||||
|
|
||||||
# Instalar The Movie Database
|
|
||||||
if seleccion == -1 or seleccion == 0:
|
|
||||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.themoviedb.org)'):
|
|
||||||
if not silent:
|
|
||||||
# Ask if we want to install metadata.themoviedb.org
|
|
||||||
install = platformtools.dialog_yesno(config.get_localized_string(60046),'')
|
|
||||||
else:
|
|
||||||
install = True
|
|
||||||
|
|
||||||
if install:
|
|
||||||
try:
|
|
||||||
# Install metadata.themoviedb.org
|
|
||||||
xbmc.executebuiltin('InstallAddon(metadata.themoviedb.org)', True)
|
|
||||||
logger.debug("Instalado el Scraper de películas de TheMovieDB")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
continuar = (install and xbmc.getCondVisibility('System.HasAddon(metadata.themoviedb.org)'))
|
|
||||||
if not continuar:
|
|
||||||
msg_text = config.get_localized_string(60047)
|
|
||||||
if continuar:
|
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(metadata.themoviedb.org)', True)
|
|
||||||
|
|
||||||
# Instalar Universal Movie Scraper
|
|
||||||
elif seleccion == 1:
|
|
||||||
if continuar and not xbmc.getCondVisibility('System.HasAddon(metadata.universal)'):
|
|
||||||
continuar = False
|
|
||||||
if not silent:
|
|
||||||
# Ask if we want to install metadata.universal
|
|
||||||
install = platformtools.dialog_yesno(config.get_localized_string(70095),'')
|
|
||||||
else:
|
|
||||||
install = True
|
|
||||||
|
|
||||||
if install:
|
|
||||||
try:
|
|
||||||
xbmc.executebuiltin('InstallAddon(metadata.universal)', True)
|
|
||||||
if xbmc.getCondVisibility('System.HasAddon(metadata.universal)'):
|
|
||||||
continuar = True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
continuar = (install and continuar)
|
|
||||||
if not continuar:
|
|
||||||
msg_text = config.get_localized_string(70097)
|
|
||||||
if continuar:
|
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(metadata.universal)', True)
|
|
||||||
|
|
||||||
else: # SERIES
|
|
||||||
scraper = [config.get_localized_string(70093), config.get_localized_string(70098)]
|
|
||||||
if not custom:
|
|
||||||
seleccion = 0 # tmdb
|
|
||||||
else:
|
|
||||||
seleccion = platformtools.dialog_select(config.get_localized_string(70107), scraper)
|
|
||||||
|
|
||||||
# Instalar The Movie Database
|
|
||||||
if seleccion == -1 or seleccion == 0:
|
|
||||||
if continuar and not xbmc.getCondVisibility('System.HasAddon(metadata.tvshows.themoviedb.org)'):
|
|
||||||
continuar = False
|
|
||||||
if not silent:
|
|
||||||
# Ask if we want to install metadata.tvshows.themoviedb.org
|
|
||||||
install = platformtools.dialog_yesno(config.get_localized_string(60050),'')
|
|
||||||
else:
|
|
||||||
install = True
|
|
||||||
|
|
||||||
if install:
|
|
||||||
try:
|
|
||||||
# Install metadata.tvshows.themoviedb.org
|
|
||||||
xbmc.executebuiltin('InstallAddon(metadata.tvshows.themoviedb.org)', True)
|
|
||||||
if xbmc.getCondVisibility('System.HasAddon(metadata.tvshows.themoviedb.org)'):
|
|
||||||
continuar = True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
continuar = (install and continuar)
|
|
||||||
if not continuar:
|
|
||||||
msg_text = config.get_localized_string(60051)
|
|
||||||
if continuar:
|
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(metadata.tvshows.themoviedb.org)', True)
|
|
||||||
|
|
||||||
# Instalar The TVDB
|
|
||||||
elif seleccion == 1:
|
|
||||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.tvdb.com)'):
|
|
||||||
if not silent:
|
|
||||||
#Ask if we want to install metadata.tvdb.com
|
|
||||||
install = platformtools.dialog_yesno(config.get_localized_string(60048),'')
|
|
||||||
else:
|
|
||||||
install = True
|
|
||||||
|
|
||||||
if install:
|
|
||||||
try:
|
|
||||||
# Install metadata.tvdb.com
|
|
||||||
xbmc.executebuiltin('InstallAddon(metadata.tvdb.com)', True)
|
|
||||||
logger.debug("The TVDB series Scraper installed ")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
continuar = (install and xbmc.getCondVisibility('System.HasAddon(metadata.tvdb.com)'))
|
|
||||||
if not continuar:
|
|
||||||
msg_text = config.get_localized_string(60049)
|
|
||||||
if continuar:
|
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(metadata.tvdb.com)', True)
|
|
||||||
|
|
||||||
idPath = 0
|
idPath = 0
|
||||||
idParentPath = 0
|
idParentPath = 0
|
||||||
@@ -776,12 +690,8 @@ def set_content(content_type, silent=False, custom=False):
|
|||||||
if content_type == 'movie':
|
if content_type == 'movie':
|
||||||
strContent = 'movies'
|
strContent = 'movies'
|
||||||
scanRecursive = 2147483647
|
scanRecursive = 2147483647
|
||||||
if seleccion == -1 or seleccion == 0:
|
strScraper = values[seleccion]
|
||||||
strScraper = 'metadata.themoviedb.org'
|
path_settings = xbmc.translatePath(f"special://profile/addon_data/{strScraper}/settings.xml")
|
||||||
path_settings = xbmc.translatePath("special://profile/addon_data/metadata.themoviedb.org/settings.xml")
|
|
||||||
elif seleccion == 1:
|
|
||||||
strScraper = 'metadata.universal'
|
|
||||||
path_settings = xbmc.translatePath("special://profile/addon_data/metadata.universal/settings.xml")
|
|
||||||
if not os.path.exists(path_settings):
|
if not os.path.exists(path_settings):
|
||||||
logger.debug("%s: %s" % (content_type, path_settings + " doesn't exist"))
|
logger.debug("%s: %s" % (content_type, path_settings + " doesn't exist"))
|
||||||
return continuar
|
return continuar
|
||||||
@@ -795,12 +705,8 @@ def set_content(content_type, silent=False, custom=False):
|
|||||||
else:
|
else:
|
||||||
strContent = 'tvshows'
|
strContent = 'tvshows'
|
||||||
scanRecursive = 0
|
scanRecursive = 0
|
||||||
if seleccion == -1 or seleccion == 0:
|
strScraper = values[seleccion]
|
||||||
strScraper = 'metadata.tvshows.themoviedb.org'
|
path_settings = xbmc.translatePath(f"special://profile/addon_data/{strScraper}/settings.xml")
|
||||||
path_settings = xbmc.translatePath("special://profile/addon_data/metadata.tvshows.themoviedb.org/settings.xml")
|
|
||||||
elif seleccion == 1:
|
|
||||||
strScraper = 'metadata.tvdb.com'
|
|
||||||
path_settings = xbmc.translatePath("special://profile/addon_data/metadata.tvdb.com/settings.xml")
|
|
||||||
if not os.path.exists(path_settings):
|
if not os.path.exists(path_settings):
|
||||||
logger.debug("%s: %s" % (content_type, path_settings + " doesn't exist"))
|
logger.debug("%s: %s" % (content_type, path_settings + " doesn't exist"))
|
||||||
return continuar
|
return continuar
|
||||||
@@ -1275,9 +1181,10 @@ def update_sources(new='', old=''):
|
|||||||
|
|
||||||
|
|
||||||
def ask_set_content(silent=False):
|
def ask_set_content(silent=False):
|
||||||
|
# from core.support import dbg;dbg()
|
||||||
logger.debug()
|
logger.debug()
|
||||||
logger.debug("videolibrary_kodi %s" % config.get_setting("videolibrary_kodi"))
|
logger.debug("videolibrary_kodi %s" % config.get_setting("videolibrary_kodi"))
|
||||||
def do_config(custom=False):
|
def do_config(custom=True):
|
||||||
if set_content("movie", True, custom) and set_content("tvshow", True, custom):
|
if set_content("movie", True, custom) and set_content("tvshow", True, custom):
|
||||||
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(70104))
|
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(70104))
|
||||||
config.set_setting("videolibrary_kodi", True)
|
config.set_setting("videolibrary_kodi", True)
|
||||||
@@ -1326,7 +1233,7 @@ def ask_set_content(silent=False):
|
|||||||
# configuration from the settings menu
|
# configuration from the settings menu
|
||||||
else:
|
else:
|
||||||
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80023))
|
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80023))
|
||||||
do_config(False)
|
do_config(True)
|
||||||
|
|
||||||
|
|
||||||
def next_ep(item):
|
def next_ep(item):
|
||||||
|
|||||||
Reference in New Issue
Block a user