The branch, frodo has been updated
       via  c16a2155fdb8841d1159b601b6ba4caeb51b27f8 (commit)
      from  5d9d100a6ee888b7d3d4c5194a4d2c745341f345 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=c16a2155fdb8841d1159b601b6ba4caeb51b27f8

commit c16a2155fdb8841d1159b601b6ba4caeb51b27f8
Author: amet <[email protected]>
Date:   Sat May 4 00:17:34 2013 +0400

    [script.xbmc.subtitles] -v3.9.7
    
    3.9.7
    - [fix] Filename on the beginning of description, EnricGodes
    - [fix] LegendasDivx, LegendasZone and Ondertitel search pattern, highlandr
    - [cosmetic] add extra info to addon.xml, M. Kaijser
    - Modified Subscene to prioritize shows based on amount of subtitles and 
added fuzzy string matching, IcE
    - Add Torec service, Guy Sheffer

diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 840fd18..211e003 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.6"
+       version="3.9.7"
        provider-name="amet, mr_blobby">
   <requires>
     <import addon="xbmc.python" version="2.1.0"/>
@@ -90,5 +90,9 @@
     <description 
lang="th">ค้นหาและดาวน์โหลดคำบรรยายจากผู้ให้บริการหลายแหล่ง
 
ปุ่มคำบรรยายที่อยู่ในการแสดงผลหน้าจอจำเป็นต้องเปิดใช้งานและตั้งค่าในส่วนของการตั้งค่าคำบรรยายใน
 System-&gt; Skin-&gt; Addon Scripts</description>
     <description lang="zh">从多个服务提供者
搜索并下载字幕。需要激活视频OSD菜单中的字幕按钮,并将字幕扩展功能设置为XBMC字幕。设置方法:系统设置-&gt;皮肤-&gt;扩展功能</description>
     <platform>all</platform>
+    <website></website>
+    <source>https://github.com/amet/script.xbmc.subtitles</source>
+    <forum>http://forum.xbmc.org/showthread.php?tid=126495</forum>
+    <email></email>
   </extension>
 </addon>
diff --git a/script.xbmc.subtitles/changelog.txt 
b/script.xbmc.subtitles/changelog.txt
index 01cbe81..8a5ecac 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,10 @@
+3.9.7
+- [fix] Filename on the beginning of description, EnricGodes
+- [fix] LegendasDivx, LegendasZone and Ondertitel search pattern, highlandr
+- [cosmetic] add extra info to addon.xml, M. Kaijser
+- Modified Subscene to prioritize shows based on amount of subtitles and added 
fuzzy string matching, IcE
+- Add Torec service, Guy Sheffer
+
 3.9.6
 - [fix] GomTV service: return empty array when no subtitles are found,hojel
 - [fix] Subscene service, thx jowadmax on XBMC Forum
diff --git 
a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py 
b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
index 953d348..409cb97 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
@@ -153,8 +153,8 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                url = main_url + 
"modules.php?name=Downloads&file=jz&d_op=search_next&order=&form_cat=30&page=" 
+ str(page) + "&query=" + urllib.quote_plus(searchstring)
        elif languageshort == "en":
                url = main_url + 
"modules.php?name=Downloads&file=jz&d_op=search_next&order=&form_cat=31&page=" 
+ str(page) + "&query=" + urllib.quote_plus(searchstring)
-#      else:
-#              url = main_url + "index.php"
+       else:
+               url = main_url + "index.php"
 
        content = geturl(url)
        log( __name__ ,"%s Getting '%s' subs ..." % (debug_pretext, 
languageshort))
@@ -224,8 +224,8 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                        url = main_url + 
"modules.php?name=Downloads&file=jz&d_op=search_next&order=&form_cat=30&page=" 
+ str(page) + "&query=" + urllib.quote_plus(searchstring)
                elif languageshort == "en":
                        url = main_url + 
"modules.php?name=Downloads&file=jz&d_op=search_next&order=&form_cat=31&page=" 
+ str(page) + "&query=" + urllib.quote_plus(searchstring)
-#              else:
-#                      url = main_url + "index.php"
+               else:
+                       url = main_url + "index.php"
                        
                content = geturl(url)
 
diff --git 
a/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py 
b/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
index 1ce31a2..516cd32 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
@@ -102,7 +102,11 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
        page = 0
        if languageshort == "pb":
                        languageshort = "br"
-       url = main_url + "legendas.php?l=" + languageshort + "&page=" + 
str(page) + "&s=" + urllib.quote_plus(searchstring)
+       #url = main_url + "legendas.php?l=" + languageshort + "&page=" + 
str(page) + "&s=" + urllib.quote_plus(searchstring)
+       if languageshort == "pt" or languageshort == "br" or languageshort == 
"en" or languageshort == "es":
+               url = main_url + "legendas.php?l=" + languageshort + "&page=" + 
str(page) + "&s=" + urllib.quote_plus(searchstring)
+       else:
+               url = main_url + "index.php"
 
        content = opener.open(url)
        #log( __name__ ,"%s Content: '%s'" % (debug_pretext, content))
@@ -174,7 +178,11 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                        page = page + 1
                        if languageshort == "br":
                                languageshort = "pb"
-                       url = main_url + "legendas.php?l=" + languageshort + 
"&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+#                      url = main_url + "legendas.php?l=" + languageshort + 
"&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+                       if languageshort == "pt" or languageshort == "br" or 
languageshort == "en" or languageshort == "es":
+                               url = main_url + "legendas.php?l=" + 
languageshort + "&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+                       else:
+                               url = main_url + "index.php"
                        content = opener.open(url)
                        content = content.read().decode('latin1')
                        #For DEBUG only uncomment next line
@@ -183,7 +191,11 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                page = 0
                if languageshort == "pb":
                        languageshort = "br"
-               url = main_url + "legendas.php?l=" + languageshort + "&page=" + 
str(page) + "&s=" + urllib.quote_plus(searchstring)
+               if languageshort == "pt" or languageshort == "br" or 
languageshort == "en" or languageshort == "es":
+                       url = main_url + "legendas.php?l=" + languageshort + 
"&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+               else:
+                       url = main_url + "index.php"
+               #url = main_url + "legendas.php?l=" + languageshort + "&page=" 
+ str(page) + "&s=" + urllib.quote_plus(searchstring)
                content = opener.open(url)
                content = content.read().decode('latin1')
                maxsubs = re.findall(multiple_results_pattern, content, 
re.IGNORECASE | re.DOTALL | re.MULTILINE | re.UNICODE | re.VERBOSE)
@@ -197,7 +209,11 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                                        page1 = 0
                                        if languageshort == "pb":
                                                languageshort = "br"
-                                       content1 = opener.open(main_url + 
"legendas.php?l=" + languageshort + "&imdb=" + imdb + "&page=" + str(page1))
+                                       if languageshort == "pt" or 
languageshort == "br" or languageshort == "en" or languageshort == "es":
+                                               content1 = opener.open(main_url 
+ "legendas.php?l=" + languageshort + "&imdb=" + imdb + "&page=" + str(page1))
+                                       else:
+                                               content1 = main_url + 
"index.php"
+                                       #content1 = opener.open(main_url + 
"legendas.php?l=" + languageshort + "&imdb=" + imdb + "&page=" + str(page1))
                                        content1 = content1.read()
                                        content1 = content1.decode('latin1')
                                        while re.search(subtitle_pattern, 
content1, re.IGNORECASE | re.DOTALL | re.MULTILINE | re.UNICODE | re.VERBOSE) 
and page1 == 0:
@@ -263,12 +279,20 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                                                                languageshort = 
"pb"
                                                        
subtitles_list.append({'rating': str(downloads), 'no_files': no_files, 'id': 
id, 'filename': filename, 'desc': desc, 'sync': sync, 'hits' : hits, 
'language_flag': 'flags/' + languageshort + '.gif', 'language_name': 
languagelong})
                                                page1 = page1 + 1
-                                               content1 = opener.open(main_url 
+ "legendas.php?l=" + languageshort + "&imdb=" + imdb + "&page=" + str(page1))
+                                               if languageshort == "pt" or 
languageshort == "br" or languageshort == "en" or languageshort == "es":
+                                                       content1 = 
opener.open(main_url + "legendas.php?l=" + languageshort + "&imdb=" + imdb + 
"&page=" + str(page1))
+                                               else:
+                                                       content1 = main_url + 
"index.php"
+                                               #content1 = 
opener.open(main_url + "legendas.php?l=" + languageshort + "&imdb=" + imdb + 
"&page=" + str(page1))
                                                content1 = 
content1.read().decode('latin1')
                                page = page + 1
                                if languageshort == "pb":
                                        languageshort = "br"
-                               url = main_url + "legendas.php?l=" + 
languageshort + "&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+                               #url = main_url + "legendas.php?l=" + 
languageshort + "&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+                               if languageshort == "pt" or languageshort == 
"br" or languageshort == "en" or languageshort == "es":
+                                       url = main_url + "legendas.php?l=" + 
languageshort + "&page=" + str(page) + "&s=" + urllib.quote_plus(searchstring)
+                               else:
+                                       url = main_url + "index.php"
                                content = opener.open(url)
                                content = content.read().decode('latin1')
 ################### IMDB DISABLED FOR NOW 
#######################################
diff --git a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py 
b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
index 41634e2..8e853ac 100644
--- a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
@@ -18,8 +18,12 @@ releases_types   = ['web-dl', '480p', '720p', '1080p', 
'h264', 'x264', 'xvid', '
 <a href="/ondertitels/info/(500)-Days-of-Summer/44032.html" title="ondertitel 
(500) Days of Summer" style="color: #000;">(500) Days of Summer</a></strong> 
<img src="/images/nederlandse_vlag.jpg" height="11" width="18"></div> <div 
style="float:left;"><a href="http://www.imdb.com/title/tt1022603/"; 
target="_blank"><img src="/images/imdb_logo.gif" border="0"></a> </div><br 
clear="both"></div>
                                                        <div style="width: 
490px; overflow:hidden; overflow:hidden"><font style="font-size: 11px; color: 
#444445;"><i>500.Days.of.Summer.2009.720p.BluRay.DTS.x264-WiKi</i></font><br></div>
 """
-subtitle_pattern = "<a href=\"(/ondertitels/info/[^/\n\r\t]+/\d+?\.html)\" 
title=\"[^/\n\r\t]+\" style=\"color: #000;\">[^\n\r\t]*?[\n\r\t]+\
-<div style=\"width: 490px; overflow:hidden; overflow:hidden\"><font 
style=\"font-size: 11px; color: 
#444445;\"><i>([^\n\r\t<]+?)</i></font><br></div>"
+### Old pattern.
+#subtitle_pattern = "<a href=\"(/ondertitels/info/[^/\n\r\t]+/\d+?\.html)\" 
title=\"[^/\n\r\t]+\" style=\"color: #000;\">[^\n\r\t]*?[\n\r\t]+\
+#<div style=\"width: 490px; overflow:hidden; overflow:hidden\"><font 
style=\"font-size: 11px; color: 
#444445;\"><i>([^\n\r\t<]+?)</i></font><br></div>"
+
+### HTML in the search results changed. This pattern fix it. ###
+subtitle_pattern = "<a href=\"(/ondertitels/info/.+?.html)\" style=\"color: 
#161616;\">.+?[\r\n\t].+?<i>(.+?)</i></font></div>"
 # group(1) = link, group(2) = filename
 
 
diff --git a/script.xbmc.subtitles/resources/lib/services/Subdivx/service.py 
b/script.xbmc.subtitles/resources/lib/services/Subdivx/service.py
index d968b64..7a99d46 100644
--- a/script.xbmc.subtitles/resources/lib/services/Subdivx/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Subdivx/service.py
@@ -62,6 +62,11 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, su
                 log( __name__ ,u"%s Subtitles found: %s (id = %s)" % 
(debug_pretext, filename, id))
             except:
                 pass
+            #Find filename on the commentaries and put it in front
+            title_first_word = re.split('[\W]+', searchstring)
+            version = re.search(title_first_word[0],filename, re.IGNORECASE | 
re.DOTALL | re.MULTILINE | re.UNICODE)
+            if version != None:
+                filename = filename[version.start():] + " " + filename[: 
version.start()]
             subtitles_list.append({'rating': str(downloads), 'no_files': 
no_files, 'filename': filename, 'sync': sync, 'id' : id, 'server' : server, 
'language_flag': 'flags/' + languageshort + '.gif', 'language_name': 
languagelong})
         page = page + 1
         url = main_url + "index.php?accion=5&masdesc=&oxdown=1&pg=" + 
str(page) + "&buscar=" + urllib.quote_plus(searchstring)
diff --git a/script.xbmc.subtitles/resources/lib/services/Subscene/service.py 
b/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
index f62ba17..fb841b8 100644
--- a/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
@@ -1,6 +1,7 @@
-# -*- coding: UTF-8 -*-
+# -*- coding: utf-8 -*-
 
 import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2
+import difflib
 from utilities import languageTranslate, log
 
 main_url = "http://v2.subscene.com/";
@@ -48,7 +49,7 @@ subtitle_pattern = "..<tr>.{5}<td>.{6}<a class=\"a1\" 
href=\"/([^\n\r]{10,200}?-
                                Inception (2010) 
                                <dfn>(327)</dfn>
 """
-movie_season_pattern = "...<a 
href=\"([^\n\r\t]*?/subtitles-\d{1,10}.aspx)\".{1,14}>\r\n{0,3}.{4}([^\n\r\t\&#]*?)
 \((\d\d\d\d)\) \r\n{0,3}.{1,4}<dfn>\(.{1,5}</dfn>"
+movie_season_pattern = "...<a 
href=\"([^\n\r\t]*?/subtitles-\d{1,10}.aspx)\".{1,14}>\r\n{0,3}.{4}([^\n\r\t\&#]*?)
 \((\d\d\d\d)\) \r\n{0,3}.{1,4}<dfn>\((.{1,5})\)</dfn>"
 # group(1) = link, group(2) = movie_season_title,  group(3) = year
 
 
@@ -104,13 +105,29 @@ def find_movie(content, title, year):
 
 def find_tv_show_season(content, tvshow, season):
     url_found = None
+    possible_matches = []
+    all_tvshows = []
+
     for matches in re.finditer(movie_season_pattern, content, re.IGNORECASE | 
re.DOTALL):
-        log( __name__ ,"%s Found tv show season on search page: %s" % 
(debug_pretext, matches.group(2).decode("utf-8")))
+        #log( __name__ ,"%s Found tv show season on search page: %s" % 
(debug_pretext, matches.group(2).decode("utf-8")))
+        s = difflib.SequenceMatcher(None, string.lower(matches.group(2) + ' ' 
+ matches.group(3)), string.lower(tvshow))
+        all_tvshows.append(matches.groups() + (s.ratio() * 
int(matches.group(4)),))
+
         if string.find(string.lower(matches.group(2)),string.lower(tvshow) + " 
") > -1:
             if 
string.find(string.lower(matches.group(2)),string.lower(season)) > -1:
                 log( __name__ ,"%s Matching tv show season found on search 
page: %s" % (debug_pretext, matches.group(2).decode("utf-8")))
-                url_found = matches.group(1)
-                break
+                possible_matches.append(matches.groups())
+
+    if len(possible_matches) > 0:
+        possible_matches = sorted(possible_matches, key=lambda x: -int(x[3]))
+        url_found = possible_matches[0][0]
+        log( __name__ ,"%s Selecting matching tv show with most subtitles: %s 
(%s)" % (debug_pretext, possible_matches[0][1].decode("utf-8"), 
possible_matches[0][3].decode("utf-8")))
+    else:
+        if len(all_tvshows) > 0:
+            all_tvshows = sorted(all_tvshows, key=lambda x: -int(x[4]))
+            url_found = all_tvshows[0][0]
+            log( __name__ ,"%s Selecting tv show with highest fuzzy string 
score: %s (score: %s subtitles: %s)" % (debug_pretext, 
all_tvshows[0][1].decode("utf-8"), all_tvshows[0][4], 
all_tvshows[0][3].decode("utf-8")))
+
     return url_found
 
 
@@ -150,6 +167,8 @@ def geturl(url):
 
 
 def search_subtitles( file_original_path, title, tvshow, year, season, 
episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
+    log( __name__ ,"%s Search_subtitles = '%s', '%s', '%s', '%s', '%s', '%s', 
'%s', '%s', '%s', '%s', '%s', '%s'" % 
+         (debug_pretext, file_original_path, title, tvshow, year, season, 
episode, set_temp, rar, lang1, lang2, lang3, stack))
     subtitles_list = []
     msg = ""
     if len(tvshow) == 0:
@@ -298,4 +317,4 @@ def download_subtitles (subtitles_list, pos, zip_subs, 
tmp_sub_dir, sub_folder,
                         log( __name__ ,"%s Unpacked subtitles file '%s'" % 
(debug_pretext, file))
                         subs_file = os.path.join(tmp_sub_dir, file)
         log( __name__ ,"%s Subtitles saved to '%s'" % (debug_pretext, 
local_tmp_file))
-        return False, language, subs_file #standard output
\ No newline at end of file
+        return False, language, subs_file #standard output
diff --git a/script.xbmc.subtitles/resources/settings.xml 
b/script.xbmc.subtitles/resources/settings.xml
index 8e5a492..b197ca8 100644
--- a/script.xbmc.subtitles/resources/settings.xml
+++ b/script.xbmc.subtitles/resources/settings.xml
@@ -73,6 +73,7 @@
       <setting id="Titulky" type="bool" label="Titulky.com (Czech and Slovak 
subs only)" default="false"/>       
       <setting id="Titulkyuser" type="text"  visible= "eq(-1,true)" 
enable="eq(-1,true)" label="30128" default=""/>
       <setting id="Titulkypass" type="text" option ="hidden" visible= 
"eq(-2,true)" enable="eq(-2,true)" label="30129" default=""/>
+      <setting id="Torec" type="bool" label="Torec.net" default="false"/>
            
       <setting id="Undertexter" type="bool" label="Undertexter.se (Swedish and 
English subs only)" default="false"/>
     </category>

-----------------------------------------------------------------------

Summary of changes:
 script.xbmc.subtitles/addon.xml                    |    6 +-
 script.xbmc.subtitles/changelog.txt                |    7 +
 .../resources/lib/services/LegendasDivx/service.py |    8 +-
 .../resources/lib/services/LegendasZone/service.py |   36 +++-
 .../resources/lib/services/Ondertitel/service.py   |    8 +-
 .../resources/lib/services/Subdivx/service.py      |    5 +
 .../resources/lib/services/Subscene/service.py     |   31 ++-
 .../Torec/Torec/TorecSubtitlesDownloader.py        |  231 ++++++++++++++++++++
 .../lib/services/Torec/Torec}/__init__.py          |    0
 .../resources/lib/services/Torec/Torec/logo.png    |  Bin 0 -> 26338 bytes
 .../resources/lib/services/Torec/Torec/service.py  |   67 ++++++
 script.xbmc.subtitles/resources/settings.xml       |    1 +
 12 files changed, 381 insertions(+), 19 deletions(-)
 create mode 100644 
script.xbmc.subtitles/resources/lib/services/Torec/Torec/TorecSubtitlesDownloader.py
 copy {script.cu.lrclyrics/resources/lib/culrcscrapers => 
script.xbmc.subtitles/resources/lib/services/Torec/Torec}/__init__.py (100%)
 create mode 100644 
script.xbmc.subtitles/resources/lib/services/Torec/Torec/logo.png
 create mode 100644 
script.xbmc.subtitles/resources/lib/services/Torec/Torec/service.py


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to