The branch, gotham has been updated
       via  b9338ce5a3453745819e14a5e4835797b1f2aaed (commit)
       via  0b61ecede11953cfc0f697815a23e283ce6bc8ab (commit)
      from  d16516a0bc71491388e964a6df820a85dd4c4d33 (commit)

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

commit b9338ce5a3453745819e14a5e4835797b1f2aaed
Author: Martijn Kaijser <[email protected]>
Date:   Thu Jun 12 20:09:12 2014 +0200

    [service.subtitles.legendaszone] 0.1.0

diff --git a/service.subtitles.legendaszone/addon.xml 
b/service.subtitles.legendaszone/addon.xml
index 746c017..97c4cd2 100644
--- a/service.subtitles.legendaszone/addon.xml
+++ b/service.subtitles.legendaszone/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="service.subtitles.legendaszone"
        name="Legendas-Zone.org"
-       version="0.0.3"
+       version="0.1.0"
        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">Legendas-Zone.org</summary>
-    <description lang="en">Search and download subtitles from 
Legendas-Zone.org! Ain't it nice?</description>
+    <description lang="en">Search and download subtitles from 
Legendas-Zone.org. Please check the add-on configuration before using it! Note: 
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 
Legendas-Zone.org. Por favor verifica as configurações do add-on antes de 
usar! Nota: 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.legendaszone/changelog.txt 
b/service.subtitles.legendaszone/changelog.txt
index e9e06ec..15abd52 100644
--- a/service.subtitles.legendaszone/changelog.txt
+++ b/service.subtitles.legendaszone/changelog.txt
@@ -1,3 +1,18 @@
+0.1.0
+- Fix the decoding BUG in Raspberry Pi (Linux and Windows have different 
behaviours).
+- New pattern for the last resort search to check if it's a movie or tvshow.
+- Account verification added.
+- Fixed more Unicode issues.
+- Fixed a bug that prevents searching all chosen subtitle languages.
+- Improved search algorithm for library TVSHOWS and MOVIES.
+- Added Portuguese (Brazil) missing strings.xml.
+- 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.
+- Fixed a missing string in all languages.
+- Added Parent Folder search and sync matching. Choose in addon settings AUTO 
or OFF. AUTO checks if parent folder is a release and if true it will be used 
for search and sync.
+- Improved SYNC matching.
+- Some fixes and changes on the code.
 0.0.3
 - Changed description display and fixed rating score.
 0.0.2
diff --git 
a/service.subtitles.legendaszone/resources/language/English/strings.xml 
b/service.subtitles.legendaszone/resources/language/English/strings.xml
index ec1b6ec..1cca3fa 100644
--- a/service.subtitles.legendaszone/resources/language/English/strings.xml
+++ b/service.subtitles.legendaszone/resources/language/English/strings.xml
@@ -8,4 +8,16 @@
     <string id="32005">Portuguese Brazilian Enabled</string>
     <string id="32006">Spanish Enabled</string>
     <string id="32007">English Enabled</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>
+    <string id="32012">Always on</string>
+    <string id="32013">Off</string>
+    <string id="32014">Language Settings</string>
+    <string id="32015">Advanced Settings</string>
+    <string id="32016">Username is required! Check add-on setttings!</string>
+    <string id="32017">Password is required! Check add-on setttings!</string>
+    <string id="32018">Username and Password is required! Check add-on 
setttings!</string>
+    <string id="32019">Only for registered users! Wrong username and/or 
password? Check add-on settings. Thanks.</string>
 </strings>
diff --git 
a/service.subtitles.legendaszone/resources/language/Portuguese/strings.xml 
b/service.subtitles.legendaszone/resources/language/Portuguese/strings.xml
index d5d5883..186e9b9 100644
--- a/service.subtitles.legendaszone/resources/language/Portuguese/strings.xml
+++ b/service.subtitles.legendaszone/resources/language/Portuguese/strings.xml
@@ -8,4 +8,16 @@
     <string id="32005">Português Brasileiro Activo</string>
     <string id="32006">Espanhol Activo</string>
     <string id="32007">Inglês Activo</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>
+    <string id="32012">Sempre ligado</string>
+    <string id="32013">Desligado</string>
+    <string id="32014">Idiomas (Site)</string>
+    <string id="32015">Avançadas</string>
+    <string id="32016">O utilizador é obrigatório! Verifique as definições 
do serviço!</string>
+    <string id="32017">A palavra-passe é obrigatória! Verifique as 
definições do serviço!</string>
+    <string id="32018">O utilizador e palavra-passe são obrigatórios! 
Verifique as definições do serviço!</string>
+    <string id="32019">Apenas para utilizadores registados! Utilizador e/ou 
Palavra-passe errados? Verifique as definições do serviço!. 
Obrigado.</string>
 </strings>
diff --git a/service.subtitles.legendaszone/resources/settings.xml 
b/service.subtitles.legendaszone/resources/settings.xml
index a58baf7..e7c2741 100644
--- a/service.subtitles.legendaszone/resources/settings.xml
+++ b/service.subtitles.legendaszone/resources/settings.xml
@@ -3,9 +3,14 @@
     <category label="32003">
       <setting id="LZuser" type="text" label="32001" default=""/>
       <setting id="LZpass" type="text" option = "hidden" label="32002" 
default=""/>
+    </category>   
+    <category label="32014">
       <setting id="PT" type="bool" label="32004" default="true"/>
       <setting id="PTBR" type="bool" label="32005" default="true"/>
       <setting id="ES" type="bool" label="32006" default="true"/>
       <setting id="EN" type="bool" label="32007" default="true"/>
     </category>   
-</settings>
+    <category label="32015">
+      <setting id="PARENT" type="enum" lvalues="32011|32013" label="32010" 
default="0"/>
+    </category>   
+</settings>
\ No newline at end of file
diff --git a/service.subtitles.legendaszone/service.py 
b/service.subtitles.legendaszone/service.py
index 4737368..2e484b7 100644
--- a/service.subtitles.legendaszone/service.py
+++ b/service.subtitles.legendaszone/service.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
-# Service Legendas-Zone.org version 0.0.3
-# Code based on Undertext (FRODO) service and the download function encode fix 
from legendastv (FRODO) service
+# Service Legendas-Zone.org version 0.1.0
+# Code based on Undertext (FRODO) service
 # Coded by HiGhLaNdR@OLDSCHOOL
 # Ported to Gotham by HiGhLaNdR@OLDSCHOOL
 # Help by VaRaTRoN
@@ -25,7 +25,6 @@ import xbmcplugin
 import xbmcvfs
 import cookielib
 import urllib2
-from operator import itemgetter, attrgetter
 
 __addon__ = xbmcaddon.Addon()
 __author__     = __addon__.getAddonInfo('author')
@@ -37,16 +36,13 @@ __language__   = __addon__.getLocalizedString
 __cwd__        = 
xbmc.translatePath(__addon__.getAddonInfo('path')).decode("utf-8")
 __profile__    = 
xbmc.translatePath(__addon__.getAddonInfo('profile')).decode("utf-8")
 __resource__   = xbmc.translatePath(pjoin(__cwd__, 'resources', 'lib' ) 
).decode("utf-8")
-__temp__       = xbmc.translatePath(pjoin(__profile__, 'temp')).decode("utf-8")
+__temp__       = xbmc.translatePath(pjoin(__profile__, 'temp'))
 
 sys.path.append (__resource__)
 
 main_url = "http://www.legendas-zone.org/";
 debug_pretext = "LegendasZone"
-
-
-MAIN_SUBDIVX_URL = "http://www.legendas-zone.org/";
-SEARCH_PAGE_URL = MAIN_SUBDIVX_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_SUBDIVX_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']
@@ -68,6 +64,8 @@ multiple_results_pattern = 
"<td\salign=\"left\".+?<b><a\shref=\"legendas.php\?im
 # group(1) = IMDB
 imdb_pattern = "<td class=\"result_text\"> <a\shref=\"\/title\/tt(.+?)\/\?"
 # group(1) = IMDB
+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,})"
 
 #==========
 # Functions
@@ -110,8 +108,7 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
 
     page = 0
     if languageshort == "pb":
-            languageshort = "br"
-    #url = main_url + "legendas.php?l=" + languageshort + "&page=" + str(page) 
+ "&s=" + urllib.quote_plus(searchstring)
+        languageshort = "br"
     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:
@@ -159,36 +156,47 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
                 dirsearch_check = string.split(dirsearch[-1], '.')
                 #For DEBUG only uncomment next line
                 #log( __name__ ,"%s dirsearch_check: '%s'" % (debug_pretext, 
dirsearch_check))
-                if (searchstring_notclean != ""):
-                    sync = False
-                    if re.search(searchstring_notclean, desc):
+                #### PARENT FOLDER TWEAK DEFINED IN THE ADD-ON SETTINGS (AUTO 
| ALWAYS ON (DEACTIVATED) | OFF)
+                __parentfolder__ = __addon__.getSetting( 'PARENT' )
+                if __parentfolder__ == '0':
+                    if re.search(release_pattern, dirsearch[-1], 
re.IGNORECASE):
+                        __parentfolder__ = '1'
+                    else:
+                        __parentfolder__ = '2'
+                if __parentfolder__ == '1':
+                    if re.search(dirsearch[-1], desc, re.IGNORECASE):
                         sync = True
-                else:
-                    if (string.lower(dirsearch_check[-1]) == "rar") or 
(string.lower(dirsearch_check[-1]) == "cd1") or 
(string.lower(dirsearch_check[-1]) == "cd2"):
-                        sync = False
-                        if len(dirsearch) > 1 and dirsearch[1] != '':
-                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc) or re.search(dirsearch[-2], desc):
-                                sync = True
-                        else:
-                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc):
-                                sync = True
                     else:
                         sync = False
-                        if len(dirsearch) > 1 and dirsearch[1] != '':
-                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc) or re.search(dirsearch[-1], desc):
-                                sync = True
+                if __parentfolder__ == '2':
+                    if (searchstring_notclean != ""):
+                        sync = False
+                        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"):
+                            sync = False
+                            if len(dirsearch) > 1 and dirsearch[1] != '':
+                                if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE) or 
re.search(dirsearch[-2], desc, re.IGNORECASE):
+                                    sync = True
+                            else:
+                                if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE):
+                                    sync = True
                         else:
-                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc):
-                                sync = True
-                filename = filename + "  " + "hits: " + hits + " uploader: " + 
uploader + " "
-                #log(u"DN string = %s" % (downloads,))
+                            sync = False
+                            if len(dirsearch) > 1 and dirsearch[1] != '':
+                                if 
re.search(filesearch[1][:len(filesearch[1])-4], desc) or 
re.search(dirsearch[-1], desc, re.IGNORECASE):
+                                    sync = True
+                            else:
+                                if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE):
+                                    sync = True
+                filename = filename + "  " + "hits: " + hits + " uploader: " + 
uploader
                 if languageshort == "br":
                     languageshort = "pb"
                 subtitles_list.append({'rating': str(downloads), 'no_files': 
no_files, 'id': id, 'filename': filename, 'desc': desc, 'sync': sync, 'hits': 
hits, 'language_short': languageshort, 'language_name': languagelong})
             page = page + 1
             if languageshort == "br":
                 languageshort = "pb"
-#           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:
@@ -265,24 +273,24 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
                             #log( __name__ ,"%s dirsearch_check: '%s'" % 
(debug_pretext, dirsearch_check))
                             if (searchstring_notclean != ""):
                                 sync = False
-                                if re.search(searchstring_notclean, desc):
+                                if re.search(searchstring_notclean, desc, 
re.IGNORECASE):
                                     sync = True
                             else:
                                 if (string.lower(dirsearch_check[-1]) == 
"rar") or (string.lower(dirsearch_check[-1]) == "cd1") or 
(string.lower(dirsearch_check[-1]) == "cd2"):
                                     sync = False
                                     if len(dirsearch) > 1 and dirsearch[1] != 
'':
-                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc) or 
re.search(dirsearch[-2], desc):
+                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE) or 
re.search(dirsearch[-2], desc, re.IGNORECASE):
                                             sync = True
                                     else:
-                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc):
+                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE):
                                             sync = True
                                 else:
                                     sync = False
                                     if len(dirsearch) > 1 and dirsearch[1] != 
'':
-                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc) or 
re.search(dirsearch[-1], desc):
+                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE) or 
re.search(dirsearch[-1], desc, re.IGNORECASE):
                                             sync = True
                                     else:
-                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc):
+                                        if 
re.search(filesearch[1][:len(filesearch[1])-4], desc, re.IGNORECASE):
                                             sync = True
                             filename = filename + "  " + "hits: " + hits + " 
uploader: " + uploader + " "
                             if languageshort == "br":
@@ -423,10 +431,36 @@ def Search(item):
     #### Do what's needed to get the list of subtitles from service site
     #### use item["some_property"] that was set earlier
     #### once done, set xbmcgui.ListItem() below and pass it to 
xbmcplugin.addDirectoryItem()
-    filename = 
os.path.splitext(os.path.basename(item['file_original_path']))[0]
+    if username == '' or password == '':
+        xbmcplugin.endOfDirectory(int(sys.argv[1]))
+        if username == '' and password != '':
+            xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32016).encode('utf-8'),5000)))
+        if username != '' and password == '':
+            xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32017).encode('utf-8'),5000)))
+        if username == '' and password == '':
+            xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32018).encode('utf-8'),5000)))
+    #### PARENT FOLDER TWEAK DEFINED IN THE ADD-ON SETTINGS (AUTO | ALWAYS ON 
(DEACTIVATED) | OFF)
     file_original_path = item['file_original_path']
-    filename = xbmc.getCleanMovieTitle(filename)
-    searchstring_notclean = 
os.path.splitext(os.path.basename(item['file_original_path']))[0]
+    __parentfolder__ = __addon__.getSetting( 'PARENT' )
+    if __parentfolder__ == '0':
+        filename = os.path.abspath(file_original_path)
+        dirsearch = filename.split(os.sep)
+        #log(u"dirsearch_search string = %s" % (dirsearch,))
+        if re.search(release_pattern, dirsearch[-2], re.IGNORECASE):
+            __parentfolder__ = '1'
+        else:
+            __parentfolder__ = '2'
+    if __parentfolder__ == '1':
+        filename = os.path.abspath(file_original_path)
+        dirsearch = filename.split(os.sep)
+        filename = dirsearch[-2]
+        #log(u"__parentfolder1__ = %s" % (filename,))
+    if __parentfolder__ == '2':   
+        filename = os.path.splitext(os.path.basename(file_original_path))[0]
+        #log(u"__parentfolder2__ = %s" % (filename,))
+
+    filename = xbmc.getCleanMovieTitle(filename)[0]
+    searchstring_notclean = 
os.path.splitext(os.path.basename(file_original_path))[0]
     searchstring = ""
     global israr
     israr = os.path.abspath(file_original_path)
@@ -449,8 +483,9 @@ def Search(item):
     else:
         if tvshow != '':
             searchstring = "%s S%#02dE%#02d" % (tvshow, int(season), 
int(episode))
-            #log(u"TV Searchstring string = %s" % (searchstring,))
-        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):
@@ -481,13 +516,18 @@ 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,))
                 else:
-                    searchstring = title
-                    #log(u"TITLE Searchstring string = %s" % (searchstring,))
+                    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"FilenameTV Searchstring = %s" % (searchstring,))
+                    else:
+                        searchstring = filename
+                        #log(u"Filename Searchstring = %s" % (searchstring,))
 
     PT_ON = __addon__.getSetting( 'PT' )
     PTBR_ON = __addon__.getSetting( 'PTBR' )
@@ -510,8 +550,8 @@ def Search(item):
         subtitles_list = getallsubs(searchstring, "en", "English", 
file_original_path, searchstring_notclean)
         for sub in subtitles_list:
             append_subtitle(sub)
-    #else:
-        #xbmc.executebuiltin((u'Notification(%s,%s)' % (__scriptname__ , 'only 
works for Portuguese,Brazilian,English,Spanish')).encode('utf-8'))
+    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.',5000)))
 
 def recursive_glob(treeroot, pattern):
     results = []
@@ -549,6 +589,10 @@ def Download(id, filename):
 
     content = get_download(main_url+'fazendologin.php', 
main_url+'downloadsub.php', id)
     content = content.read()
+    #### If user is not registered or User\Pass is misspelled it will generate 
an error message and break the script execution!
+    if 'Nota: Necessita de ter os cookies e javascript ativos devido a 
encriptao de log in.' in content.decode('utf8', 'ignore'):
+        xbmcplugin.endOfDirectory(int(sys.argv[1]))
+        xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32019).encode('utf8'),5000)))
 
     if content is not None:
         header = content[:4]

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=0b61ecede11953cfc0f697815a23e283ce6bc8ab

commit 0b61ecede11953cfc0f697815a23e283ce6bc8ab
Author: Martijn Kaijser <[email protected]>
Date:   Thu Jun 12 20:08:06 2014 +0200

    [service.subtitles.pipocas] 0.1.0

diff --git a/service.subtitles.pipocas/addon.xml 
b/service.subtitles.pipocas/addon.xml
index edfeab8..ab7192b 100644
--- a/service.subtitles.pipocas/addon.xml
+++ b/service.subtitles.pipocas/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="service.subtitles.pipocas"
        name="Pipocas.tv"
-       version="0.0.2"
+       version="0.1.0"
        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">Pipocas.tv</summary>
-    <description lang="en">Search and download subtitles from Pipocas.tv! 
Ain't it nice?</description>
+    <description lang="en">Search and download subtitles from Pipocas.tv. 
Please check the add-on configuration before using it! Note: 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 Pipocas.tv. 
Por favor verifica as configurações do add-on antes de usar! Nota: 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.pipocas/changelog.txt 
b/service.subtitles.pipocas/changelog.txt
index 0aedbc3..962642b 100644
--- a/service.subtitles.pipocas/changelog.txt
+++ b/service.subtitles.pipocas/changelog.txt
@@ -1,3 +1,18 @@
+0.1.0
+- Fix the decoding BUG in Raspberry Pi (Linux and Windows have different 
behaviours).
+- New pattern for the last resort search to check if it's a movie or tvshow.
+- Account verification added.
+- Fixed more Unicode issues.
+- Fixed a bug that prevents searching all chosen subtitle languages.
+- Improved search algorithm for library TVSHOWS and MOVIES.
+- Added Portuguese (Brazil) missing strings.xml.
+- 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.
+- Fixed a missing string in all languages.
+- Added Parent Folder search and sync matching. Choose in addon settings AUTO 
or OFF. AUTO checks if parent folder is a release and if true it will be used 
for search and sync.
+- Improved SYNC matching.
+- Some fixes and changes on the code.
 0.0.2
 - Changed description display and fixed rating score.
 0.0.1
diff --git a/service.subtitles.pipocas/resources/language/English/strings.xml 
b/service.subtitles.pipocas/resources/language/English/strings.xml
index ec1b6ec..1cca3fa 100644
--- a/service.subtitles.pipocas/resources/language/English/strings.xml
+++ b/service.subtitles.pipocas/resources/language/English/strings.xml
@@ -8,4 +8,16 @@
     <string id="32005">Portuguese Brazilian Enabled</string>
     <string id="32006">Spanish Enabled</string>
     <string id="32007">English Enabled</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>
+    <string id="32012">Always on</string>
+    <string id="32013">Off</string>
+    <string id="32014">Language Settings</string>
+    <string id="32015">Advanced Settings</string>
+    <string id="32016">Username is required! Check add-on setttings!</string>
+    <string id="32017">Password is required! Check add-on setttings!</string>
+    <string id="32018">Username and Password is required! Check add-on 
setttings!</string>
+    <string id="32019">Only for registered users! Wrong username and/or 
password? Check add-on settings. Thanks.</string>
 </strings>
diff --git 
a/service.subtitles.pipocas/resources/language/Portuguese/strings.xml 
b/service.subtitles.pipocas/resources/language/Portuguese/strings.xml
index d5d5883..186e9b9 100644
--- a/service.subtitles.pipocas/resources/language/Portuguese/strings.xml
+++ b/service.subtitles.pipocas/resources/language/Portuguese/strings.xml
@@ -8,4 +8,16 @@
     <string id="32005">Português Brasileiro Activo</string>
     <string id="32006">Espanhol Activo</string>
     <string id="32007">Inglês Activo</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>
+    <string id="32012">Sempre ligado</string>
+    <string id="32013">Desligado</string>
+    <string id="32014">Idiomas (Site)</string>
+    <string id="32015">Avançadas</string>
+    <string id="32016">O utilizador é obrigatório! Verifique as definições 
do serviço!</string>
+    <string id="32017">A palavra-passe é obrigatória! Verifique as 
definições do serviço!</string>
+    <string id="32018">O utilizador e palavra-passe são obrigatórios! 
Verifique as definições do serviço!</string>
+    <string id="32019">Apenas para utilizadores registados! Utilizador e/ou 
Palavra-passe errados? Verifique as definições do serviço!. 
Obrigado.</string>
 </strings>
diff --git a/service.subtitles.pipocas/resources/settings.xml 
b/service.subtitles.pipocas/resources/settings.xml
index 7bec0b6..ba40749 100644
--- a/service.subtitles.pipocas/resources/settings.xml
+++ b/service.subtitles.pipocas/resources/settings.xml
@@ -3,9 +3,14 @@
     <category label="32003">
       <setting id="PPuser" type="text" label="32001" default=""/>
       <setting id="PPpass" type="text" option = "hidden" label="32002" 
default=""/>
+    </category>   
+    <category label="32014">
       <setting id="PT" type="bool" label="32004" default="true"/>
       <setting id="PTBR" type="bool" label="32005" default="true"/>
       <setting id="ES" type="bool" label="32006" default="true"/>
       <setting id="EN" type="bool" label="32007" default="true"/>
     </category>   
-</settings>
+    <category label="32015">
+      <setting id="PARENT" type="enum" lvalues="32011|32013" label="32010" 
default="0"/>
+    </category>   
+</settings>
\ No newline at end of file
diff --git a/service.subtitles.pipocas/service.py 
b/service.subtitles.pipocas/service.py
index 28b9331..1358e2a 100644
--- a/service.subtitles.pipocas/service.py
+++ b/service.subtitles.pipocas/service.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
-# Service Pipocas.tv version 0.0.2
-# Code based on Undertext (FRODO) service and the download function encode fix 
from legendastv (FRODO) service
+# Service Pipocas.tv version 0.1.0
+# Code based on Undertext (FRODO) service
 # Coded by HiGhLaNdR@OLDSCHOOL
 # Ported to Gotham by HiGhLaNdR@OLDSCHOOL
 # Help by VaRaTRoN
@@ -25,7 +25,6 @@ import xbmcplugin
 import xbmcvfs
 import cookielib
 import urllib2
-from operator import itemgetter, attrgetter
 
 __addon__ = xbmcaddon.Addon()
 __author__     = __addon__.getAddonInfo('author')
@@ -37,16 +36,13 @@ __language__   = __addon__.getLocalizedString
 __cwd__        = 
xbmc.translatePath(__addon__.getAddonInfo('path')).decode("utf-8")
 __profile__    = 
xbmc.translatePath(__addon__.getAddonInfo('profile')).decode("utf-8")
 __resource__   = xbmc.translatePath(pjoin(__cwd__, 'resources', 'lib' ) 
).decode("utf-8")
-__temp__       = xbmc.translatePath(pjoin(__profile__, 'temp')).decode("utf-8")
+__temp__       = xbmc.translatePath(pjoin(__profile__, 'temp'))
 
 sys.path.append (__resource__)
 
 main_url = "http://pipocas.tv/";
 debug_pretext = "Pipocas"
-
-
-MAIN_SUBDIVX_URL = "http://pipocas.tv/";
-SEARCH_PAGE_URL = MAIN_SUBDIVX_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']
@@ -68,6 +64,8 @@ id_pattern = "download.php\?id=(.+?)\""
 hits_pattern = "<li><span>Hits:</span> (.+?)</li>"
 #desc_pattern = "<div 
class=\"description-box\">([\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*[\n\r\t].*)<center><iframe"
 uploader_pattern = "<a href=\"/my.php\?u.+?:normal;\"> (.+?)</font></a>"
+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,})"
 
 #==========
 # Functions
@@ -180,28 +178,41 @@ def getallsubs(searchstring, languageshort, languagelong, 
file_original_path, se
             dirsearch_check = string.split(dirsearch[-1], '.')
             #For DEBUG only uncomment next line
             #log( __name__ ,"%s dirsearch_check: '%s'" % (debug_pretext, 
dirsearch_check))
-            if (searchstring_notclean != ""):
-                sync = False
-                if re.search(searchstring_notclean, desc):
+            #### PARENT FOLDER TWEAK DEFINED IN THE ADD-ON SETTINGS (AUTO | 
ALWAYS ON (DEACTIVATED) | OFF)
+            __parentfolder__ = __addon__.getSetting( 'PARENT' )
+            if __parentfolder__ == '0':
+                if re.search(release_pattern, dirsearch[-1], re.IGNORECASE):
+                    __parentfolder__ = '1'
+                else:
+                    __parentfolder__ = '2'
+            if __parentfolder__ == '1':
+                if re.search(dirsearch[-1], desc, re.IGNORECASE):
                     sync = True
-            else:
-                if (string.lower(dirsearch_check[-1]) == "rar") or 
(string.lower(dirsearch_check[-1]) == "cd1") or 
(string.lower(dirsearch_check[-1]) == "cd2"):
-                    sync = False
-                    if len(dirsearch) > 1 and dirsearch[1] != '':
-                        if re.search(filesearch[1][:len(filesearch[1])-4], 
desc) or re.search(dirsearch[-2], desc):
-                            sync = True
-                    else:
-                        if re.search(filesearch[1][:len(filesearch[1])-4], 
desc):
-                            sync = True
                 else:
                     sync = False
-                    if len(dirsearch) > 1 and dirsearch[1] != '':
-                        if re.search(filesearch[1][:len(filesearch[1])-4], 
desc) or re.search(dirsearch[-1], desc):
-                            sync = True
+            if __parentfolder__ == '2':
+                if (searchstring_notclean != ""):
+                    sync = False
+                    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"):
+                        sync = False
+                        if len(dirsearch) > 1 and dirsearch[1] != '':
+                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc, re.IGNORECASE) or re.search(dirsearch[-2], desc, re.IGNORECASE):
+                                sync = True
+                        else:
+                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc, re.IGNORECASE):
+                                sync = True
                     else:
-                        if re.search(filesearch[1][:len(filesearch[1])-4], 
desc):
-                            sync = True
-            filename = filename + "  " + "hits: " + hits + " uploader: " + 
uploader + " "
+                        sync = False
+                        if len(dirsearch) > 1 and dirsearch[1] != '':
+                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc) or re.search(dirsearch[-1], desc, re.IGNORECASE):
+                                sync = True
+                        else:
+                            if re.search(filesearch[1][:len(filesearch[1])-4], 
desc, re.IGNORECASE):
+                                sync = True
+            filename = filename + "  " + "hits: " + hits + " uploader: " + 
uploader
             #subtitles_list.append({'rating': str(downloads), 'no_files': 
no_files, 'filename': filename, 'desc': desc, 'sync': sync, 'hits' : hits, 
'id': id, 'language_flag': 'flags/' + languageshort + '.gif', 'language_name': 
languagelong})
             subtitles_list.append({'rating': str(downloads), 'filename': 
filename, 'hits': hits, 'desc': desc, 'sync': sync, 'id': id, 'language_short': 
languageshort, 'language_name': languagelong})
         page = page + 1
@@ -251,10 +262,40 @@ def Search(item):
     #### Do what's needed to get the list of subtitles from service site
     #### use item["some_property"] that was set earlier
     #### once done, set xbmcgui.ListItem() below and pass it to 
xbmcplugin.addDirectoryItem()
-    filename = 
os.path.splitext(os.path.basename(item['file_original_path']))[0]
+    #
+    #### CHECKING FOR ANYTHING IN THE USERNAME AND PASSWORD, IF NULL IT STOPS 
THE SCRIPT WITH A WARNING
+    username = __addon__.getSetting( 'PPuser' )
+    password = __addon__.getSetting( 'PPpass' )
+    if username == '' or password == '':
+        xbmcplugin.endOfDirectory(int(sys.argv[1]))
+        if username == '' and password != '':
+            xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32016).encode('utf-8'),5000)))
+        if username != '' and password == '':
+            xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32017).encode('utf-8'),5000)))
+        if username == '' and password == '':
+            xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32018).encode('utf-8'),5000)))
+    #### PARENT FOLDER TWEAK DEFINED IN THE ADD-ON SETTINGS (AUTO | ALWAYS ON 
(DEACTIVATED) | OFF)
     file_original_path = item['file_original_path']
-    filename = xbmc.getCleanMovieTitle(filename)
-    searchstring_notclean = 
os.path.splitext(os.path.basename(item['file_original_path']))[0]
+    __parentfolder__ = __addon__.getSetting( 'PARENT' )
+    if __parentfolder__ == '0':
+        filename = os.path.abspath(file_original_path)
+        dirsearch = filename.split(os.sep)
+        #log(u"dirsearch_search string = %s" % (dirsearch,))
+        if re.search(release_pattern, dirsearch[-2], re.IGNORECASE):
+            __parentfolder__ = '1'
+        else:
+            __parentfolder__ = '2'
+    if __parentfolder__ == '1':
+        filename = os.path.abspath(file_original_path)
+        dirsearch = filename.split(os.sep)
+        filename = dirsearch[-2]
+        #log(u"__parentfolder1__ = %s" % (filename,))
+    if __parentfolder__ == '2':   
+        filename = os.path.splitext(os.path.basename(file_original_path))[0]
+        #log(u"__parentfolder2__ = %s" % (filename,))
+
+    filename = xbmc.getCleanMovieTitle(filename)[0]
+    searchstring_notclean = 
os.path.splitext(os.path.basename(file_original_path))[0]
     searchstring = ""
     global israr
     israr = os.path.abspath(file_original_path)
@@ -277,8 +318,9 @@ def Search(item):
     else:
         if tvshow != '':
             searchstring = "%s S%#02dE%#02d" % (tvshow, int(season), 
int(episode))
-            #log(u"TV Searchstring string = %s" % (searchstring,))
-        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):
@@ -309,13 +351,18 @@ 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,))
                 else:
-                    searchstring = title
-                    #log(u"TITLE Searchstring string = %s" % (searchstring,))
+                    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"FilenameTV Searchstring = %s" % (searchstring,))
+                    else:
+                        searchstring = filename
+                        #log(u"Filename Searchstring = %s" % (searchstring,))
 
     PT_ON = __addon__.getSetting( 'PT' )
     PTBR_ON = __addon__.getSetting( 'PTBR' )
@@ -338,8 +385,8 @@ def Search(item):
         subtitles_list = getallsubs(searchstring, "en", "English", 
file_original_path, searchstring_notclean)
         for sub in subtitles_list:
             append_subtitle(sub)
-    #else:
-        #xbmc.executebuiltin((u'Notification(%s,%s)' % (__scriptname__ , 'only 
works for Portuguese,Brazilian,English,Spanish')).encode('utf-8'))
+    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.',5000)))
 
 def recursive_glob(treeroot, pattern):
     results = []
@@ -394,6 +441,10 @@ def Download(id, filename):
 #    content = get_download(main_url+'fazendologin.php', 
main_url+'downloadsub.php', id)
 
     content = content.read()
+    #### If user is not registered or User\Pass is misspelled it will generate 
an error message and break the script execution!
+    if '<title>Pipocas.TV - Login</title>' in content.decode('utf8', 'ignore'):
+        xbmcplugin.endOfDirectory(int(sys.argv[1]))
+        xbmc.executebuiltin(('Notification(%s,%s,%d)' % (__scriptname__ , 
__language__(32019).encode('utf8'),5000)))
     if content is not None:
         header = content[:4]
         if header == 'Rar!':
@@ -418,7 +469,7 @@ def Download(id, filename):
         if packed:
             files = os.listdir(__temp__)
             init_filecount = len(files)
-            log(u"pipocas: número de init_filecount %s" % (init_filecount,)) 
#EGO
+            #log(u"pipocas: número de init_filecount %s" % (init_filecount,)) 
#EGO
             filecount = init_filecount
             max_mtime = 0
             # Determine the newest file from __temp__
@@ -430,7 +481,7 @@ def Download(id, filename):
             init_max_mtime = max_mtime
             # Wait 2 seconds so that the unpacked files are at least 1 second 
newer
             time.sleep(2)
-            xbmc.executebuiltin("XBMC.Extract(" + 
local_tmp_file.encode("utf-8") + ", " + __temp__.encode("utf-8") +")")
+            xbmc.executebuiltin("XBMC.Extract(" + 
local_tmp_file.encode("utf-8") + ", " + __temp__ +")")
             waittime  = 0
             while filecount == init_filecount and waittime < 20 and 
init_max_mtime == max_mtime: # nothing yet extracted
                 time.sleep(1)  # wait 1 second to let the builtin function 
'XBMC.extract' unpack
@@ -439,7 +490,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)).st_mtime
                         if mtime > max_mtime:
                             max_mtime =  mtime
                 waittime  = waittime + 1
@@ -455,8 +506,11 @@ def Download(id, filename):
                     #if file.split('.')[-1] in SUB_EXTS and 
os.stat(pjoin(__temp__, file)).st_mtime > init_max_mtime:
                     if searchsubscount == 1:
                         # unpacked file is a newly created subtitle file
-                        log(u"Unpacked subtitles file '%s'" % (file,))
-                        subs_file = pjoin(__temp__, file.decode("utf-8"))
+                        #log(u"Unpacked subtitles file '%s'" % 
(file.decode('utf-8'),))
+                        try:
+                            subs_file = pjoin(__temp__, file.decode("utf-8"))
+                        except:
+                            subs_file = pjoin(__temp__, file.decode("latin1"))
                         subtitles_list.append(subs_file)
                         break
                     else:
@@ -539,8 +593,6 @@ if params['action'] == 'search' or params['action'] == 
'manualsearch':
     Search(item)
 
 elif params['action'] == 'download':
-    log(u"subtitles id: '%s'" % (params["id"],))
-    log(u"subtitles filename: '%s'" % (params["filename"],))
     # we pickup all our arguments sent from def Search()
     subs = Download(params["id"], params["filename"])
     # we can return more than one subtitle for multi CD versions, for now we
@@ -550,4 +602,4 @@ elif params['action'] == 'download':
         xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sub, 
listitem=listitem, isFolder=False)
 
 # Send end of directory to XBMC
-xbmcplugin.endOfDirectory(int(sys.argv[1]))
+xbmcplugin.endOfDirectory(int(sys.argv[1]))
\ No newline at end of file

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

Summary of changes:
 service.subtitles.legendaszone/addon.xml           |    6 +-
 service.subtitles.legendaszone/changelog.txt       |   15 ++
 .../resources/language/English/strings.xml         |   12 ++
 .../language/Portuguese (Brazil)/strings.xml       |    0
 .../resources/language/Portuguese/strings.xml      |   12 ++
 .../resources/settings.xml                         |    7 +-
 service.subtitles.legendaszone/service.py          |  134 +++++++++++++-------
 service.subtitles.pipocas/addon.xml                |    6 +-
 service.subtitles.pipocas/changelog.txt            |   15 ++
 .../resources/language/English/strings.xml         |   12 ++
 .../language/Portuguese (Brazil)/strings.xml       |    0
 .../resources/language/Portuguese/strings.xml      |   12 ++
 service.subtitles.pipocas/resources/settings.xml   |    7 +-
 service.subtitles.pipocas/service.py               |  140 +++++++++++++------
 14 files changed, 283 insertions(+), 95 deletions(-)
 copy {service.subtitles.legendasdivx => 
service.subtitles.legendaszone}/resources/language/Portuguese 
(Brazil)/strings.xml (100%)
 copy {service.subtitles.legendasdivx => 
service.subtitles.pipocas}/resources/language/Portuguese (Brazil)/strings.xml 
(100%)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to