Add files via upload

This commit is contained in:
Alex
2018-05-27 19:54:52 +02:00
committed by GitHub
parent 3fe4f99e40
commit 5e49b8b6e1
3 changed files with 22 additions and 5 deletions

View File

@@ -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":

View File

@@ -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

View File

@@ -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