The branch, gotham has been updated
       via  acc7e36d312d2bc3bd1d8439417d520b72316960 (commit)
      from  d556d02a4bbd112407e6e190208f505d1539ef60 (commit)

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

commit acc7e36d312d2bc3bd1d8439417d520b72316960
Author: Martijn Kaijser <[email protected]>
Date:   Tue Jul 29 18:45:29 2014 +0200

    [service.subtitles.legendasdivx] 0.1.5

diff --git a/service.subtitles.legendasdivx/addon.xml 
b/service.subtitles.legendasdivx/addon.xml
index 51f9f1b..d1bbf56 100644
--- a/service.subtitles.legendasdivx/addon.xml
+++ b/service.subtitles.legendasdivx/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="service.subtitles.legendasdivx"
        name="LegendasDivx.com"
-       version="0.1.4"
+       version="0.1.5"
        provider-name="HiGhLaNdeR">
   <requires>
     <import addon="xbmc.python" version="2.14.0"/>
diff --git a/service.subtitles.legendasdivx/changelog.txt 
b/service.subtitles.legendasdivx/changelog.txt
index b308582..734d6d5 100644
--- a/service.subtitles.legendasdivx/changelog.txt
+++ b/service.subtitles.legendasdivx/changelog.txt
@@ -1,3 +1,5 @@
+0.1.5
+- Reworked subtitle search pattern, faster search results. Wierd BUG in some 
movies.
 0.1.4
 - Bug on the regex prevents ID to be fetch properly, fixed with a workaround 
(string.split).
 0.1.3
diff --git a/service.subtitles.legendasdivx/service.py 
b/service.subtitles.legendasdivx/service.py
index 418e244..6395bd5 100644
--- a/service.subtitles.legendasdivx/service.py
+++ b/service.subtitles.legendasdivx/service.py
@@ -94,7 +94,7 @@ HTTP_USER_AGENT = "User-Agent=Mozilla/5.0 (Windows; U; 
Windows NT 6.1; en-US; rv
 Release: The.Dark.Knight.2008.720p.BluRay.DTS.x264-ESiR</td>
 """
 
-subtitle_pattern = 
"<div\sclass=\"sub_box\">[\r\n\t]{2}<div\sclass=\"sub_header\">[\r\n\t]{2}<b>(.+?)</b>\s\((\d\d\d\d)\)\s.+?[\r\n\t
 
]+?[\r\n\t]</div>[\r\n\t]{2}<table\sclass=\"sub_main\scolor1\"\scellspacing=\"0\">[\r\n\t]{2}<tr>[\r\n\t]{2}.+?[\r\n\t]{2}.+?[\r\n\t]{2}<th>CDs:</th>[\r\n\t
 
]{2}<td>(.+?)</td>[\r\n\t]{2}.+?[\r\n\t]{2}.+?[\r\n\t]{2}.+?[\r\n\t]{2}<a\shref=\"\?name=Downloads&d_op=ratedownload&lid=(.+?)\">[\r\n\t]{2}.+?<img\sborder.+?[\r\n\t]{2}.+?[\r\n\t]{2}.+?[\r\n\t]{2}.+?[\r\n\t]{2}.+?[\r\n\t]{2}<th\sclass=\"color2\">Hits:</th>[\r\n\t]{2}<td>(.+?)</td>[\r\n\t
 ]{2}.+?[\r\n\t]{2}<td>(.+?)</td>[\r\n\t ]{2}.+?[\r\n\t ]{2}.+?[\r\n\t 
]{2}.+?[\r\n\t ]{2}.+?.{2,5}[\r\n\t ]{2}.+?[\r\n\t 
]{2}<td\scolspan=\"5\"\sclass=\"td_desc\sbrd_up\">((\n|.)*)</td>"
+subtitle_pattern = 
"<div\sclass=\"sub_box\">.+?<div\sclass=\"sub_header\">.+?<b>(.+?)</b>\s\((\d\d\d\d)\)\s.+?</div>.+?<table\sclass=\"sub_main\scolor1\"\scellspacing=\"0\">.+?<tr>.+?<th>CDs:</th>.+?<td>(.+?)</td>.+?<a\shref=\"\?name=Downloads&d_op=ratedownload&lid=(.+?)\">.+?<img\sborder.+?<th\sclass=\"color2\">Hits:</th>.+?<td>(.+?)</td>.+?<td>(.+?)</td>.+?<td\scolspan=\"5\"\sclass=\"td_desc\sbrd_up\">((\n|.)*)</td>.+?Mais\sLegendas"
 release_pattern = "([^\W]\w{1,}[\.|\-]{1,1}[^\.|^\ 
][^\Ws][\w{1,}\.|\-|\(\d\d\d\d\)|\[\d\d\d\d\]]{3,}[^\Ws][\w{3,}\-|\.{1,1}]\w{2,})"
 release_pattern1 = "([^\W][\w\ ]{4,}[^\Ws][x264|xvid]{1,}-[\w]{1,})"
 #release_pattern = "([^\W][\w\ |\.|\-]{4,}[^\Ws][x264|xvid]{1,}-[\w]{1,})"
@@ -169,7 +169,7 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
             desc = re.sub('\n',' ',desc)
             desc = re.sub(':.','',desc)
             #Remove HTML tags on the commentaries
-            filename = re.sub(r'<[^<]+?>','', filename)
+            filename = re.sub('\n',' ',filename.decode('utf8', 'ignore'))
             desc = re.sub(r'<[^<]+?>|[~]','', desc)
             log(u"getallsubs: Final Description = '%s'" % desc.decode('utf8', 
'ignore'))
             #Find filename on the comentaries to show sync label using 
filename or dirname (making it global for further usage)
@@ -336,27 +336,28 @@ def Search(item):
                     title = os.path.split(file_original_path)
                     searchstring = title[-1]
             else:
-                if title == '':
-                    title = os.path.split(file_original_path)
-                    searchstring = title[-1]
-                    log(u"Search: TITLE is NULL using filename as String = %s" 
% (searchstring,))
-                else:
-                    if __search__ == '0':
-                        if re.search("(.+?s[0-9][0-9]e[0-9][0-9])", filename, 
re.IGNORECASE):
-                            searchstring = 
re.search("(.+?s[0-9][0-9]e[0-9][0-9])", filename, re.IGNORECASE)
-                            searchstring = searchstring.group(0)
-                            log(u"Search: Filename is TV String (search is 0) 
= %s" % (searchstring,))
-                        else:
-                            searchstring = filename
-                            log(u"Search: Filename is Not TV String (search is 
0) = %s" % (searchstring,))
-                    else:
-                        if re.search("(.+?s[0-9][0-9]e[0-9][0-9])", title, 
re.IGNORECASE):
-                            searchstring = 
re.search("(.+?s[0-9][0-9]e[0-9][0-9])", title, re.IGNORECASE)
-                            searchstring = searchstring.group(0)
-                            log(u"Search: Title is TV String (search is 1) = 
%s" % (searchstring,))
-                        else:
-                            searchstring = title
-                            log(u"Search: Title is Not TV String (search is 1) 
= %s" % (searchstring,))
+                # if title == '':
+                    # title = os.path.split(file_original_path)
+                    # searchstring = title[-1]
+                    # log(u"Search: TITLE is NULL using filename as String = 
%s" % (searchstring,))
+                # else:
+                ########## TODO: EXTRACT THE YEAR FROM THE FILENAME AND ADD IT 
TO THE SEARCH (WILL BE DONE IN THE NEXT DAYS) ###########
+                               if __search__ == '0':
+                                       if 
re.search("(.+?s[0-9][0-9]e[0-9][0-9])", filename, re.IGNORECASE):
+                                               searchstring = 
re.search("(.+?s[0-9][0-9]e[0-9][0-9])", filename, re.IGNORECASE)
+                                               searchstring = 
searchstring.group(0)
+                                               log(u"Search: Filename is TV 
String (search is 0) = %s" % (searchstring,))
+                                       else:
+                                               searchstring = filename
+                                               log(u"Search: Filename is Not 
TV String (search is 0) = %s" % (searchstring,))
+                               else:
+                                       if 
re.search("(.+?s[0-9][0-9]e[0-9][0-9])", title, re.IGNORECASE):
+                                               searchstring = 
re.search("(.+?s[0-9][0-9]e[0-9][0-9])", title, re.IGNORECASE)
+                                               searchstring = 
searchstring.group(0)
+                                               log(u"Search: Title is TV 
String (search is 1) = %s" % (searchstring,))
+                                       else:
+                                               searchstring = title
+                                               log(u"Search: Title is Not TV 
String (search is 1) = %s" % (searchstring,))
 
     PT_ON = __addon__.getSetting( 'PT' )
     PTBR_ON = __addon__.getSetting( 'PTBR' )
@@ -522,9 +523,9 @@ if params['action'] == 'search' or params['action'] == 
'manualsearch':
     for lang in urllib.unquote(params['languages']).decode('utf-8').split(','):
         item['languages'].append(xbmc.convertLanguage(lang, xbmc.ISO_639_2))
 
-    if not item['title']:
-        # no original title, get just Title
-        item['title']  = 
normalizeString(xbmc.getInfoLabel("VideoPlayer.Title"))
+#    if not item['title']:
+#        # no original title, get just Title
+#        item['title']  = 
normalizeString(xbmc.getInfoLabel("VideoPlayer.Title"))
 
     if "s" in item['episode'].lower():
         # Check if season is "Special"

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

Summary of changes:
 service.subtitles.legendasdivx/addon.xml     |    2 +-
 service.subtitles.legendasdivx/changelog.txt |    2 +
 service.subtitles.legendasdivx/service.py    |   53 +++++++++++++-------------
 3 files changed, 30 insertions(+), 27 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to