The branch, frodo has been updated
via 18cc86aec8e3aefe76396b1fd01def0988eca359 (commit)
from a4bc61997ba519ec248d60a8e4b44ea48fe1ec2e (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=18cc86aec8e3aefe76396b1fd01def0988eca359
commit 18cc86aec8e3aefe76396b1fd01def0988eca359
Author: amet <amet.nos...@gmail.com>
Date: Thu Nov 28 00:28:23 2013 +0400
[script.xbmc.subtitles] -v3.9.16
3.9.16
- Fix Torec support, thx barbedino
- Fixed broken support for Ondertitel subtitle provider, Robby Holsteyns
- [fix] download subs from titulky.com (manual cookies handling),Andrew Beam
- titulky.com - notification about invalid captcha text,Andrew Beam
- LegendasDivx.com, Fix for latin characters. Connor McLeod
- Update GomTV service.py, neverdoubt
- Fix RegieLive subtitles service, Edex
- fix SubtitulosES, tuxitos
- Update service.py, reg exp updated, Tux Os
diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index be9fb78..266f033 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.15"
+ version="3.9.16"
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 0a41d9a..96904a9 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,15 @@
+3.9.16
+- Fix Torec support, thx barbedino
+- Fixed broken support for Ondertitel subtitle provider, Robby Holsteyns
+- [fix] download subs from titulky.com (manual cookies handling),Andrew Beam
+- titulky.com - notification about invalid captcha text,Andrew Beam
+- LegendasDivx.com, Fix for latin characters. Connor McLeod
+- Update GomTV service.py, neverdoubt
+- Fix RegieLive subtitles service, Edex
+- fix SubtitulosES, tuxitos
+- Update service.py, reg exp updated, Tux Os
+-
+
3.9.15
- update regex for Tv Shows (Season 01 Episode 02)
- add support for Malay language
diff --git a/script.xbmc.subtitles/resources/lib/services/GomTV/service.py
b/script.xbmc.subtitles/resources/lib/services/GomTV/service.py
index c544fdf..fc375d6 100644
--- a/script.xbmc.subtitles/resources/lib/services/GomTV/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/GomTV/service.py
@@ -4,6 +4,7 @@ import sys
import os
import urllib2
import re
+import xbmc, xbmcgui, xbmcvfs
from BeautifulSoup import BeautifulSoup
from utilities import log, languageTranslate
from utilities import hashFileMD5
@@ -17,12 +18,25 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
msg = ""
log(__name__, "Search GomTV with a file name, "+file_original_path)
- video_hash = hashFileMD5( file_original_path, buff_size=1024*1024 )
+ movieFullPath = xbmc.Player().getPlayingFile()
+ video_hash = hashFileMD5( movieFullPath, buff_size=1024*1024 )
if video_hash is None:
msg = _(755)
return subtitles_list, "", msg #standard output
webService = GomTvWebService()
- subtitles_list = webService.SearchSubtitles( video_hash )
+ if len(tvshow) > 0: # TvShow
+ OS_search_string = ("%s S%.2dE%.2d" % (tvshow,
+ int(season),
+ int(episode),)
+ ).replace(" ","+")
+ else: # Movie or
not in Library
+ if str(year) == "": # Not in
Library
+ title, year = xbmc.getCleanMovieTitle( title )
+ else: # Movie
in Library
+ year = year
+ title = title
+ OS_search_string = title.replace(" ","+")
+ subtitles_list = webService.SearchSubtitlesFromTitle( OS_search_string
,video_hash)
log(__name__, "Found %d subtitles in GomTV" %len(subtitles_list))
return subtitles_list, "", msg #standard output
@@ -43,7 +57,7 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
f.close()
except:
return False, language, ""
- return True, language, tmp_fname #standard output
+ return False, language, tmp_fname #standard output
class GomTvWebService:
root_url = "http://gom.gomtv.com"
@@ -52,7 +66,9 @@ class GomTvWebService:
def __init__ (self):
pass
- def SearchSubtitles (self, key):
+
+ def SearchSubtitlesFromTitle (self, searchString,key):
+ subtitles = []
subtitles = []
q_url = "http://gom.gomtv.com/jmdb/search.html?key=%s" %key
@@ -74,21 +90,29 @@ class GomTvWebService:
req = urllib2.Request(q_url)
req.add_header("User-Agent", self.agent_str)
html = urllib2.urlopen(req).read()
+ elif "<script>top.location.replace" in html:
+ log(__name__, "redirected")
+ if "key=';</script>" in html:
+ log(__name__, "fail to search with given key")
+ return []
+ q_url = self.parseRedirectionPage(html)
+ req = urllib2.Request(q_url)
+ req.add_header("User-Agent", self.agent_str)
+ html = urllib2.urlopen(req).read()
# regular search result page
soup = BeautifulSoup(html)
subtitles = []
- for row in soup.find("table",{"class":"smi_list"}).findAll("tr")[1:]:
+ for row in soup.find("table",{"class":"tbl_lst"}).findAll("tr")[1:]:
a_node = row.find("a")
if a_node is None:
- continue
+ continue
title = a_node.text
+ lang_node_string = row.find("span",{"class":"txt_clr3"}).string
url = self.root_url + a_node["href"]
- if title.startswith(u"[íê¸]"):
+ if u"íê¸" in lang_node_string:
langlong = "Korean"
- title = title[4:]
- elif title.startswith(u"[ì문]"):
+ elif u"ì문" in lang_node_string:
langlong = "English"
- title = title[4:]
else: # [íµí©]
langlong = "Korean"
langshort = languageTranslate(langlong, 0, 2)
@@ -102,19 +126,85 @@ class GomTvWebService:
"language_name" : langlong,
"language_flag" : "flags/%s.gif" %langshort
} )
+
+ q_url =
"http://gom.gomtv.com/main/index.html?ch=subtitles&pt=l&menu=subtitles&lang=0&sValue=%s"
%searchString
+ print q_url
+ log(__name__, "search subtitle at %s" %q_url)
+
+ # main page
+ req = urllib2.Request(q_url)
+ req.add_header("User-Agent", self.agent_str)
+ html = urllib2.urlopen(req).read()
+ if "<div id='search_failed_smi'>" in html:
+ log(__name__, "no result found")
+ return []
+ elif "<script>location.href" in html:
+ log(__name__, "redirected")
+ if "key=';</script>" in html:
+ log(__name__, "fail to search with given key")
+ return []
+ q_url = self.parseRedirectionPage(html)
+ req = urllib2.Request(q_url)
+ req.add_header("User-Agent", self.agent_str)
+ html = urllib2.urlopen(req).read()
+ elif "<script>top.location.replace" in html:
+ log(__name__, "redirected")
+ if "key=';</script>" in html:
+ log(__name__, "fail to search with given key")
+ return []
+ q_url = self.parseRedirectionPage(html)
+ req = urllib2.Request(q_url)
+ req.add_header("User-Agent", self.agent_str)
+ html = urllib2.urlopen(req).read()
+ # regular search result page
+ soup = BeautifulSoup(html)
+ for row in soup.find("table",{"class":"tbl_lst"}).findAll("tr")[1:]:
+ if row is None:
+ continue
+ a_node = row.find("a")
+ if a_node is None:
+ continue
+ title = a_node.text
+ lang_node_string = row.find("span",{"class":"txt_clr3"}).string
+ url = self.root_url + a_node["href"]
+ if u"íê¸" in lang_node_string:
+ langlong = "Korean"
+ elif u"ì문" in lang_node_string:
+ langlong = "English"
+ else: # [íµí©]
+ langlong = "Korean"
+ langshort = languageTranslate(langlong, 0, 2)
+ subtitles.append( {
+ "link" : url,
+ "filename" : title,
+ "ID" : key,
+ "format" : "smi",
+ "sync" : False,
+ "rating" : "0",
+ "language_name" : langlong,
+ "language_flag" : "flags/%s.gif" %langshort
+ } )
return subtitles
def parseRedirectionPage(self, html):
- match = re.match('''<script>location.href = '([^']*)';</script>''',
html)
- if match is None:
- raise UnknownFormat
- url = match.group(1)
+ url = re.split("\'",html)[1]
if 'noResult' in url: # no result (old style)
print "Unusual result page, "+page_url
return subtitles
- return self.root_url+'/jmdb/'+url
+ return self.root_url+url
def GetSubtitleUrl (self, page_url):
html = urllib2.urlopen(page_url).read()
- downids =
re.search('''javascript:save[^\(]*\('(\d+)','(\d+)','[^']*'\);''',
html).group(1,2)
- return self.root_url+"/jmdb/save.html?intSeq=%s&capSeq=%s" %downids
+ sp2 = ""
+ if "a href=\"jamak://gom.gomtv.com" in html:
+ sp = re.split("a href=\"jamak://gom.gomtv.com",html)[1]
+ sp2 = re.split("\"",sp)[0]
+ elif "onclick=\"downJm(" in html:
+ s1 = re.split("onclick=\"downJm",html)[1]
+ intSeq = re.split("'",s1)[1]
+ capSeq = re.split("'",s1)[3]
+ sp2 =
"/main/index.html?pt=down&ch=subtitles&intSeq="+intSeq+"&capSeq="+capSeq
+ else:
+ return None
+ print sp2
+ return self.root_url+sp2
diff --git
a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
index 409cb97..0429b69 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
@@ -69,8 +69,9 @@
# Filtering languages, shows only European Portuguese flag.
# LegendasDivx.com subtitles, based on a mod of Undertext subtitles
-import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib,
shutil, fnmatch, uuid
+import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib,
shutil, fnmatch, uuid, xbmcvfs
from utilities import languageTranslate, log
+from BeautifulSoup import *
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
__addon__ = sys.modules[ "__main__" ].__addon__
@@ -130,10 +131,10 @@ subtitle_pattern =
"<div\sclass=\"sub_box\">[\r\n\t]{2}<div\sclass=\"sub_header\
# Functions
#====================================================================================================================
def _from_utf8(text):
- if isinstance(text, str):
- return text.decode('utf-8')
- else:
- return text
+ if isinstance(text, str):
+ return text.decode('utf-8')
+ else:
+ return text
def msgnote(site, text, timeout):
icon = os.path.join(__cwd__,"icon.png")
@@ -336,6 +337,7 @@ def recursive_glob(treeroot, pattern):
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir,
sub_folder, session_id): #standard input
msgnote(debug_pretext,__language__(30154), 6000)
+ legendas_tmp = []
id = subtitles_list[pos][ "id" ]
sync = subtitles_list[pos][ "sync" ]
log( __name__ ,"%s Fetching id using url %s" % (debug_pretext, id))
@@ -369,34 +371,58 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
f.write(downloaded_content)
f.close()
- # Use XBMC.Extract to extract the downloaded file, extract it to the
temp dir,
- # then removes all files from the temp dir that aren't subtitles.
- msgnote(debug_pretext,__language__(30155), 3000)
- xbmc.executebuiltin("XBMC.Extract(" + fname + "," + extract_path +")")
- time.sleep(2)
- legendas_tmp = []
# brunoga fixed solution for non unicode caracters
+ # Ps. Windows allready parses Unicode filenames.
fs_encoding = sys.getfilesystemencoding()
- for root, dirs, files in os.walk(extract_path.encode(fs_encoding),
topdown=False):
- for file in files:
- dirfile = os.path.join(root, file)
- ext = os.path.splitext(dirfile)[1][1:].lower()
- if ext in sub_ext:
- legendas_tmp.append(dirfile)
- elif os.path.isfile(dirfile):
- os.remove(dirfile)
+ extract_path = extract_path.encode(fs_encoding)
- msgnote(debug_pretext,__language__(30156), 3000)
- searchrars = recursive_glob(extract_path, packext)
- searchrarcount = len(searchrars)
- if searchrarcount > 1:
- for filerar in searchrars:
- if filerar != os.path.join(extract_path,local_tmp_file)
and filerar != os.path.join(extract_path,local_tmp_file):
- try:
- xbmc.executebuiltin("XBMC.Extract(" +
filerar + "," + extract_path +")")
- except:
- return False
- time.sleep(1)
+ def _UNICODE(text):
+ if text:
+ return unicode(BeautifulSoup(text,
fromEncoding="utf-8", smartQuotesTo=None))
+ else:
+ return text
+
+
+ # Use XBMC.Extract to extract the downloaded file, extract it to the
temp dir,
+ # then removes all files from the temp dir that aren't subtitles.
+ def extract_and_copy(extraction=0):
+ i = 0
+ for root, dirs, files in os.walk(extract_path, topdown=False):
+ for file in files:
+ dirfile = os.path.join(root, file)
+
+ # Sanitize filenames - converting them to ASCII
- and remove them from folders
+ f = xbmcvfs.File(dirfile)
+ temp = f.read()
+ f.close()
+ xbmcvfs.delete(dirfile)
+ dirfile_with_path_name =
os.path.relpath(dirfile, extract_path)
+ dirfile_with_path_name =
re.sub(r"[/\\]{1,2}","-", dirfile_with_path_name)
+ dirfile_with_path_name =
_UNICODE(dirfile_with_path_name).encode('ascii', 'ignore')
+ new_dirfile = os.path.join(extract_path,
dirfile_with_path_name)
+ os.write(os.open(new_dirfile, os.O_RDWR |
os.O_CREAT), temp)
+
+ # Get the file extention
+ ext =
os.path.splitext(new_dirfile)[1][1:].lower()
+ if ext in sub_ext and
xbmcvfs.exists(new_dirfile):
+ if not new_dirfile in legendas_tmp:
+ #Append the matching file
+ legendas_tmp.append(new_dirfile)
+ elif ext in "rar zip" and not extraction:
+ # Extract compressed files, extracted
priorly
+ xbmc.executebuiltin("XBMC.Extract(%s,
%s)" % (new_dirfile, extract_path))
+ xbmc.sleep(1000)
+ extract_and_copy(1)
+ elif ext not in "idx":
+ xbmcvfs.delete(new_dirfile)
+ for dir in dirs:
+ dirfolder = os.path.join(root, dir)
+ xbmcvfs.rmdir(dirfolder)
+
+ xbmc.executebuiltin("XBMC.Extract(%s, %s)" % (fname, extract_path))
+ xbmc.sleep(1000)
+ extract_and_copy()
+
searchsubs = recursive_glob(extract_path, subext)
searchsubscount = len(searchsubs)
for filesub in searchsubs:
diff --git a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
index 5f37b48..e184ad8 100644
--- a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
@@ -38,7 +38,7 @@ subtitle_pattern = "<a href=\"(/ondertitels/info/.+?)\".+?<i
class=\"i_font\">(.
"""
<a href="/getdownload.php?id=45071&userfile=94 Avatar (2009) PROPER TS
XviD-MAXSPEED.zip"><b>Download</b></a>
"""
-downloadlink_pattern = "<a
href=\"/(getdownload\.php\?id=\d{1,10}&userfile=[^\n\r\t]*\.\w{3})\"><b>Download</b></a>"
+downloadlink_pattern = "a
href=\"http://[a-zA-Z0-9\-\.]+/(getdownload.php\?id=\d{1,10}&userfile=.*?\.\w{3})\""
# group(1) = downloadlink
#====================================================================================================================
@@ -142,7 +142,7 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
url = main_url + downloadlink
url = string.replace(url," ","+")
log( __name__ ,"%s Fetching subtitles using url %s -
and cookie: %s" % (debug_pretext, url, cookie.cookies))
- content = geturl(url, FETCH_SUBTITLE, cookie.cookies)
+ content = geturl(url, FETCH_SUBTITLE)
if content is not None:
log( __name__ ,"%s Saving subtitles to '%s'" %
(debug_pretext, local_tmp_file))
local_file_handle = open(local_tmp_file, "w" +
"b")
diff --git a/script.xbmc.subtitles/resources/lib/services/RegieLive/service.py
b/script.xbmc.subtitles/resources/lib/services/RegieLive/service.py
index 41abc34..1c60007 100644
--- a/script.xbmc.subtitles/resources/lib/services/RegieLive/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/RegieLive/service.py
@@ -85,7 +85,7 @@ def addSubtitle(subtitlesList, sync, title, link, referer,
rating,cd):
'referer': referer,
'rating':getFormattedRating(rating),
'language_flag': 'flags/ro.gif',
- 'language_name': cd + " CD",
+ 'language_name': "Romanian",
'cd':cd})
# sort subtitlesList first by sync then by rating
@@ -211,7 +211,7 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
# get the subtitles .zip
content = getURL(url, referer)
# write the subs archive in the temp location
- subs_file = os.path.join(tmp_sub_dir, "zipsubs.zip")
+ subs_file = zip_subs
try:
log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext,
subs_file))
local_file_handle = open(subs_file, "w" + "b")
@@ -224,4 +224,4 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
# True iff the file is packed as zip: addon will automatically unpack it.
# language of subtitles,
# Name of subtitles file if not packed (or if we unpacked it ourselves)
- return True, language, subs_file
+ return True, language, ''
diff --git
a/script.xbmc.subtitles/resources/lib/services/SubtitulosES/service.py
b/script.xbmc.subtitles/resources/lib/services/SubtitulosES/service.py
index 20af66e..4c3bf6a 100644
--- a/script.xbmc.subtitles/resources/lib/services/SubtitulosES/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/SubtitulosES/service.py
@@ -2,6 +2,7 @@
# based on argenteam.net subtitles, based on a mod of Subdivx.com subtitles,
based on a mod of Undertext subtitles
# developed by quillo86 and infinito for Subtitulos.es and XBMC.org
+# little fixes and updates by tux_os
import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2
from utilities import log
_ = sys.modules[ "__main__" ].__language__
@@ -27,11 +28,11 @@ def getallsubs(languageshort, langlong, file_original_path,
subtitles_list, tvsh
if re.search(r'\([^)]*\)', tvshow):
for level in range(4):
searchstring, tvshow, season, episode = getsearchstring(tvshow,
season, episode, level)
- url = main_url + searchstring
+ url = main_url + searchstring.lower()
getallsubsforurl(url, languageshort, langlong, file_original_path,
subtitles_list, tvshow, season, episode)
else:
searchstring, tvshow, season, episode = getsearchstring(tvshow,
season, episode, 0)
- url = main_url + searchstring
+ url = main_url + searchstring.lower()
getallsubsforurl(url, languageshort, langlong, file_original_path,
subtitles_list, tvshow, season, episode)
def getallsubsforurl(url, languageshort, langlong, file_original_path,
subtitles_list, tvshow, season, episode):
@@ -86,12 +87,14 @@ def getallsubsforurl(url, languageshort, langlong,
file_original_path, subtitles
estado = re.sub(r'\n', '', estado)
id = matches.group(6)
- id = id[44:62]
- id = re.sub(r'"', '', id)
+ id = re.sub(r'([^-]*)href="', '', id)
+ id = re.sub(r'" rel([^-]*)', '', id)
+ id = re.sub(r'" re([^-]*)', '', id)
+ id = re.sub(r'http://www.subtitulos.es/', '', id)
- if estado == "green'>Completado" and languagelong ==
langlong:
+ if estado.strip() == "green'>Completado".strip() and
languagelong == langlong:
subtitles_list.append({'rating': "0",
'no_files': 1, 'filename': filename, 'server': server, 'sync': False, 'id' :
id, 'language_flag': 'flags/' + languageshort + '.gif', 'language_name':
languagelong})
-
+
filename = backup
server = backup
diff --git a/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
b/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
index 153147b..f868ef3 100644
--- a/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
@@ -64,6 +64,7 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
control_img2 = client.get_control_image(content)
if not control_img2 == None:
log(__name__,'Invalid control text')
+
xbmc.executebuiltin("XBMC.Notification(%s,%s,1000,%s)" %
(__scriptname__,"Invalid control text",os.path.join(__cwd__,'icon.png')))
return
True,subtitles_list[pos]['language_name'], ""
else:
log(__name__,'Dialog was canceled')
@@ -80,10 +81,9 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
link = client.get_link(content)
log(__name__,'Got the link, wait %i seconds before download' %
(wait_time))
delay = wait_time
- icon = os.path.join(__cwd__,'icon.png')
for i in range(wait_time+1):
line2 = 'Download will start in %i seconds' % (delay,)
- xbmc.executebuiltin("XBMC.Notification(%s,%s,1000,%s)" %
(__scriptname__,line2,icon))
+ xbmc.executebuiltin("XBMC.Notification(%s,%s,1000,%s)" %
(__scriptname__,line2,os.path.join(__cwd__,'icon.png')))
delay -= 1
time.sleep(1)
@@ -140,15 +140,25 @@ class TitulkyClient(object):
def __init__(self):
self.server_url = 'http://www.titulky.com'
opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.LWPCookieJar()))
- opener.version = 'User-Agent=Mozilla/5.0 (Windows; U; Windows
NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
+ opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U;
Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR
3.5.30729)')]
urllib2.install_opener(opener)
+
def login(self,username,password):
log(__name__,'Logging in to Titulky.com')
login_postdata = urllib.urlencode({'Login': username,
'Password': password, 'foreverlog': '1','Detail2':''} )
request = urllib2.Request(self.server_url +
'/index.php',login_postdata)
- response = urllib2.urlopen(request).read()
+ response = urllib2.urlopen(request)
log(__name__,'Got response')
- return not response.find('BadLogin')>-1
+ if response.read().find('BadLogin')>-1:
+ return False
+
+ log(__name__,'Storing Cookies')
+ self.cookies = {}
+ self.cookies['CRC'] = re.search('CRC=(\S+);',
response.headers.get('Set-Cookie'), re.IGNORECASE | re.DOTALL).group(1)
+ self.cookies['LogonLogin'] =
re.search('LogonLogin=(\S+);', response.headers.get('Set-Cookie'),
re.IGNORECASE | re.DOTALL).group(1)
+ self.cookies['LogonId'] = re.search('LogonId=(\S+);',
response.headers.get('Set-Cookie'), re.IGNORECASE | re.DOTALL).group(1)
+
+ return True
def search_subtitles(self, file_original_path, title, tvshow, year,
season, episode, set_temp, rar, lang1, lang2, lang3 ):
url =
self.server_url+'/index.php?'+urllib.urlencode({'Fulltext':title,'FindUser':''})
@@ -251,7 +261,13 @@ class TitulkyClient(object):
url = self.server_url+link
log(__name__,'Downloading file %s' % (url))
req = urllib2.Request(url)
+ req = self.add_cookies_into_header(req)
response = urllib2.urlopen(req)
+ if response.headers.get('Set-Cookie'):
+ phpsessid = re.search('PHPSESSID=(\S+);',
response.headers.get('Set-Cookie'), re.IGNORECASE | re.DOTALL)
+ if phpsessid:
+ log(__name__, "Storing PHPSessionID")
+ self.cookies['PHPSESSID'] = phpsessid.group(1)
content = response.read()
log(__name__,'Done')
response.close()
@@ -261,6 +277,7 @@ class TitulkyClient(object):
url = self.server_url+'/idown.php'
post_data =
{'downkod':code,'titulky':id,'zip':'z','securedown':'2','histstamp':''}
req = urllib2.Request(url,urllib.urlencode(post_data))
+ req = self.add_cookies_into_header(req)
log(__name__,'Opening %s POST:%s' % (url,str(post_data)))
response = urllib2.urlopen(req)
content = response.read()
@@ -273,9 +290,19 @@ class TitulkyClient(object):
url =
self.server_url+'/idown.php?'+urllib.urlencode({'R':timestamp,'titulky':id,'histstamp':'','zip':'z'})
log(__name__,'Opening %s' % (url))
req = urllib2.Request(url)
+ req = self.add_cookies_into_header(req)
response = urllib2.urlopen(req)
content = response.read()
log(__name__,'Done')
response.close()
return content
+ def add_cookies_into_header(self,request):
+ cookies_string = "LogonLogin=" + self.cookies['LogonLogin'] +
"; "
+ cookies_string += "LogonId=" + self.cookies['LogonId'] + "; "
+ cookies_string += "CRC=" + self.cookies['CRC']
+ if 'PHPSESSID' in self.cookies:
+ cookies_string += "; PHPSESSID=" +
self.cookies['PHPSESSID']
+ request.add_header('Cookie',cookies_string)
+ return request
+
diff --git
a/script.xbmc.subtitles/resources/lib/services/Torec/TorecSubtitlesDownloader.py
b/script.xbmc.subtitles/resources/lib/services/Torec/TorecSubtitlesDownloader.py
index 46077d6..6caa3f0 100644
---
a/script.xbmc.subtitles/resources/lib/services/Torec/TorecSubtitlesDownloader.py
+++
b/script.xbmc.subtitles/resources/lib/services/Torec/TorecSubtitlesDownloader.py
@@ -163,7 +163,6 @@ class TorecSubtitlesDownloader:
with open( fileName,"wb") as f:
f.write(data)
- shouldUnzip = True
if shouldUnzip:
# Unzip the zip file
log(__name__ ,"Unzip the zip file")
-----------------------------------------------------------------------
Summary of changes:
script.xbmc.subtitles/addon.xml | 2 +-
script.xbmc.subtitles/changelog.txt | 12 ++
.../resources/lib/services/GomTV/service.py | 124 +++++++++++++++++---
.../resources/lib/services/LegendasDivx/service.py | 86 +++++++++-----
.../resources/lib/services/Ondertitel/service.py | 4 +-
.../resources/lib/services/RegieLive/service.py | 6 +-
.../resources/lib/services/SubtitulosES/service.py | 15 ++-
.../resources/lib/services/Titulky/service.py | 37 +++++-
.../lib/services/Torec/TorecSubtitlesDownloader.py | 1 -
9 files changed, 222 insertions(+), 65 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
Xbmc-addons@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xbmc-addons