@@ -70,11 +70,33 @@
|
||||
"Toda la videoteca"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "addition",
|
||||
"type": "label",
|
||||
"label": "Añadir a la videoteca",
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "enable_filter",
|
||||
"type": "bool",
|
||||
"label": " Excluir los streams que contienen etiquetas específicas",
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"id": "filters",
|
||||
"type": "text",
|
||||
"label": " Etiquetas",
|
||||
"visible": true,
|
||||
"enabled": "eq(-1,true)"
|
||||
},
|
||||
{
|
||||
"id": "window_type",
|
||||
"type": "list",
|
||||
"label": "Mostrar los enlaces en",
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": [
|
||||
|
||||
@@ -596,7 +596,12 @@ def mark_tvshow_as_updatable(item):
|
||||
|
||||
def delete(item):
|
||||
def delete_all(_item):
|
||||
filetools.rmdirtree(_item.path)
|
||||
for file in filetools.listdir(_item.path):
|
||||
if file.endswith(".strm") or file.endswith(".nfo") or file.endswith(".json"):
|
||||
filetools.remove(filetools.join(_item.path, file))
|
||||
raiz, carpeta_serie, ficheros = filetools.walk(_item.path).next()
|
||||
if ficheros == []:
|
||||
filetools.rmdir(_item.path)
|
||||
|
||||
if config.is_xbmc():
|
||||
import xbmc
|
||||
|
||||
@@ -263,6 +263,7 @@ def get_nfo(item):
|
||||
|
||||
|
||||
def sort_episode_list(episodelist):
|
||||
episodelist.sort(key=lambda e: e.title, reverse=True)
|
||||
scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
|
||||
|
||||
if scraper_actual == "tmdb":
|
||||
|
||||
@@ -458,14 +458,14 @@ def get_season_and_episode(title):
|
||||
"""
|
||||
filename = ""
|
||||
|
||||
patrons = ["(\d+)x(\d+)", "(\d+)×(\d+)", "(?:s|t)(\d+)e(\d+)",
|
||||
"(?:season|temp\w*)\s*(\d+)\s*(?:capitulo|epi\w*)\s*(\d+)"]
|
||||
patrons = ["(\d+)\s*[x-]\s*(\d+)", "(\d+)\s*×\s*(\d+)", "(?:s|t)(\d+)e(\d+)",
|
||||
"(?:season|temp\w*)\s*(\d+)\s*(?:capitulo|epi|episode\w*)\s*(\d+)"]
|
||||
|
||||
for patron in patrons:
|
||||
try:
|
||||
matches = re.compile(patron, re.I).search(title)
|
||||
if matches:
|
||||
filename = matches.group(1) + "x" + matches.group(2).zfill(2)
|
||||
filename = matches.group(1).lstrip('0') + "x" + matches.group(2).zfill(2)
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -123,7 +123,7 @@ def save_movie(item):
|
||||
else:
|
||||
base_name = item.contentTitle
|
||||
|
||||
base_name = unicode(filetools.validate_path(base_name.replace('/', '-')), "utf8").lower().encode("utf8")
|
||||
base_name = unicode(filetools.validate_path(base_name.replace('/', '-')), "utf8").encode("utf8")
|
||||
|
||||
for raiz, subcarpetas, ficheros in filetools.walk(MOVIES_PATH):
|
||||
for c in subcarpetas:
|
||||
@@ -244,7 +244,7 @@ def save_tvshow(item, episodelist):
|
||||
else:
|
||||
base_name = item.contentSerieName
|
||||
|
||||
base_name = unicode(filetools.validate_path(base_name.replace('/', '-')), "utf8").lower().encode("utf8")
|
||||
base_name = unicode(filetools.validate_path(base_name.replace('/', '-')), "utf8").encode("utf8")
|
||||
|
||||
for raiz, subcarpetas, ficheros in filetools.walk(TVSHOWS_PATH):
|
||||
for c in subcarpetas:
|
||||
@@ -348,6 +348,15 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
raiz, carpetas_series, ficheros = filetools.walk(path).next()
|
||||
ficheros = [filetools.join(path, f) for f in ficheros]
|
||||
|
||||
nostrm_episodelist = []
|
||||
for root, folders, files in filetools.walk(path):
|
||||
for file in files:
|
||||
season_episode = scrapertools.get_season_and_episode(file)
|
||||
if season_episode == "" or filetools.exists(filetools.join(path, "%s.strm" % season_episode)):
|
||||
continue
|
||||
nostrm_episodelist.append(season_episode)
|
||||
nostrm_episodelist = sorted(set(nostrm_episodelist))
|
||||
|
||||
# Silent es para no mostrar progreso (para videolibrary_service)
|
||||
if not silent:
|
||||
# progress dialog
|
||||
@@ -356,7 +365,12 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
|
||||
new_episodelist = []
|
||||
# Obtenemos el numero de temporada y episodio y descartamos los q no lo sean
|
||||
tags = []
|
||||
if config.get_setting("enable_filter", "videolibrary"):
|
||||
tags = [x.strip() for x in config.get_setting("filters", "videolibrary").lower().split(",")]
|
||||
for e in episodelist:
|
||||
if tags != [] and tags != None and any(tag in e.title.lower() for tag in tags):
|
||||
continue
|
||||
try:
|
||||
season_episode = scrapertools.get_season_and_episode(e.title)
|
||||
|
||||
@@ -383,6 +397,8 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True):
|
||||
nfo_path = filetools.join(path, "%s.nfo" % season_episode)
|
||||
json_path = filetools.join(path, ("%s [%s].json" % (season_episode, e.channel)).lower())
|
||||
|
||||
if season_episode in nostrm_episodelist:
|
||||
continue
|
||||
strm_exists = strm_path in ficheros
|
||||
nfo_exists = nfo_path in ficheros
|
||||
json_exists = json_path in ficheros
|
||||
|
||||
@@ -352,7 +352,6 @@ def verify_directories_created():
|
||||
config_paths = [["folder_movies", "CINE"],
|
||||
["folder_tvshows", "SERIES"]]
|
||||
|
||||
flag_call = True
|
||||
for path, default in config_paths:
|
||||
saved_path = get_setting(path)
|
||||
|
||||
@@ -365,11 +364,7 @@ def verify_directories_created():
|
||||
logger.debug("Creating %s: %s" % (path, content_path))
|
||||
|
||||
# si se crea el directorio
|
||||
if filetools.mkdir(content_path):
|
||||
if flag_call:
|
||||
# le pasamos el valor para que sepamos que se ha pasado por creación de directorio
|
||||
xbmc_videolibrary.ask_set_content(1)
|
||||
flag_call = False
|
||||
filetools.mkdir(content_path)
|
||||
|
||||
try:
|
||||
from core import scrapertools
|
||||
|
||||
@@ -52,8 +52,8 @@ def run(item=None):
|
||||
else:
|
||||
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
|
||||
if not config.get_setting('show_once'):
|
||||
platformtools.dialog_ok('Alfa', 'Alfa recomienda para mejorar tu experiencia:',
|
||||
'Palomitas, relajate y disfruta.')
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.ask_set_content(1)
|
||||
config.set_setting('show_once', True)
|
||||
|
||||
logger.info(item.tostring())
|
||||
|
||||
@@ -440,102 +440,115 @@ def set_content(content_type, silent=False):
|
||||
videolibrarypath = config.get_setting("videolibrarypath")
|
||||
|
||||
if content_type == 'movie':
|
||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.themoviedb.org)'):
|
||||
if not silent:
|
||||
# Preguntar si queremos instalar metadata.themoviedb.org
|
||||
install = platformtools.dialog_yesno("The Movie Database",
|
||||
"No se ha encontrado el Scraper de películas de TheMovieDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
scraper = ["The Movie Database", "Universal Movie Scraper"]
|
||||
seleccion = platformtools.dialog_select("Seleccione el scraper para las películas", scraper)
|
||||
|
||||
if install:
|
||||
try:
|
||||
# Instalar metadata.themoviedb.org
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.themoviedb.org)', True)
|
||||
logger.info("Instalado el Scraper de películas de TheMovieDB")
|
||||
except:
|
||||
pass
|
||||
# Instalar The Movie Database
|
||||
if seleccion == -1 or seleccion == 0:
|
||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.themoviedb.org)'):
|
||||
if not silent:
|
||||
# Preguntar si queremos instalar metadata.themoviedb.org
|
||||
install = platformtools.dialog_yesno("The Movie Database",
|
||||
"No se ha encontrado el Scraper de películas de TheMovieDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
|
||||
continuar = (install and xbmc.getCondVisibility('System.HasAddon(metadata.themoviedb.org)'))
|
||||
if not continuar:
|
||||
msg_text = "The Movie Database no instalado."
|
||||
if install:
|
||||
try:
|
||||
# Instalar metadata.themoviedb.org
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.themoviedb.org)', True)
|
||||
logger.info("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 = "The Movie Database no instalado."
|
||||
if continuar:
|
||||
xbmc.executebuiltin('xbmc.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:
|
||||
# Preguntar si queremos instalar metadata.universal
|
||||
install = platformtools.dialog_yesno("Universal Movie Scraper",
|
||||
"No se ha encontrado el Scraper de series de TheMovieDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
|
||||
if install:
|
||||
try:
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.universal)', True)
|
||||
if xbmc.getCondVisibility('System.HasAddon(metadata.universal)'):
|
||||
continuar = True
|
||||
except:
|
||||
pass
|
||||
|
||||
continuar = (install and continuar)
|
||||
if not continuar:
|
||||
msg_text = "Universal Movie Scraper no instalado."
|
||||
if continuar:
|
||||
xbmc.executebuiltin('xbmc.addon.opensettings(metadata.universal)', True)
|
||||
|
||||
else: # SERIES
|
||||
scraper = ["The TVDB", "The Movie Database"]
|
||||
seleccion = platformtools.dialog_select("Seleccione el scraper para las series", scraper)
|
||||
|
||||
# Instalar The TVDB
|
||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.tvdb.com)'):
|
||||
if not silent:
|
||||
# Preguntar si queremos instalar metadata.tvdb.com
|
||||
install = platformtools.dialog_yesno("The TVDB",
|
||||
"No se ha encontrado el Scraper de series de The TVDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
if seleccion == -1 or seleccion == 0:
|
||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.tvdb.com)'):
|
||||
if not silent:
|
||||
# Preguntar si queremos instalar metadata.tvdb.com
|
||||
install = platformtools.dialog_yesno("The TVDB",
|
||||
"No se ha encontrado el Scraper de series de The TVDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
|
||||
if install:
|
||||
try:
|
||||
# Instalar metadata.tvdb.com
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.tvdb.com)', True)
|
||||
logger.info("Instalado el Scraper de series de The TVDB")
|
||||
except:
|
||||
pass
|
||||
if install:
|
||||
try:
|
||||
# Instalar metadata.tvdb.com
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.tvdb.com)', True)
|
||||
logger.info("Instalado el Scraper de series de The TVDB")
|
||||
except:
|
||||
pass
|
||||
|
||||
continuar = (install and xbmc.getCondVisibility('System.HasAddon(metadata.tvdb.com)'))
|
||||
if not continuar:
|
||||
msg_text = "The TVDB no instalado."
|
||||
continuar = (install and xbmc.getCondVisibility('System.HasAddon(metadata.tvdb.com)'))
|
||||
if not continuar:
|
||||
msg_text = "The TVDB no instalado."
|
||||
if continuar:
|
||||
xbmc.executebuiltin('xbmc.addon.opensettings(metadata.tvdb.com)', True)
|
||||
|
||||
# Instalar TheMovieDB
|
||||
if continuar and not xbmc.getCondVisibility('System.HasAddon(metadata.tvshows.themoviedb.org)'):
|
||||
continuar = False
|
||||
if not silent:
|
||||
# Preguntar si queremos instalar metadata.tvshows.themoviedb.org
|
||||
install = platformtools.dialog_yesno("The Movie Database",
|
||||
"No se ha encontrado el Scraper de series de TheMovieDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
# Instalar The Movie Database
|
||||
elif seleccion == 1:
|
||||
if continuar and not xbmc.getCondVisibility('System.HasAddon(metadata.tvshows.themoviedb.org)'):
|
||||
continuar = False
|
||||
if not silent:
|
||||
# Preguntar si queremos instalar metadata.tvshows.themoviedb.org
|
||||
install = platformtools.dialog_yesno("The Movie Database",
|
||||
"No se ha encontrado el Scraper de series de TheMovieDB.",
|
||||
"¿Desea instalarlo ahora?")
|
||||
else:
|
||||
install = True
|
||||
|
||||
if install:
|
||||
try:
|
||||
# Instalar metadata.tvshows.themoviedb.org
|
||||
# 1º Probar desde el repositorio ...
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.tvshows.themoviedb.org)', True)
|
||||
if not xbmc.getCondVisibility('System.HasAddon(metadata.tvshows.themoviedb.org)'):
|
||||
# ...si no funciona descargar e instalar desde la web
|
||||
url = "http://mirrors.kodi.tv/addons/jarvis/metadata.tvshows.themoviedb.org/metadata.tvshows.themoviedb.org-1.3.1.zip"
|
||||
path_down = xbmc.translatePath(
|
||||
"special://home/addons/packages/metadata.tvshows.themoviedb.org-1.3.1.zip")
|
||||
path_unzip = xbmc.translatePath("special://home/addons/")
|
||||
header = ("User-Agent",
|
||||
"Kodi/15.2 (Windows NT 10.0; WOW64) App_Bitness/32 Version/15.2-Git:20151019-02e7013")
|
||||
if install:
|
||||
try:
|
||||
# Instalar metadata.tvshows.themoviedb.org
|
||||
xbmc.executebuiltin('xbmc.installaddon(metadata.tvshows.themoviedb.org)', True)
|
||||
if xbmc.getCondVisibility('System.HasAddon(metadata.tvshows.themoviedb.org)'):
|
||||
continuar = True
|
||||
except:
|
||||
pass
|
||||
|
||||
from core import downloadtools
|
||||
from core import ziptools
|
||||
|
||||
downloadtools.downloadfile(url, path_down, continuar=True, headers=[header])
|
||||
unzipper = ziptools.ziptools()
|
||||
unzipper.extract(path_down, path_unzip)
|
||||
xbmc.executebuiltin('UpdateLocalAddons')
|
||||
|
||||
strSettings = '<settings>\n' \
|
||||
' <setting id="fanart" value="true" />\n' \
|
||||
' <setting id="keeporiginaltitle" value="false" />\n' \
|
||||
' <setting id="language" value="es" />\n' \
|
||||
'</settings>'
|
||||
path_settings = xbmc.translatePath(
|
||||
"special://profile/addon_data/metadata.tvshows.themoviedb.org/settings.xml")
|
||||
tv_themoviedb_addon_path = filetools.dirname(path_settings)
|
||||
if not filetools.exists(tv_themoviedb_addon_path):
|
||||
filetools.mkdir(tv_themoviedb_addon_path)
|
||||
if filetools.write(path_settings, strSettings):
|
||||
continuar = True
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
continuar = (install and continuar)
|
||||
if not continuar:
|
||||
msg_text = "The Movie Database no instalado."
|
||||
continuar = (install and continuar)
|
||||
if not continuar:
|
||||
msg_text = "The Movie Database no instalado."
|
||||
if continuar:
|
||||
xbmc.executebuiltin('xbmc.addon.opensettings(metadata.tvshows.themoviedb.org)', True)
|
||||
|
||||
idPath = 0
|
||||
idParentPath = 0
|
||||
@@ -589,26 +602,32 @@ def set_content(content_type, silent=False):
|
||||
# Fijamos strContent, strScraper, scanRecursive y strSettings
|
||||
if content_type == 'movie':
|
||||
strContent = 'movies'
|
||||
strScraper = 'metadata.themoviedb.org'
|
||||
scanRecursive = 2147483647
|
||||
strSettings = "<settings><setting id='RatingS' value='TMDb' /><setting id='certprefix' value='Rated ' />" \
|
||||
"<setting id='fanart' value='true' /><setting id='keeporiginaltitle' value='false' />" \
|
||||
"<setting id='language' value='es' /><setting id='tmdbcertcountry' value='us' />" \
|
||||
"<setting id='trailer' value='true' /></settings>"
|
||||
if seleccion == -1 or seleccion == 0:
|
||||
strScraper = 'metadata.themoviedb.org'
|
||||
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")
|
||||
settings_data = filetools.read(path_settings)
|
||||
strSettings = ' '.join(settings_data.split()).replace("> <", "><")
|
||||
strSettings = strSettings.replace("\"","\'")
|
||||
strActualizar = "¿Desea configurar este Scraper en español como opción por defecto para películas?"
|
||||
if not videolibrarypath.endswith(sep):
|
||||
videolibrarypath += sep
|
||||
strPath = videolibrarypath + config.get_setting("folder_movies") + sep
|
||||
else:
|
||||
strContent = 'tvshows'
|
||||
strScraper = 'metadata.tvdb.com'
|
||||
scanRecursive = 0
|
||||
strSettings = "<settings><setting id='RatingS' value='TheTVDB' />" \
|
||||
"<setting id='absolutenumber' value='false' />" \
|
||||
"<setting id='dvdorder' value='false' />" \
|
||||
"<setting id='fallback' value='true' />" \
|
||||
"<setting id='fanart' value='true' />" \
|
||||
"<setting id='language' value='es' /></settings>"
|
||||
if seleccion == -1 or seleccion == 0:
|
||||
strScraper = 'metadata.tvdb.com'
|
||||
path_settings = xbmc.translatePath("special://profile/addon_data/metadata.tvdb.com/settings.xml")
|
||||
elif seleccion == 1:
|
||||
strScraper = 'metadata.tvshows.themoviedb.org'
|
||||
path_settings = xbmc.translatePath("special://profile/addon_data/metadata.tvshows.themoviedb.org/settings.xml")
|
||||
settings_data = filetools.read(path_settings)
|
||||
strSettings = ' '.join(settings_data.split()).replace("> <", "><")
|
||||
strSettings = strSettings.replace("\"","\'")
|
||||
strActualizar = "¿Desea configurar este Scraper en español como opción por defecto para series?"
|
||||
if not videolibrarypath.endswith(sep):
|
||||
videolibrarypath += sep
|
||||
@@ -655,7 +674,8 @@ def set_content(content_type, silent=False):
|
||||
else:
|
||||
heading = "Videoteca %s configurada" % content_type
|
||||
msg_text = "Felicidades la videoteca de Kodi ha sido configurada correctamente."
|
||||
platformtools.dialog_notification(heading, msg_text, icon=1, time=10000)
|
||||
platformtools.dialog_notification(heading, msg_text, icon=1, time=3000)
|
||||
|
||||
logger.info("%s: %s" % (heading, msg_text))
|
||||
|
||||
|
||||
@@ -805,8 +825,8 @@ def ask_set_content(flag, silent=False):
|
||||
|
||||
if not silent:
|
||||
heading = "Alfa Auto-configuración"
|
||||
linea1 = "¿Desea que Alfa auto-configure la videoteca de Kodi?"
|
||||
linea2 = "Si pulsa 'No' podra hacerlo desde 'Configuración > Preferencia > Rutas'."
|
||||
linea1 = "¿Desea que Alfa auto-configure la videoteca de Kodi? Se le pedirá que configure los scrapers para las películas y las series."
|
||||
linea2 = "Si pulsa 'No', podra hacerlo desde 'Configuración > Preferencia > Rutas'."
|
||||
if platformtools.dialog_yesno(heading, linea1, linea2):
|
||||
do_config()
|
||||
else:
|
||||
|
||||
@@ -23,13 +23,9 @@
|
||||
|
||||
<!-- Path downloads -->
|
||||
<category label="30501">
|
||||
<setting id="path_selection" type="enum" values="Escribir ruta|Examinar ruta" default="0" label="Tipo de ruta"/>
|
||||
<setting id="downloadpath" type="text" label="30017" default="" visible="eq(-1,0)"/>
|
||||
<setting id="downloadpath" type="folder" label="30017" default="" visible="eq(-2,1)"/>
|
||||
<setting id="downloadlistpath" type="text" label="30018" default="" visible="eq(-3,0)"/>
|
||||
<setting id="downloadlistpath" type="folder" label="30018" default="" visible="eq(-4,1)"/>
|
||||
<setting id="videolibrarypath" type="text" label="30067" default="" visible="eq(-5,0)"/>
|
||||
<setting id="videolibrarypath" type="folder" label="30067" default="" visible="eq(-6,1)"/>
|
||||
<setting id="downloadpath" type="folder" label="30017" default=""/>
|
||||
<setting id="downloadlistpath" type="folder" label="30018" default=""/>
|
||||
<setting id="videolibrarypath" type="folder" label="30067" default=""/>
|
||||
|
||||
<setting type="sep"/>
|
||||
<setting label="30131" type="lsep"/>
|
||||
|
||||
Reference in New Issue
Block a user