The branch, eden has been updated
       via  80412c01c39b3073bd213f53dc020c56e4660ec6 (commit)
      from  136780e556a3c11c7eae50b083c8173229923d05 (commit)

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

commit 80412c01c39b3073bd213f53dc020c56e4660ec6
Author: amet <[email protected]>
Date:   Sat Aug 25 14:57:16 2012 +0400

    [script.xbmc.subtitles] -v 3.3.1
    
    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
    - Fixed: Subtitle not show after download under windows because can't open 
the download file when replace \ to / , thx taxigps
    - Fix for broken pattern in services.ondertitel, thx mdklapwijk

diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 40e5514..93e2e6f 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.0"
+       version="3.3.1"
        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 d47414e..2814b87 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,9 @@
+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
+- Fixed: Subtitle not show after download under windows because can't open the 
download file when replace \ to / , thx taxigps
+- Fix for broken pattern in services.ondertitel, thx mdklapwijk
+
 3.3.0
 - French localization, thx Regis Villemin
 - Enabled localization of lang names in search results, thx Regis Villemin
diff --git a/script.xbmc.subtitles/resources/lib/gui.py 
b/script.xbmc.subtitles/resources/lib/gui.py
index ed821c8..b12281e 100644
--- a/script.xbmc.subtitles/resources/lib/gui.py
+++ b/script.xbmc.subtitles/resources/lib/gui.py
@@ -317,8 +317,8 @@ class GUI( xbmcgui.WindowXMLDialog ):
         file_name = u"%s.%s%s" % ( sub_name, sub_lang, sub_ext )
       else:
         file_name = u"%s%s" % ( sub_name, sub_ext )
-      file_from = file.replace('\\','/')
-      file_to = os.path.join(self.sub_folder, file_name).replace('\\','/')
+      file_from = file
+      file_to = os.path.join(self.sub_folder, file_name)
       # Create a files list of from-to tuples so that multiple files may be
       # copied (sub+idx etc')
       files_list = [(file_from,file_to)]
diff --git 
a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py 
b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
index 32eeb08..12a7210 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Service LegendasDivx.com version 0.2.3
+# Service LegendasDivx.com version 0.2.4
 # Code based on Undertext service
 # Coded by HiGhLaNdR@OLDSCHOOL
 # Help by VaRaTRoN
@@ -8,6 +8,9 @@
 # http://www.teknorage.com
 # License: GPL v2
 #
+# NEW on Service LegendasDivx.com v0.2.4:
+# Added uuid for better file handling, no more hangups.
+#
 # NEW on Service LegendasDivx.com v0.2.3:
 # Fixed typo on the version.
 # Added built-in notifications.
@@ -49,7 +52,7 @@
 # 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
+import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib, 
shutil, fnmatch, uuid
 from utilities import log
 _ = sys.modules[ "__main__" ].__language__
 __scriptname__ = sys.modules[ "__main__" ].__scriptname__
@@ -310,14 +313,14 @@ def download_subtitles (subtitles_list, pos, zip_subs, 
tmp_sub_dir, sub_folder,
                header = 
content.info()['Content-Disposition'].split('filename')[1].split('.')[-1].strip("\"")
                if header == 'rar':
                        log( __name__ ,"%s file: content is RAR" % 
(debug_pretext)) #EGO
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.rar")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".rar")
                        log( __name__ ,"%s file: local_tmp_file %s" % 
(debug_pretext, local_tmp_file)) #EGO
                        packed = True
                elif header == 'zip':
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.zip")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".zip")
                        packed = True
                else: # never found/downloaded an unpacked subtitles file, but 
just to be sure ...
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.srt") 
# assume unpacked sub file is an '.srt'
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".srt") # assume unpacked sub file is an '.srt'
                        subs_file = local_tmp_file
                        packed = False
                log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext, 
local_tmp_file))
diff --git 
a/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py 
b/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
index 3e5806b..eb513a3 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Service Legendas-Zone.org version 0.1.7
+# Service Legendas-Zone.org version 0.1.8
 # Code based on Undertext service
 # Coded by HiGhLaNdR@OLDSCHOOL
 # Help by VaRaTRoN
@@ -8,6 +8,8 @@
 # http://www.teknorage.com
 # License: GPL v2
 #
+# NEW on Service Legendas-Zone.org v0.1.8:
+# Added uuid for better file handling, no more hangups.
 #
 # NEW on Service Legendas-Zone.org v0.1.7:
 # Changed 2 patterns that were crashing the plugin, now it works correctly.
@@ -21,7 +23,7 @@
 # TODO: re-arrange code :)
 #
 # Legendas-Zone.org subtitles, based on a mod of Undertext subtitles
-import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib, 
shutil, fnmatch
+import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib, 
shutil, fnmatch, uuid
 from utilities import log
 _ = sys.modules[ "__main__" ].__language__
 __scriptname__ = sys.modules[ "__main__" ].__scriptname__
@@ -428,14 +430,14 @@ def download_subtitles (subtitles_list, pos, zip_subs, 
tmp_sub_dir, sub_folder,
                header = 
content.info()['Content-Disposition'].split('filename')[1].split('.')[-1].strip("\"").strip(";")
                if header == 'rar':
                        log( __name__ ,"%s file: content is RAR" % 
(debug_pretext)) #EGO
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.rar")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".rar")
                        log( __name__ ,"%s file: local_tmp_file %s" % 
(debug_pretext, local_tmp_file)) #EGO
                        packed = True
                elif header == 'zip':
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.zip")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".zip")
                        packed = True
                else: # never found/downloaded an unpacked subtitles file, but 
just to be sure ...
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.srt") 
# assume unpacked sub file is an '.srt'
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".srt") # assume unpacked sub file is an '.srt'
                        subs_file = local_tmp_file
                        packed = False
                log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext, 
local_tmp_file))
diff --git a/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py 
b/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
index 3c7e22e..6f357ea 100644
--- a/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
@@ -8,12 +8,14 @@
 # http://www.teknorage.com
 # License: GPL v2
 #
+# NEW on Service OmniSubs.net v0.1.6:
+# Added uuid for better file handling, no more hangups.
 #
 # Initial Release of Service OmniSubs.net - v0.1.5:
 # TODO: re-arrange code :)
 #
 # OmniSubs.NET subtitles, based on a mod of Undertext subtitles
-import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib, 
shutil, fnmatch
+import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib, 
shutil, fnmatch, uuid
 from utilities import log
 _ = sys.modules[ "__main__" ].__language__
 __scriptname__ = sys.modules[ "__main__" ].__scriptname__
@@ -250,14 +252,14 @@ def download_subtitles (subtitles_list, pos, zip_subs, 
tmp_sub_dir, sub_folder,
                header = 
content.info()['Content-Disposition'].split('filename')[1].split('.')[-1].strip("\"")
                if header == 'rar':
                        log( __name__ ,"%s file: content is RAR" % 
(debug_pretext)) #EGO
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.rar")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".rar")
                        log( __name__ ,"%s file: local_tmp_file %s" % 
(debug_pretext, local_tmp_file)) #EGO
                        packed = True
                elif header == 'zip':
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.zip")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".zip")
                        packed = True
                else: # never found/downloaded an unpacked subtitles file, but 
just to be sure ...
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.srt") 
# assume unpacked sub file is an '.srt'
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".srt") # assume unpacked sub file is an '.srt'
                        subs_file = local_tmp_file
                        packed = False
                log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext, 
local_tmp_file))
diff --git a/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py 
b/script.xbmc.subtitles/resources/lib/services/Ondertitel/service.py
index 0768e15..a4f794c 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]*?trailer.png\" 
height=\"15\" border=\"0\"></a><br>\
+subtitle_pattern = "<strong><a 
href=\"/(ondertitels/info/[^\n\r\t]*?.html)\"[^\n\r\t]*?></a><br>\
 [\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/PTSubs/service.py 
b/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
index 81171bd..f0bfb04 100644
--- a/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
@@ -8,6 +8,8 @@
 # http://www.teknorage.com
 # License: GPL v2
 #
+# NEW on Service PT-SUBS.NET v0.1.6:
+# Added uuid for better file handling, no more hangups.
 #
 # Initial Release of Service PT-SUBS.NET - v0.1.5:
 # TODO: re-arrange code :)
@@ -244,14 +246,14 @@ def download_subtitles (subtitles_list, pos, zip_subs, 
tmp_sub_dir, sub_folder,
                header = 
content.info()['Content-Disposition'].split('filename')[1].split('.')[-1].strip("\"")
                if header == 'rar':
                        log( __name__ ,"%s file: content is RAR" % 
(debug_pretext)) #EGO
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.rar")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".rar")
                        log( __name__ ,"%s file: local_tmp_file %s" % 
(debug_pretext, local_tmp_file)) #EGO
                        packed = True
                elif header == 'zip':
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.zip")
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".zip")
                        packed = True
                else: # never found/downloaded an unpacked subtitles file, but 
just to be sure ...
-                       local_tmp_file = os.path.join(tmp_sub_dir, "ldivx.srt") 
# assume unpacked sub file is an '.srt'
+                       local_tmp_file = os.path.join(tmp_sub_dir, 
str(uuid.uuid1()) + ".srt") # assume unpacked sub file is an '.srt'
                        subs_file = local_tmp_file
                        packed = False
                log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext, 
local_tmp_file))
diff --git 
a/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/service.py 
b/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/service.py
index 2792152..763a2f8 100644
--- a/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/service.py
@@ -100,12 +100,16 @@ def search_subtitles( file_original_path, title, tvshow, 
year, season, episode,
         sep = season + "x" + str(episode).zfill(2)
         subenv.debuglog("Release type: %s, Releaser: %s, Episode str: %s" % 
(release_type, releaser, sep) )
         
-        for matches in re.finditer(subtitle_pattern, content, re.IGNORECASE | 
re.DOTALL | re.MULTILINE):  #  | re.UNICODE
-            link = matches.group('link1') + 
urllib.quote_plus(matches.group('link2')) + matches.group('link3')
-            hun_title = matches.group('huntitle')
-            orig_title = matches.group('origtitle')
-            hun_langname = matches.group('lang')
-            sub_id = matches.group('id')
+        html_encoding = 'utf8'
+        decode_policy = 'replace'
+
+        for matches in re.finditer(subtitle_pattern, content, re.IGNORECASE | 
re.DOTALL | re.MULTILINE | re.UNICODE):  #  | re.UNICODE
+            link = (matches.group('link1') + 
urllib.quote_plus(matches.group('link2')) + 
matches.group('link3')).decode(html_encoding, decode_policy)
+            hun_title = matches.group('huntitle').decode(html_encoding, 
decode_policy)
+            orig_title = matches.group('origtitle').decode(html_encoding, 
decode_policy)
+            hun_langname = matches.group('lang').decode(html_encoding, 
decode_policy)
+            sub_id = matches.group('id').decode(html_encoding, decode_policy)
+            #subenv.debuglog("Found movie on search page: orig_title: %s, hun: 
%s, lang: %s, link: %s, subid: %s" % (orig_title, hun_title, hun_langname, 
link, sub_id) )
             
             hun_title, parenthesized 
=subutils.remove_parenthesized_parts(hun_title)
             orig_title = orig_title + parenthesized
@@ -116,30 +120,38 @@ def search_subtitles( file_original_path, title, tvshow, 
year, season, episode,
 
             score = 0
             rating = 0
+
+            
             orig_title_low = orig_title.lower()
+            search_low = search_string.lower()
             if (release_type != "") and (release_type in orig_title_low): 
                 score += 10
-                rating += 2
+                rating += 1
             if (releaser != "") and (releaser in orig_title_low): 
                 score += 5
-                rating += 2
+                rating += 1
             if (year != "") and (str(year) in orig_title_low):
                 score += 20
-            
+            if (orig_title_low.startswith(search_low) or 
hun_title.startswith(search_low)):
+                score += 500
+                rating += 4
+
+
             if hun_langname.lower() == "magyar": score += 1
                 
             if len(tvshow) > 0:
                 if sep in orig_title_low: 
                     score += 100
-                    rating += 6
+                    rating += 4
             else:
-                rating *= 2.5
-            #rating format must be string 
+                rating *= 1.25
+
             sync = (rating == 10)
+            #rating format must be string 
             rating = str(int(rating))
             
             subenv.debuglog("Found movie on search page: orig_title: %s, hun: 
%s, lang: %s, link: %s, flag: %s, rating: %s, score: %s" % (orig_title, 
hun_title, hun_langname, link, flag, rating, score) )
-            subtitles_list.append({'movie':  orig_title, 'filename': 
orig_title + " / " + hun_title, 'link': link, 'id': sub_id, 'language_flag': 
'flags/' + flag + '.gif', 'language_name': hun_langname, 
'movie_file':file_original_path, 'eng_language_name': eng_langname, 'sync': 
sync, 'rating': rating, 'format': 'srt', 'base_url' : base_url, 'score': score 
})
+            subtitles_list.append({'movie':  orig_title, 'filename': 
orig_title + " / " + hun_title, 'link': link, 'id': sub_id, 'language_flag': 
'flags/' + flag + '.gif', 'language_name': eng_langname, 
'movie_file':file_original_path, 'eng_language_name': eng_langname, 'sync': 
sync, 'rating': rating, 'format': 'srt', 'base_url' : base_url, 'score': score 
})
 
         subenv.debuglog("%d subtitles found" % (len(subtitles_list)) )
         error_msg = ""
@@ -154,6 +166,7 @@ def search_subtitles( file_original_path, title, tvshow, 
year, season, episode,
     except Exception, inst: 
         subenv.errorlog( "query error: %s" % (inst))
         msg = "Query error:" + str(inst)
+        subtitles_list = []
         return subtitles_list, "", msg #standard output
 
 
diff --git 
a/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/subenv.py 
b/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/subenv.py
index f7c359d..81f0297 100644
--- a/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/subenv.py
+++ b/script.xbmc.subtitles/resources/lib/services/SuperSubtitles/subenv.py
@@ -4,10 +4,12 @@ debug_pretext = "[Feliratok.hu] "
 
 def debuglog(msg):
     import xbmc
+    msg = msg.encode('ascii', 'replace')
     xbmc.log( debug_pretext + msg, level=xbmc.LOGDEBUG )     
 
 def errorlog(msg):
     import xbmc
+    msg = msg.encode('ascii', 'replace')
     xbmc.log( debug_pretext + msg, level=xbmc.LOGERROR )     
 
 def unpack_archive(archive_file, dst_dir):

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

Summary of changes:
 script.xbmc.subtitles/addon.xml                    |    2 +-
 script.xbmc.subtitles/changelog.txt                |    6 +++
 script.xbmc.subtitles/resources/lib/gui.py         |    4 +-
 .../resources/lib/services/LegendasDivx/service.py |   13 ++++---
 .../resources/lib/services/LegendasZone/service.py |   12 ++++---
 .../resources/lib/services/OmniSubs/service.py     |   10 +++--
 .../resources/lib/services/Ondertitel/service.py   |    2 +-
 .../resources/lib/services/PTSubs/service.py       |    8 +++--
 .../lib/services/SuperSubtitles/service.py         |   39 +++++++++++++-------
 .../lib/services/SuperSubtitles/subenv.py          |    2 +
 10 files changed, 64 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to