The branch, eden has been updated
via 8f341e3751f06628af6d6c33ca2da9863f04a03e (commit)
from 099d27343f02d12e89ae49f6a0b458eb56c61a71 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=8f341e3751f06628af6d6c33ca2da9863f04a03e
commit 8f341e3751f06628af6d6c33ca2da9863f04a03e
Author: amet <[email protected]>
Date: Sat Sep 15 11:44:28 2012 +0400
[script.xbmc.subtitles] -v 3.3.2
- use OpenSubtitles XMLRPC for downloading subs if possible
- fixed Napysy24 subs download speed
- Removed napisy.me service (site is down), Added logging to napisy24.pl
thx gaco & mrto
- Fixed: Corrected pattern in services.ondertitel a bit more, thx
mdklapwijk
diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 93e2e6f..9388a75 100755
--- 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.3.1"
+ version="3.3.2"
provider-name="amet, mr_blobby">
<requires>
<import addon="xbmc.python" version="2.0"/>
diff --git a/script.xbmc.subtitles/changelog.txt
b/script.xbmc.subtitles/changelog.txt
index 2814b87..3eaeabd 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,9 @@
+3.3.2
+- use OpenSubtitles XMLRPC for downloading subs if possible
+- fixed Napysy24 subs download speed
+- Removed napisy.me service (site is down), Added logging to napisy24.pl thx
gaco & mrto
+- Fixed: Corrected pattern in services.ondertitel a bit more, thx mdklapwijk
+
3.3.1
- SuperSubtitles adjustments according to the site's new html encoding, thx
kispaljr
- Added uuid for better file handling, no more hangups, thx HiGhLaNdeR
diff --git a/script.xbmc.subtitles/resources/language/English/strings.xml
b/script.xbmc.subtitles/resources/language/English/strings.xml
index 8ecd48c..651563c 100644
--- a/script.xbmc.subtitles/resources/language/English/strings.xml
+++ b/script.xbmc.subtitles/resources/language/English/strings.xml
@@ -74,6 +74,8 @@
<string id="30143">MicroDVD</string>
<string id="30144">MPl2</string>
<string id="30145">Use 'Subs' subfolder for storing subtitles</string>
+ <string id="30146">- napisy24.pl Username</string>
+ <string id="30147">- napisy24.pl Password</string>
<!-- Languages -->
diff --git a/script.xbmc.subtitles/resources/language/Polish/strings.xml
b/script.xbmc.subtitles/resources/language/Polish/strings.xml
index a53100d..30cbf85 100644
--- a/script.xbmc.subtitles/resources/language/Polish/strings.xml
+++ b/script.xbmc.subtitles/resources/language/Polish/strings.xml
@@ -66,6 +66,8 @@
<string id="30138">- LegendasZone nazwa użytkownika</string>
<string id="30139">- LegendasZone hasÅo</string>
<string id="30140">- Wybierz rodzaj napisów:</string>
+ <string id="30146">- napisy24.pl Nazwa</string>
+ <string id="30147">- napisy24.pl HasÅo</string>
<!-- Languages -->
diff --git a/script.xbmc.subtitles/resources/lib/services/Napisy24pl/service.py
b/script.xbmc.subtitles/resources/lib/services/Napisy24pl/service.py
index d3441c6..15b3b37 100644
--- a/script.xbmc.subtitles/resources/lib/services/Napisy24pl/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Napisy24pl/service.py
@@ -3,11 +3,14 @@
# Frankenstein Monster v 2.0
# Feel free to improve, change anything.
# Credits to amet, Guilherme Jardim, and many more.
+# Big thanks to gaco for adding logging to site.
# mrto
import urllib2, re, string, xbmc, sys, os
from utilities import log, languageTranslate
from BeautifulSoup import BeautifulSoup
+from cookielib import CookieJar
+from urllib import urlencode
_ = sys.modules[ "__main__" ].__language__
__addon__ = sys.modules[ "__main__" ].__addon__
@@ -22,7 +25,7 @@ elif __addon__.getSetting( "Napisy24_type" ) == "3":
subtitle_type = "mpl2"
main_url = "http://napisy24.pl/search.php?str="
-base_download_url = "http://napisy.me/download/"
+base_download_url = "http://napisy24.pl/download/"
down_url = "%s%s/" % (base_download_url, subtitle_type)
def getallsubs(content, title, subtitles_list, file_original_path, stack,
lang1, lang2, lang3):
@@ -159,16 +162,30 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
return subtitles_list, "", "" #standard output
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir,
sub_folder, session_id): #standard input
- import urllib
- f = urllib.urlopen(subtitles_list[pos][ "link" ])
- language = subtitles_list[pos][ "language_name" ]
-
+ cj = CookieJar()
+ headers = {
+ 'Accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+ 'Accept-Charset': 'UTF-8,*;q=0.5',
+ 'Accept-Encoding': 'gzip,deflate,sdch',
+ 'Accept-Language': 'pl,pl-PL;q=0.8,en-US;q=0.6,en;q=0.4',
+ 'Connection': 'keep-alive',
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1
(KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1',
+ 'Referer': 'http://napisy24.pl/'
+ }
+ values = { 'form_logowanieMail' : __addon__.getSetting( "n24user" ),
'form_logowanieHaslo' : __addon__.getSetting( "n24pass" ), 'postAction' :
'sendLogowanie' }
+ data = urlencode(values)
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+ request = urllib2.Request("http://napisy24.pl/logowanie/", data, headers)
+ response = opener.open(request)
+ request = urllib2.Request(subtitles_list[pos][ "link" ], "", headers)
+ f = opener.open(request)
local_tmp_file = os.path.join(tmp_sub_dir, "zipsubs.zip")
log( __name__ ,"Saving subtitles to '%s'" % (local_tmp_file))
local_file = open(zip_subs, "w" + "b")
local_file.write(f.read())
local_file.close()
-
- return True,language, "" #standard output
-
+ opener.open("http://napisy24.pl/index.php?sendAction=Wyloguj")
+
+ language = subtitles_list[pos][ "language_name" ]
+ return True, language, "" #standard output
diff --git a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
index a4f794c..35dc22c 100644
--- a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
@@ -22,7 +22,7 @@ debug_pretext = ""
<td style="width: 60px;">3 CD's</td><td><a
href="/user_list.php?user=Goffini">Goffini</a></td></tr>
"""
-subtitle_pattern = "<strong><a
href=\"/(ondertitels/info/[^\n\r\t]*?.html)\"[^\n\r\t]*?></a><br>\
+subtitle_pattern = "<strong><a
href=\"/(ondertitels/info/[^\n\r\t]*?.html)\"[^\n\r\t]*?>\
[\n\r\t ]*?<font style=\"font-size: 11px; color:
#444445;\"><i>([^\r\n\t]*?)</i></font>[\n\r\t ]*?</div>[\n\r\t ]*?</td>\
[\n\r\t ]*?<td>[^\r\n\t]*?</td>[\r\n\t ]*?<td style=\"width: 60px;\">(\d) CD"
# group(1) = link to page with downloadlink, group(2) = filename, group(3) =
number of CD's
diff --git
a/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
b/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
index cc60d45..0184bde 100644
--- a/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
+++ b/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
@@ -11,6 +11,11 @@ BASE_URL_XMLRPC = u"http://api.opensubtitles.org/xml-rpc"
class OSDBServer:
+ def __init__( self, *args, **kwargs ):
+ self.server = xmlrpclib.Server( BASE_URL_XMLRPC, verbose=0 )
+ login = self.server.LogIn("", "", "en", __scriptname__.replace(" ","_"))
+ self.osdb_token = login[ "token" ]
+
def mergesubtitles( self ):
self.subtitles_list = []
if( len ( self.subtitles_hash_list ) > 0 ):
@@ -34,10 +39,6 @@ class OSDBServer:
if lang3 != lang1 and lang3 != lang2:
language += "," + languageTranslate(lang3,0,3)
- self.server = xmlrpclib.Server( BASE_URL_XMLRPC, verbose=0 )
- login = self.server.LogIn("", "", "en", __scriptname__.replace(" ","_"))
-
- self.osdb_token = login[ "token" ]
log( __name__ ,"Token:[%s]" % str(self.osdb_token))
try:
@@ -69,7 +70,7 @@ class OSDBServer:
'language_name' :
item["LanguageName"],
'language_flag' : flag_image,
'language_id' :
item["SubLanguageID"],
- 'ID' :
item["IDSubtitle"],
+ 'ID' :
item["IDSubtitleFile"],
'rating' :
str(int(item["SubRating"][0])),
'format' :
item["SubFormat"],
'sync' : sync,
@@ -81,3 +82,19 @@ class OSDBServer:
self.mergesubtitles()
return self.subtitles_list, msg
+
+ def download(self, ID, dest, token):
+ try:
+ import zlib, base64
+ down_id=[ID,]
+ result = self.server.DownloadSubtitles(self.osdb_token, down_id)
+ if result["data"]:
+ local_file = open(dest, "w" + "b")
+ d = zlib.decompressobj(16+zlib.MAX_WBITS)
+ data = d.decompress(base64.b64decode(result["data"][0]["data"]))
+ local_file.write(data)
+ local_file.close()
+ return True
+ return False
+ except:
+ return False
\ No newline at end of file
diff --git
a/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/service.py
b/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/service.py
index cfc0540..9156398 100644
--- a/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/service.py
@@ -53,15 +53,15 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir,
sub_folder, session_id): #standard input
- import urllib
- f = urllib.urlopen(subtitles_list[pos][ "link" ])
- local_file = open(zip_subs, "w" + "b")
-
- local_file.write(f.read())
- local_file.close()
+
+ destination = os.path.join(tmp_sub_dir, "%s.srt" % subtitles_list[pos][ "ID"
])
+ result = OSDBServer().download(subtitles_list[pos][ "ID" ], destination,
session_id)
+ if not result:
+ import urllib
+ urllib.urlretrieve(subtitles_list[pos][ "link" ],zip_subs)
language = subtitles_list[pos][ "language_name" ]
- return True,language, "" #standard output
+ return not result,language, destination #standard output
diff --git a/script.xbmc.subtitles/resources/settings.xml
b/script.xbmc.subtitles/resources/settings.xml
index c2ea3b0..7cd1db8 100644
--- a/script.xbmc.subtitles/resources/settings.xml
+++ b/script.xbmc.subtitles/resources/settings.xml
@@ -29,8 +29,8 @@
<setting id="Napiprojekt" type="bool" label="Napiprojekt.pl
(Polish/English subs only)" default="false"/>
<setting id="Napisy24pl" type="bool" label="Napisy24.pl (Mostly
Polish/English subs)" default="false"/>
<setting id="Napisy24_type" type="enum"
lvalues="30141|30142|30143|30144" visible= "eq(-1,true)" enable="eq(-1,true)"
default="2" label="30140"/>
- <setting id="Napisyme" type="bool" label="Napisy.me (Mostly
Polish/English subs from napisy24.pl database)" default="false"/>
- <setting id="Napisyme_type" type="enum"
lvalues="30141|30142|30143|30144" visible= "eq(-1,true)" enable="eq(-1,true)"
default="2" label="30140"/>
+ <setting id="n24user" type="text" visible= "eq(-2,true)"
enable="eq(-2,true)" label="30146" default=""/>
+ <setting id="n24pass" type="text" option = "hidden" visible=
"eq(-3,true)" enable="eq(-3,true)" label="30147" default=""/>
<setting id="OmniSubs" type="bool" label="OmniSubs.net" default="false"/>
<setting id="Omniuser" type="text" visible= "eq(-1,true)"
enable="eq(-1,true)" label="30136" default=""/>
-----------------------------------------------------------------------
Summary of changes:
script.xbmc.subtitles/addon.xml | 2 +-
script.xbmc.subtitles/changelog.txt | 6 +
.../resources/language/English/strings.xml | 2 +
.../resources/language/Polish/strings.xml | 2 +
.../resources/lib/services/Napisy24pl/service.py | 33 +++++--
.../resources/lib/services/Napisyme/__init__.py | 1 -
.../resources/lib/services/Napisyme/logo.png | Bin 37804 -> 0 bytes
.../resources/lib/services/Napisyme/service.py | 105 --------------------
.../resources/lib/services/Ondertitel/service.py | 2 +-
.../lib/services/OpenSubtitles/os_utilities.py | 27 ++++-
.../lib/services/OpenSubtitles/service.py | 14 ++--
script.xbmc.subtitles/resources/settings.xml | 4 +-
12 files changed, 68 insertions(+), 130 deletions(-)
delete mode 100644
script.xbmc.subtitles/resources/lib/services/Napisyme/__init__.py
delete mode 100644
script.xbmc.subtitles/resources/lib/services/Napisyme/logo.png
delete mode 100644
script.xbmc.subtitles/resources/lib/services/Napisyme/service.py
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons