The branch, gotham has been updated
       via  0207f6f117a89dce2dbab6c704af234033c52500 (commit)
      from  6bb49cc34bdee3363e014925730a0fb9a230b6a3 (commit)

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

commit 0207f6f117a89dce2dbab6c704af234033c52500
Author: Martijn Kaijser <[email protected]>
Date:   Sun Jun 1 12:26:39 2014 +0200

    [service.subtitles.legendasdivx] 0.0.8

diff --git a/service.subtitles.legendasdivx/addon.xml 
b/service.subtitles.legendasdivx/addon.xml
index c8e5e9c..ebe10c6 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.0.5"
+       version="0.0.8"
        provider-name="HiGhLaNdeR">
   <requires>
     <import addon="xbmc.python" version="2.14.0"/>
@@ -10,8 +10,10 @@
              library="service.py" />
   <extension point="xbmc.addon.metadata">
     <summary lang="en">LegendasDivx.com - Search and Download 
Subtitles</summary>
-    <description lang="en">Search and download subtitles from 
LegendasDivx.com. Please check the add-on configuration before using 
it!</description>
+    <description lang="en">Search and download subtitles from 
LegendasDivx.com. Please check the add-on configuration before using it! Note: 
The "Force Full Description" switch will grab all the text in the website 
including all the non useful information. The "Parent Folder Search and Match" 
set to "AUTO" will first search by parent folder but if it's not a release then 
it will search normally, it's recommend to leave it "AUTO". Library is always 
primary this is only for non Library Movies\TVSHOWS.</description>
+    <description lang="pt">Procura e download de legendas do site 
LegendasDivx.com. Por favor verifica as configurações do add-on antes de 
usar! Nota: O campo "Forçar Descrição Completa" vai mostrar todo o texto da 
descrição da legenda, mesmo o que não interessa. O campo "Procura e 
sincroniza pela pasta do filme" em modo "AUTO" vai primeiro tentar procurar 
pelo nome da directoria "PAI" mas se a mesma não for uma release irá procurar 
pelo nome do ficheiro, recomenda-se que esteja em "AUTO". Se o filme ou série 
estiver na Libraria, o nome do filme\serie é da Libraria.</description>
     <disclaimer lang="en">[email protected]</disclaimer>
+    <disclaimer lang="pt">[email protected]</disclaimer>
     <language>pt en</language>
     <platform>all</platform>
     <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
diff --git a/service.subtitles.legendasdivx/changelog.txt 
b/service.subtitles.legendasdivx/changelog.txt
index dab1294..7622ae8 100644
--- a/service.subtitles.legendasdivx/changelog.txt
+++ b/service.subtitles.legendasdivx/changelog.txt
@@ -1,3 +1,14 @@
+0.0.8
+- Fixed more Unicode issues.
+0.0.7
+- Fixed a bug that prevents searching all chosen subtitle languages.
+- Improved search algorithm for library TVSHOWS and MOVIES.
+- Added Portuguese (Brazil) missing strings.xml.
+0.0.6
+- Added new pattern to find releases with spaces instead of dots (please start 
using dots in the release description).
+- If there's no match with the patterns when searching for releases it will 
put the full description.
+- Fix unicode issue when searching and the interface was set to Portuguese.
+- Last resort search will always be by title if filename and parent folder 
fails.
 0.0.5
 - Improved SYNC matching REGEX.
 - Fixed a missing string in all languages.
diff --git 
a/service.subtitles.legendasdivx/resources/language/English/strings.xml 
b/service.subtitles.legendasdivx/resources/language/English/strings.xml
index 3fb24bd..3846a4e 100644
--- a/service.subtitles.legendasdivx/resources/language/English/strings.xml
+++ b/service.subtitles.legendasdivx/resources/language/English/strings.xml
@@ -8,7 +8,7 @@
     <string id="32005">Portuguese Brazilian Enabled</string>
     <string id="32006">Spanish Enabled</string>
     <string id="32007">English Enabled</string>
-    <string id="32008">Full Description</string>
+    <string id="32008">Force Full Description (Garbage text included)</string>
     <string id="32009">No RELEASE in description!</string>
     <string id="32010">Parent Folder Search and Match</string>
     <string id="32011">Auto</string>
diff --git 
a/service.subtitles.legendasdivx/resources/language/Portuguese/strings.xml 
b/service.subtitles.legendasdivx/resources/language/Portuguese/strings.xml
index 82cd7b3..e708d72 100644
--- a/service.subtitles.legendasdivx/resources/language/Portuguese/strings.xml
+++ b/service.subtitles.legendasdivx/resources/language/Portuguese/strings.xml
@@ -8,7 +8,7 @@
     <string id="32005">Português Brasileiro Activo</string>
     <string id="32006">Espanhol Activo</string>
     <string id="32007">Inglês Activo</string>
-    <string id="32008">Descrição Completa</string>
+    <string id="32008">Forçar Descrição Completa (Texto com "lixo" 
incluído)</string>
     <string id="32009">Sem RELEASE na descrição!</string>
     <string id="32010">Procura e sincroniza pela pasta do filme</string>
     <string id="32011">Auto</string>
diff --git a/service.subtitles.legendasdivx/service.py 
b/service.subtitles.legendasdivx/service.py
index 9eb2154..bcabbdb 100644
--- a/service.subtitles.legendasdivx/service.py
+++ b/service.subtitles.legendasdivx/service.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Service LegendasDivx.com version 0.0.5
+# Service LegendasDivx.com version 0.0.8
 # Code based on Undertext (FRODO) service
 # Coded by HiGhLaNdR@OLDSCHOOL
 # Ported to Gotham by HiGhLaNdR@OLDSCHOOL
@@ -44,7 +44,7 @@ __descon__ = __addon__.getSetting( 'DESC' )
 
 main_url = "http://www.legendasdivx.com/";
 debug_pretext = "LegendasDivx"
-SEARCH_PAGE_URL = main_url + 
"modules.php?name=Downloads&file=jz&d_op=search_next&order=&form_cat=28&page=%(page)s&query=%(query)s"
+#SEARCH_PAGE_URL = main_url + 
"modules.php?name=Downloads&file=jz&d_op=search_next&order=&form_cat=28&page=%(page)s&query=%(query)s"
 
 INTERNAL_LINK_URL = 
"plugin://%(scriptid)s/?action=download&id=%(id)s&filename=%(filename)s"
 SUB_EXTS = ['srt', 'sub', 'txt', 'aas', 'ssa', 'smi']
@@ -93,6 +93,8 @@ 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}.+?[\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>"
 release_pattern = "([^\W]\w{1,}\.{1,1}[^\.|^\ 
][\w{1,}\.|\-|\(\d\d\d\d\)|\[\d\d\d\d\]]{3,}[\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,})"
 # group(1) = Name, group(2) = Year, group(3) = Number Files, group(4) = ID, 
group(5) = Hits, group(6) = Requests, group(7) = Description
 #==========
 # Functions
@@ -149,16 +151,23 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
             if (downloads > 5):
                 downloads=5
             filename = string.strip(matches.group(1))
-            desc = string.strip(matches.group(7))
+            desc_ori = string.strip(matches.group(7))
             #log(u"_desc_dirty '%s' ..." % desc)
             #Remove new lines on the commentaries
             filename = re.sub('\n',' ',filename)
             if __descon__ == "false":
-                desc = re.findall(release_pattern, desc, re.IGNORECASE | 
re.VERBOSE | re.DOTALL | re.UNICODE | re.MULTILINE)
+                desc = re.findall(release_pattern, desc_ori, re.IGNORECASE | 
re.VERBOSE | re.DOTALL | re.UNICODE | re.MULTILINE)
                 desc = " / ".join(desc)
                 if desc == "":
-                    desc = __language__(32009)
-            desc = desc.decode('latin1')
+                    desc = re.findall(release_pattern1, desc_ori, 
re.IGNORECASE | re.VERBOSE | re.DOTALL | re.UNICODE | re.MULTILINE)
+                    desc = " / ".join(desc)
+                    if desc == "":
+                        #desc = 
__language__(32009).encode('utf8').decode('utf8')
+                        desc = desc_ori.decode('utf8', 'ignore')
+                    else:
+                        desc = desc.decode('utf8', 'ignore')
+            else:
+                desc = desc_ori.decode('utf8', 'ignore')
             desc = re.sub('<br />',' ',desc)
             desc = re.sub('<br>',' ',desc)
             desc = re.sub('\n',' ',desc)
@@ -199,7 +208,7 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
             if __parentfolder__ == '2':
                 if (searchstring_notclean != ""):
                     sync = False
-                    if string.lower(searchstring_notclean) in 
string.lower(desc):
+                    if string.lower(searchstring_notclean) in 
string.lower(desc.decode('utf8', 'ignore')):
                         sync = True
                 else:
                     if (string.lower(dirsearch_check[-1]) == "rar") or 
(string.lower(dirsearch_check[-1]) == "cd1") or 
(string.lower(dirsearch_check[-1]) == "cd2"):
@@ -317,7 +326,9 @@ def Search(item):
     else:
         if tvshow != '':
             searchstring = "%s S%#02dE%#02d" % (tvshow, int(season), 
int(episode))
-        if tvshow == '':
+        elif title != '' and tvshow != '':
+            searchstring = title
+        else:
             if 'rar' in israr and searchstring is not None:
                 log(u"RAR Searchstring string = %s" % (searchstring,))
                 if 'cd1' in string.lower(title) or 'cd2' in 
string.lower(title) or 'cd3' in string.lower(title):
@@ -348,7 +359,7 @@ def Search(item):
                     title = os.path.split(file_original_path)
                     searchstring = title[-1]
             else:
-                if title == "":
+                if title == '':
                     title = os.path.split(file_original_path)
                     searchstring = title[-1]
                     #log(u"TITLE NULL Searchstring string = %s" % 
(searchstring,))
@@ -365,19 +376,19 @@ def Search(item):
         subtitles_list = getallsubs(searchstring, "pt", "Portuguese", 
file_original_path, searchstring_notclean)
         for sub in subtitles_list:
             append_subtitle(sub)
-    elif 'por' in item['languages'] and PTBR_ON == 'true':
+    if 'por' in item['languages'] and PTBR_ON == 'true':
         subtitles_list = getallsubs(searchstring, "pb", "Brazilian", 
file_original_path, searchstring_notclean)
         for sub in subtitles_list:
             append_subtitle(sub)
-    elif 'spa' in item['languages'] and ES_ON == 'true':
+    if 'spa' in item['languages'] and ES_ON == 'true':
         subtitles_list = getallsubs(searchstring, "es", "Spanish", 
file_original_path, searchstring_notclean)
         for sub in subtitles_list:
             append_subtitle(sub)
-    elif 'eng' in item['languages'] and EN_ON == 'true':
+    if 'eng' in item['languages'] and EN_ON == 'true':
         subtitles_list = getallsubs(searchstring, "en", "English", 
file_original_path, searchstring_notclean)
         for sub in subtitles_list:
             append_subtitle(sub)
-    else:
+    if 'eng' not in item['languages'] and 'spa' not in item['languages'] and 
'por' not in item['languages'] and 'por' not in item['languages']:
         xbmc.executebuiltin((u'Notification(%s,%s,%d)' % (__scriptname__ , 
'Only Portuguese | Portuguese Brazilian | English | Spanish.',15000)))
 
 def recursive_glob(treeroot, pattern):
@@ -455,7 +466,7 @@ def Download(id, filename):
                 # determine if there is a newer file created in __temp__ 
(marks that the extraction had completed)
                 for file in files:
                     if file.split('.')[-1] in SUB_EXTS:
-                        mtime = os.stat(pjoin(__temp__, 
file.decode("utf-8"))).st_mtime
+                        mtime = os.stat(pjoin(__temp__, 
file.encode("utf-8").decode("utf-8"))).st_mtime
                         if mtime > max_mtime:
                             max_mtime =  mtime
                 waittime  = waittime + 1

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

Summary of changes:
 service.subtitles.legendasdivx/addon.xml           |    6 ++-
 service.subtitles.legendasdivx/changelog.txt       |   11 ++++++
 .../resources/language/English/strings.xml         |    2 +-
 .../language/Portuguese (Brazil)/strings.xml       |   17 +++++++++
 .../resources/language/Portuguese/strings.xml      |    2 +-
 service.subtitles.legendasdivx/service.py          |   39 +++++++++++++-------
 6 files changed, 59 insertions(+), 18 deletions(-)
 create mode 100644 
service.subtitles.legendasdivx/resources/language/Portuguese 
(Brazil)/strings.xml


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to