The branch, frodo has been updated
via 16bdd093b52aad6eedc9a4a1e538c478aaf02c54 (commit)
from 9de74b3d59d86c84db6a7ab21a844e4622e08f5a (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=16bdd093b52aad6eedc9a4a1e538c478aaf02c54
commit 16bdd093b52aad6eedc9a4a1e538c478aaf02c54
Author: amet <[email protected]>
Date: Fri Sep 6 15:32:21 2013 +0400
[script.xbmc.subtitles] -v3.9.14
3.9.14
- [fix] Legendas.TV new layout, gfjardim
- [fix] Some movie filenames were treated as tvshows causing lookup to
fail, arnova
diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 2de80b0..6913c96 100644
--- a/script.xbmc.subtitles/addon.xml
+++ b/script.xbmc.subtitles/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmc.subtitles"
name="XBMC Subtitles"
- version="3.9.13"
+ version="3.9.14"
provider-name="amet, mr_blobby">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
diff --git a/script.xbmc.subtitles/changelog.txt
b/script.xbmc.subtitles/changelog.txt
index 4c294cf..aadad1a 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,7 @@
+3.9.14
+- [fix] Legendas.TV new layout, gfjardim
+- [fix] Some movie filenames were treated as tvshows causing lookup to fail,
arnova
+
3.9.13
- [fix] Fixed Sratim A.K.A Subtitle.co.il service, BBLN
diff --git a/script.xbmc.subtitles/resources/lib/gui.py
b/script.xbmc.subtitles/resources/lib/gui.py
index 94bc615..e177672 100644
--- a/script.xbmc.subtitles/resources/lib/gui.py
+++ b/script.xbmc.subtitles/resources/lib/gui.py
@@ -97,14 +97,18 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.title = normalizeString(xbmc.getInfoLabel("VideoPlayer.Title"))
# no original title, get just Title :)
if self.tvshow == "":
- if str(self.year) == "":
- title, season, episode = regex_tvshow(False, self.title)
- if episode != "":
- self.season = str(int(season))
- self.episode = str(int(episode))
- self.tvshow = title
- else:
- self.title, self.year = xbmc.getCleanMovieTitle( self.title )
+ if str(self.year) == "": # If
we have a year, assume no tv show
+ self.title, self.year = xbmc.getCleanMovieTitle( self.title ) #
Clean before trying tvshow regex, else we get false results on some movies
+ if str(self.year) == "": #
Still no year: *could* be a tvshow
+ title, season, episode = regex_tvshow(False, self.title)
+ if title != "" and season != "" and episode != "":
+ self.season = str(int(season))
+ self.episode = str(int(episode))
+ self.tvshow = title
+ else:
+ self.season = "" #
Reset variables: could contain garbage from tvshow regex above
+ self.episode = ""
+ self.tvshow = ""
else:
self.year = ""
diff --git a/script.xbmc.subtitles/resources/lib/services/LegendasTV/logo.png
b/script.xbmc.subtitles/resources/lib/services/LegendasTV/logo.png
index f18241b..8c1d270 100644
Binary files a/script.xbmc.subtitles/resources/lib/services/LegendasTV/logo.png
and b/script.xbmc.subtitles/resources/lib/services/LegendasTV/logo.png differ
diff --git a/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
b/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
index 4951aab..180710e 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
@@ -2,12 +2,12 @@
# Copyright, 2010, Guilherme Jardim.
# This program is distributed under the terms of the GNU General Public
License, version 3.
# http://www.gnu.org/licenses/gpl.txt
-# Rev. 2.0.1
+# Rev. 2.1.0
from operator import itemgetter
from threading import Thread
from BeautifulSoup import *
-from utilities import *
+from utilities import log, languageTranslate
import cookielib
import math
import os
@@ -26,15 +26,43 @@ else:
# Service variables
sub_ext = 'srt aas ssa sub smi'
-global regex_1, regex_2
-regex_1 = "<span
onmouseover=.*?javascript:abredown\(\'(.*?)\'.*?class=\"mais\"><b>(.*?)<\/b>.*?Avalia.*?<\/b>
(.*?)<\/td>.*?<img src=\'images\/flag_(..).gif.*?<span
class=\"brls\">(.*?)<\/span>"
-regex_2 = "<a class=\"paginacaoatual\" href=\".*\">.*</a>\s+<a
class=\"paginacao\" href=\".*\">(.*)</a>"
+global regex_1, regex_2, regex_3
+regex_1 = "<div class=\"f_left\"><p><a href=\"([^\"]*)\">([^<]*)</a></p><p
class=\"data\">.*?downloads, nota (\d*?),.*?<img .*? title=\"([^\"]*)\"
/></div>"
+regex_2 = "<button class=\"ajax\"
data-href=\"/util/carrega_legendas_busca/id_filme:\d*/page:\d*\">(\d*)</button>"
+regex_3 = "<button class=\"icon_arrow\" onclick=\"window.open\(\'([^\']*?)\',
\'_self\'\)\">DOWNLOAD</button>"
# XBMC specific variables
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
__addon__ = sys.modules[ "__main__" ].__addon__
+def XBMC_OriginalTitle(OriginalTitle):
+ json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Player.GetItem", "params": {
"playerid": 1} ,"id":1}' )
+ json_player_getitem = simplejson.loads(unicode(json_query, 'utf-8',
errors='ignore'))
+# self.Log("JSON_RPC: %s" % (json_player_getitem))
+ if json_player_getitem.has_key('result') and
json_player_getitem['result'].has_key('item') and
json_player_getitem['result']['item'].has_key('id') and
json_player_getitem['result']['item'].has_key('type'):
+ if json_player_getitem['result']['item']['type'] == "movie":
+ json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetMovieDetails",
"params": { "movieid": %s, "properties": ["originaltitle"]} ,"id":1}' %
(json_player_getitem['result']['item']['id']) )
+ json_getmoviedetails = simplejson.loads(unicode(json_query,
'utf-8', errors='ignore'))
+# self.Log("JSON_RPC: %s" % (json_getmoviedetails))
+ if json_getmoviedetails.has_key('result') and
json_getmoviedetails['result'].has_key('moviedetails') and
json_getmoviedetails['result']['moviedetails'].has_key('originaltitle'):
+ OriginalTitle =
json_getmoviedetails['result']['moviedetails']['originaltitle']
+ elif json_player_getitem['result']['item']['type'] == "episode":
+ json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetEpisodeDetails",
"params": { "episodeid": %s, "properties": ["originaltitle", "tvshowid"]}
,"id":1}' % (json_player_getitem['result']['item']['id']) )
+ json_getepisodedetails = simplejson.loads(unicode(json_query,
'utf-8', errors='ignore'))
+# self.Log("JSON_RPC: %s" % (json_getepisodedetails))
+ if json_getepisodedetails.has_key('result') and
json_getepisodedetails['result'].has_key('episodedetails') and
json_getepisodedetails['result']['episodedetails'].has_key('tvshowid'):
+ json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShowDetails",
"params": { "tvshowid": %s, "properties": ["originaltitle", "imdbnumber"]}
,"id":1}' % (json_getepisodedetails['result']['episodedetails']['tvshowid']) )
+ json_gettvshowdetails = simplejson.loads(unicode(json_query,
'utf-8', errors='ignore'))
+# self.Log("JSON_RPC: %s" % (json_gettvshowdetails))
+ if json_gettvshowdetails.has_key('result') and
json_gettvshowdetails['result'].has_key('tvshowdetails') and
json_gettvshowdetails['result']['tvshowdetails'].has_key('imdbnumber'):
+ thetvdb =
json_gettvshowdetails['result']['tvshowdetails']['imdbnumber']
+ HTTPResponse =
urllib2.urlopen("http://www.thetvdb.com//data/series/"+str(thetvdb)+"/").read()
+ if re.findall("<SeriesName>(.*?)</SeriesName>",
HTTPResponse, re.IGNORECASE | re.DOTALL):
+ OriginalTitle =
re.findall("<SeriesName>(.*?)</SeriesName>", HTTPResponse, re.IGNORECASE |
re.DOTALL)[0]
+ OriginalTitle = OriginalTitle.encode('ascii', 'replace')
+ return OriginalTitle
+
class LTVThread(Thread):
def __init__ (self, obj, count, main_id, page):
Thread.__init__(self)
@@ -66,10 +94,10 @@ class LegendasTV:
self.cookie = cookielib.CookieJar()
opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))
urllib2.install_opener(opener)
- login_data = urllib.urlencode({'txtLogin':username,
'txtSenha':password})
- request =
urllib2.Request("http://legendas.tv/login_verificar.php", login_data)
- response = urllib2.urlopen(request).read()
- if response.__contains__('Dados incorretos'):
+ login_data = urllib.urlencode({'_method':'POST',
'data[User][username]':username, 'data[User][password]':password})
+ request = urllib2.Request("http://minister.legendas.tv/login/",
login_data)
+ response = self._UNICODE(urllib2.urlopen(request).read())
+ if response.__contains__(u'Usuário ou senha inválidos'):
self.Log( u" Login Failed. Check your data at the addon
configuration.")
return 0
else:
@@ -86,7 +114,7 @@ class LegendasTV:
def CleanLTVTitle(self, s):
s = re.sub("[(]?[0-9]{4}[)]?$", "", s)
- s = re.sub("[ ]?&[ ]?", " and ", s)
+ s = re.sub("[ ]?&[ ]?", " ", s)
s = re.sub("'", " ", s)
s = self.chomp(s)
s = s.title()
@@ -108,14 +136,14 @@ class LegendasTV:
Paradigm, Guess = b, a
if len(Paradigm.split(" ")):
for Term in Paradigm.split(" "):
- if re.search("(^|\s)%s(\s|$)" % Term, Guess, re.I):
+ if re.search(r"(^|\s)%s(\s|$)" % re.escape(Term), Guess, re.I):
counter += 1
if counter:
Ratio = "%.2f" % (float(counter) / float(len(Paradigm.split("
"))))
else:
Ratio = "%.2f" % float(0)
else:
- if re.search("(^|\s)%s(\s|$)" % Paradigm, Guess, re.I):
+ if re.search("(^|\s)%s(\s|$)" % re.escape(Paradigm), Guess, re.I):
Ratio = "%.2f" % float(1)
else:
Ratio = "%.2f" % float(0)
@@ -150,64 +178,28 @@ class LegendasTV:
break
self.Log(" ")
return 0
-
- def XBMC_OriginalTitle(self, OriginalTitle):
- json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Player.GetItem", "params": {
"playerid": 1} ,"id":1}' )
- json_player_getitem = simplejson.loads(unicode(json_query, 'utf-8',
errors='ignore'))
-# self.Log("JSON_RPC: %s" % (json_player_getitem))
- if json_player_getitem.has_key('result') and
json_player_getitem['result'].has_key('item') and
json_player_getitem['result']['item'].has_key('id') and
json_player_getitem['result']['item'].has_key('type'):
- if json_player_getitem['result']['item']['type'] == "movie":
- json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetMovieDetails",
"params": { "movieid": %s, "properties": ["originaltitle"]} ,"id":1}' %
(json_player_getitem['result']['item']['id']) )
- json_getmoviedetails = simplejson.loads(unicode(json_query,
'utf-8', errors='ignore'))
-# self.Log("JSON_RPC: %s" % (json_getmoviedetails))
- if json_getmoviedetails.has_key('result') and
json_getmoviedetails['result'].has_key('moviedetails') and
json_getmoviedetails['result']['moviedetails'].has_key('originaltitle'):
- OriginalTitle =
json_getmoviedetails['result']['moviedetails']['originaltitle']
- elif json_player_getitem['result']['item']['type'] == "episode":
- json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetEpisodeDetails",
"params": { "episodeid": %s, "properties": ["originaltitle", "tvshowid"]}
,"id":1}' % (json_player_getitem['result']['item']['id']) )
- json_getepisodedetails = simplejson.loads(unicode(json_query,
'utf-8', errors='ignore'))
-# self.Log("JSON_RPC: %s" % (json_getepisodedetails))
- if json_getepisodedetails.has_key('result') and
json_getepisodedetails['result'].has_key('episodedetails') and
json_getepisodedetails['result']['episodedetails'].has_key('tvshowid'):
- json_query =
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShowDetails",
"params": { "tvshowid": %s, "properties": ["originaltitle", "imdbnumber"]}
,"id":1}' % (json_getepisodedetails['result']['episodedetails']['tvshowid']) )
- json_gettvshowdetails =
simplejson.loads(unicode(json_query, 'utf-8', errors='ignore'))
-# self.Log("JSON_RPC: %s" % (json_gettvshowdetails))
- if json_gettvshowdetails.has_key('result') and
json_gettvshowdetails['result'].has_key('tvshowdetails') and
json_gettvshowdetails['result']['tvshowdetails'].has_key('imdbnumber'):
- thetvdb =
json_gettvshowdetails['result']['tvshowdetails']['imdbnumber']
- HTTPResponse =
urllib2.urlopen("http://www.thetvdb.com//data/series/"+str(thetvdb)+"/").read()
- if re.findall("<SeriesName>(.*?)</SeriesName>",
HTTPResponse, re.IGNORECASE | re.DOTALL):
- OriginalTitle =
re.findall("<SeriesName>(.*?)</SeriesName>", HTTPResponse, re.IGNORECASE |
re.DOTALL)[0]
- OriginalTitle = self._UNICODE(OriginalTitle)
- self.Log("Original title: %s" % OriginalTitle)
- OriginalTitle = OriginalTitle.encode('ascii', 'replace')
- OriginalTitle = self.CleanLTVTitle(OriginalTitle)
- return OriginalTitle
def findID(self, Movie, TVShow, Year, Season, SearchTitle, SearchString):
allResults, discardedResults, filteredResults, LTVSeason, LTVYear =
[], [], [], 0, 0
- Response =
urllib2.urlopen("http://legendas.tv/funcao_lista_filme.php?busca="
+urllib.quote_plus(SearchString)).read()
+ Response =
urllib2.urlopen("http://minister.legendas.tv/util/busca_titulo/" +
urllib.quote_plus(SearchString)).read()
+ Response = simplejson.loads(unicode(Response, 'utf-8',
errors='ignore'))
# Load the results
# Parse and filter the results
self.Log("Message: Searching for movie/tvshow list with term(s): [%s]"
% SearchString)
- for ContentID, ContentTitle in re.findall("<option
value=\"(\d*?)\">([^<]*?)</option>", Response):
- # Discard bogus results
- if int(ContentID) == 9999999999: continue
- # Search and filter for tvshows or movies
- regex = "(\d{4})(.*?)(\d{1,2})[a-zA-Z]{2} [Ss]eason"
- if re.search(regex, ContentTitle) and TVShow:
- LTVYear, LTVTitle, LTVSeason = re.findall(regex,
ContentTitle)[0]
- elif re.search("(\d{4}) - (.*)", ContentTitle):
- LTVYear, LTVTitle = re.findall("(\d{4}) - (.*)",
ContentTitle)[0]
- LTVSeason = 0
- else:
- continue
- LTVTitle = self._UNICODE(LTVTitle)
- LTVTitle = self.CleanLTVTitle(LTVTitle)
- # Calculate the probability ratio and append the result
- Ratio = self.CalculateRatio(LTVTitle, SearchTitle)
- allResults.append({"id" : ContentID, "title" : LTVTitle, "ratio" :
Ratio, "year" : LTVYear, "season" : LTVSeason})
+ for R in Response:
+ if R.has_key('Filme') and R['Filme'].has_key('dsc_nome'):
+ LTVTitle = R['Filme']['dsc_nome']
+ TitleBR = R['Filme']['dsc_nome_br']
+ if re.findall(".*? - (\d{1,2}).*", TitleBR):
+ LTVSeason = re.findall(".*? - (\d{1,2}).*", TitleBR)[0]
+ ContentID = R['Filme']['id_filme']
+ # Calculate the probability ratio and append the result
+ Ratio = self.CalculateRatio(LTVTitle, SearchTitle)
+ allResults.append({"id" : ContentID, "title" : LTVTitle,
"ratio" : Ratio, "year" : LTVYear, "season" : LTVSeason})
# Return if there are no results
if not len(allResults):
self.Log("Message: The search [%s] didn't returned viable
results." % SearchString)
- return "",""
+ return "", ""
# Filter tvshows for season or movies by year
else:
allResults = sorted(allResults, key=lambda k: k["ratio"],
reverse=True)
@@ -224,7 +216,8 @@ class LegendasTV:
else:
discardedResults.append(Result)
elif Movie:
- if abs(int(Result["year"]) - int(Year)) <= 1 and
math.fabs(float(Result["ratio"]) - float(allResults[0]["ratio"])) <= 0.25:
+# if abs(int(Result["year"]) - int(Year)) <= 1 and
math.fabs(float(Result["ratio"]) - float(allResults[0]["ratio"])) <= 0.25:
+ if math.fabs(float(Result["ratio"]) -
float(allResults[0]["ratio"])) <= 0.25:
filteredResults.append(Result)
else:
discardedResults.append(Result)
@@ -247,7 +240,7 @@ class LegendasTV:
# Log the page download attempt.
self.Log("Message: Retrieving page [%s] for Movie[%s], Id[%s]." %
(Page, MainID["title"], MainID["id"]))
- Response =
urllib2.urlopen("http://legendas.tv/index.php?opcao=buscarlegenda&filme=%s&pagina=%s"
% (MainID["id"], Page)).read()
+ Response =
urllib2.urlopen("http://minister.legendas.tv/util/carrega_legendas_busca/page:%s/id_filme:%s"
% (Page, MainID["id"])).read()
if not re.findall(regex_1, Response, re.IGNORECASE | re.DOTALL):
self.Log("Error: Failed retrieving page [%s] for Movie[%s],
Id[%s]." % (Page, MainID["title"], MainID["id"]))
@@ -256,19 +249,17 @@ class LegendasTV:
LanguageName, LanguageFlag, LanguagePreference = "", "", 0
download_id = content[0]
title = self._UNICODE(content[1])
- release = self._UNICODE(content[4])
- if re.search("\d*/10", content[2]):
- rating = re.findall("(\d*)/10", content[2])[0]
- else:
- rating = "0"
- if content[3] == "br": LanguageId = "pb"
- elif content[3] == "pt": LanguageId = "pt"
- elif content[3] == "us": LanguageId = "en"
- elif content[3] == "es": LanguageId = "es"
- elif content[3] == "fr": LanguageId = "fr"
+ release = self._UNICODE(content[1])
+ rating = content[2]
+ lang = self._UNICODE(content[3])
+ if lang == u"Português-BR": LanguageId = "pb"
+ elif lang == u"Português-PT": LanguageId = "pt"
+ elif lang == u"Inglês": LanguageId = "en"
+ elif lang == u"Espanhol": LanguageId = "es"
+ elif lang == u"Francês": LanguageId = "fr"
else: continue
for Preference, LangName in self.Languages:
- if LangName == languageTranslate(LanguageId,2,0):
+ if LangName == languageTranslate(LanguageId, 2, 0):
LanguageName = LangName
LanguageFlag = "flags/%s.gif" % LanguageId
LanguagePreference = Preference
@@ -308,20 +299,10 @@ class LegendasTV:
if key == "lang2" and value: self.Languages.append((1, value))
if key == "lang3" and value: self.Languages.append((2, value))
self.Languages.sort()
- ## Correct parsed values, grab original tvshow name/movie title, and
allow manual search to be done
- if sys.modules[ "__main__" ].ui.man_search_str:
- if re.findall("(.*?)[Ss](\d{1,2})[Ee](\d{1,2})", Movie):
- TVShow, Season, Episode =
re.findall("(.*?)[Ss](\d{1,2})[Ee](\d{1,2})", Movie)[0]
- TVShow = self.CleanLTVTitle(self._UNICODE(TVShow))
- Season, Episode = int(Season), int(Episode)
- Movie = ""
- elif Movie:
- Movie = self.XBMC_OriginalTitle(Movie)
- elif TVShow:
- TVShow = self.XBMC_OriginalTitle(TVShow)
+
if Movie: SearchTitle = Movie
else: SearchTitle = TVShow
-
+ discardedResults, filteredResults = "", ""
# Searching for movie titles/tvshow ids using the lengthiest words
if len(SearchTitle.split(" ")):
for SearchString in sorted(SearchTitle.split(" "), key=len,
reverse=True):
@@ -341,15 +322,13 @@ class LegendasTV:
elif not filteredResults:
return ""
# Initiate the "buscalegenda" search to search for all types and
languages
- search_data = urllib.urlencode({'txtLegenda':"-=-=-=-=-",
'selTipo':'1', 'int_idioma':'99'})
- request =
urllib2.Request("http://legendas.tv/index.php?opcao=buscarlegenda&filme=1",
search_data)
- Response = urllib2.urlopen(request).read()
MainIDNumber = 1
for MainID in filteredResults[0:4]:
# Find how much pages are to download
self.Log("Message: Retrieving results to id[%s]" % (MainID["id"]))
- Response =
urllib2.urlopen("http://legendas.tv/funcao_lista_legenda.php?f=%s" %
(MainID["id"])).read()
- TotalPages = int(math.ceil(len(re.findall("<img
src=[^>]*>([^<]*)</span></td>", Response))/20.0))
+ Response =
urllib2.urlopen("http://minister.legendas.tv/util/carrega_legendas_busca/page:%s/id_filme:%s"
% ("1", MainID["id"])).read()
+ regResponse = re.findall(regex_2, Response)
+ TotalPages = len(regResponse) +1
# Form and execute threaded downloads
for Page in range(TotalPages):
Page += 1
@@ -360,7 +339,6 @@ class LegendasTV:
# Wait for all threads to finish
for t in self.RegThreads:
t.join()
-
# Sorting and filtering the results by episode, including season packs
self.DownloadsResults = sorted(self.DownloadsResults,
key=itemgetter('main_id_number', 'page', 'position'))
IncludedResults = []
@@ -385,13 +363,13 @@ class LegendasTV:
IncludedResults.extend(self.DownloadsResults)
IncludedResults = sorted(IncludedResults,
key=itemgetter('language_preference'))
- ## Log final results
+ # # Log final results
self.Log(" ")
self.Log("Included results:")
self._log_List_dict(IncludedResults, "filename language_name
language_preference ID")
self.Log("Excluded results:")
self._log_List_dict(ExcludedResult, "filename language_name
language_preference ID")
- self.Log("Message: The service took %s seconds to complete." %
(time.time()-startTime))
+ self.Log("Message: The service took %s seconds to complete." %
(time.time() - startTime))
# Return results
return IncludedResults
@@ -403,6 +381,8 @@ def search_subtitles(file_original_path, title, tvshow,
year, season, episode, s
global LTV
LTV = LegendasTV()
subtitles = ""
+ if len(title): title = XBMC_OriginalTitle(title)
+ elif len(tvshow): tvshow = XBMC_OriginalTitle(tvshow)
cookie = LTV.login(__addon__.getSetting( "LTVuser" ),
__addon__.getSetting( "LTVpass" ))
if cookie:
subtitles = LTV.Search(movie=title, tvshow=tvshow, year=year,
season=season,
@@ -416,23 +396,22 @@ def search_subtitles(file_original_path, title, tvshow,
year, season, episode, s
return "", "", _( 755 ).encode('utf-8')
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir,
sub_folder, session_id): #standard input
-
#Create some variables
subtitle = ""
extract_path = os.path.join(tmp_sub_dir, "extracted")
id = subtitles_list[pos][ "ID" ]
language = subtitles_list[pos][ "language_name" ]
legendas_tmp = []
-
# Download the subtitle using its ID.
- request = urllib2.Request("http://legendas.tv/info.php?d=%s&c=1" % id)
- response = urllib2.urlopen(request)
+ Response = urllib2.urlopen("http://minister.legendas.tv%s" % id).read()
+ downloadID = re.findall(regex_3, Response)[0] if re.search(regex_3,
Response) else 0
+ if not downloadID: return ""
+ response = urllib2.urlopen(urllib2.Request("http://minister.legendas.tv%s"
% downloadID))
ltv_sub = response.read()
-
# Set the path of file concatenating the temp dir, the subtitle ID and a
zip or rar extension.
# Write the subtitle in binary mode.
- fname = os.path.join(tmp_sub_dir,str(id))
- if response.info().get('Content-Type').__contains__('rar'):
+ fname = os.path.join(tmp_sub_dir,"subtitle")
+ if response.info().get("Content-Disposition").__contains__('rar'):
fname += '.rar'
else:
fname += '.zip'
-----------------------------------------------------------------------
Summary of changes:
script.xbmc.subtitles/addon.xml | 2 +-
script.xbmc.subtitles/changelog.txt | 4 +
script.xbmc.subtitles/resources/lib/gui.py | 20 ++-
.../resources/lib/services/LegendasTV/logo.png | Bin 25134 -> 6407 bytes
.../resources/lib/services/LegendasTV/service.py | 181 +++++++++-----------
5 files changed, 97 insertions(+), 110 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons