From fdfce8e3b270efa7889ddda8f66389253b481265 Mon Sep 17 00:00:00 2001 From: markkkun Date: Fri, 23 May 2014 21:43:39 +0000 Subject: [PATCH 1/2] Various fixes in subtitlos.es plugin - Fixed bug in the search of the download links. - Fixed the re used to compare tems and subteams. - Added Galego in languages. - Now Spanish (from Spain) and Spanish (from latin america) have been differntiated --- periscope/plugins/Subtitulos.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/periscope/plugins/Subtitulos.py b/periscope/plugins/Subtitulos.py index 20846c4..b3e8c14 100644 --- a/periscope/plugins/Subtitulos.py +++ b/periscope/plugins/Subtitulos.py @@ -30,11 +30,12 @@ u"French" : "fr", u"Brazilian" : "pt-br", u"Portuguese" : "pt", - u"Español (Latinoamérica)" : "es", - u"Español (España)" : "es", + u"Español (Latinoamérica)" : "es-la", + u"Español (España)" : "es-es", u"Español" : "es", u"Italian" : "it", - u"Català" : "ca"} + u"Català" : "ca", + u"Galego" : "ga"} class Subtitulos(SubtitleDatabase.SubtitleDB): url = "http://www.subtitulos.es" @@ -45,7 +46,6 @@ def __init__(self, config, cache_folder_path): #http://www.subtitulos.es/dexter/4x01 self.host = "http://www.subtitulos.es" self.release_pattern = re.compile("Versión (.+) ([0-9]+).([0-9])+ megabytes") - def process(self, filepath, langs): ''' main method to call on the plugin, pass the filename and the wished @@ -71,8 +71,8 @@ def query(self, name, season, episode, teams, langs=None): for subs in soup("div", {"id":"version"}): version = subs.find("p", {"class":"title-sub"}) subteams = self.release_pattern.search("%s"%version.contents[1]).group(1).lower() - teams = set(teams) - subteams = self.listTeams([subteams], [".", "_", " ", "/"]) + teams = self.listTeams(teams, [".", "_", " ", "/", "-"]) + subteams = self.listTeams([subteams], [".", "_", " ", "/", "-"]) log.debug("Team from website: %s" %subteams) log.debug("Team from file: %s" %teams) @@ -81,16 +81,16 @@ def query(self, name, season, episode, teams, langs=None): for lang_html in nexts: langLI = lang_html.findNext("li",{"class":"li-idioma"} ) lang = self.getLG(langLI.find("strong").contents[0].string.strip()) - - statusLI = lang_html.findNext("li",{"class":"li-estado green"} ) + + statusLI = lang_html.findNext("li",{"class":re.compile("li-estado.*")} ) status = statusLI.contents[0].string.strip() - link = statusLI.findNext("span", {"class":"descargar green"}).find("a")["href"] + link = statusLI.findNext("span", {"class":re.compile("descargar.*")}) if status == "Completado" and subteams.issubset(teams) and (not langs or lang in langs) : result = {} result["release"] = "%s.S%.2dE%.2d.%s" %(name.replace("-", ".").title(), int(season), int(episode), '.'.join(subteams)) result["lang"] = lang - result["link"] = link + result["link"] = link.find("a")["href"] result["page"] = searchurl sublinks.append(result) From c499f74db8f654d811f4bdd2cf189a50111cb14f Mon Sep 17 00:00:00 2001 From: markkkun Date: Fri, 23 May 2014 22:04:59 +0000 Subject: [PATCH 2/2] Search "-l es" now look in both type of spanish languages (latin and spain) --- periscope/plugins/Subtitulos.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/periscope/plugins/Subtitulos.py b/periscope/plugins/Subtitulos.py index b3e8c14..4a3c4fc 100644 --- a/periscope/plugins/Subtitulos.py +++ b/periscope/plugins/Subtitulos.py @@ -53,6 +53,12 @@ def process(self, filepath, langs): fname = unicode(self.getFileName(filepath).lower()) guessedData = self.guessFileData(fname) if guessedData['type'] == 'tvshow': + + if "es" in langs: + langs.append("es-es") + langs.append("es-la") + + log.debug("Languagess choosen: %s" % langs) subs = self.query(guessedData['name'], guessedData['season'], guessedData['episode'], guessedData['teams'], langs) return subs else: