The branch, dharma has been updated
       via  5cb498186a3e8a9538a2390b59527ee7c087bbc3 (commit)
      from  4387843fc8350af2598961e548b3fdf19c1a7285 (commit)

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

commit 5cb498186a3e8a9538a2390b59527ee7c087bbc3
Author: amet <[email protected]>
Date:   Wed Feb 2 01:42:22 2011 +0400

    [script.xbmc.subtitles] -v2.2.5
    - added: Added storing of Bierdopje show ids to reduce the number of api 
calls. thx mr_blobby
    - use getAddonInfo('profile') for temporary subtitle location

diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 4a8afad..0c1677e 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="2.2.4"
+       version="2.2.5"
        provider-name="Amet">
   <requires>
     <import addon="xbmc.python" version="1.0"/>
diff --git a/script.xbmc.subtitles/changelog.txt 
b/script.xbmc.subtitles/changelog.txt
index a96596f..7d1c586 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,7 @@
+2.2.5
+- added: Added storing of Bierdopje show ids to reduce the number of api 
calls. thx mr_blobby
+- use getAddonInfo('profile') for temporary subtitle location 
+
 2.2.4
 - fixed: Titulky service login, thx to Libor
 
diff --git a/script.xbmc.subtitles/default.py b/script.xbmc.subtitles/default.py
index c300fb1..4f7eca8 100644
--- a/script.xbmc.subtitles/default.py
+++ b/script.xbmc.subtitles/default.py
@@ -9,6 +9,7 @@ __settings__   = xbmcaddon.Addon(id='script.xbmc.subtitles')
 __language__   = __settings__.getLocalizedString
 __version__    = __settings__.getAddonInfo('version')
 __cwd__        = __settings__.getAddonInfo('path')
+__profile__    = __settings__.getAddonInfo('profile')
 __scriptname__ = "XBMC Subtitles"
 __scriptid__   = "script.xbmc.subtitles"
 __author__     = "Amet,mr_blobby"
diff --git a/script.xbmc.subtitles/resources/lib/gui.py 
b/script.xbmc.subtitles/resources/lib/gui.py
index bd25e8f..d0ee1bf 100644
--- a/script.xbmc.subtitles/resources/lib/gui.py
+++ b/script.xbmc.subtitles/resources/lib/gui.py
@@ -9,10 +9,12 @@ import unicodedata
 import shutil
 import socket
 
-_ = sys.modules[ "__main__" ].__language__
+_              = sys.modules[ "__main__" ].__language__
 __scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
-__cwd__ = sys.modules[ "__main__" ].__cwd__
+__settings__   = sys.modules[ "__main__" ].__settings__
+__cwd__        = sys.modules[ "__main__" ].__cwd__
+__profile__    = sys.modules[ "__main__" ].__profile__ 
+
 
 STATUS_LABEL = 100
 LOADING_IMAGE = 110
@@ -115,7 +117,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
       else:
         self.file_name = "%s (%s)" % (self.title.encode('utf-8'), 
str(self.year),)    
 
-    self.tmp_sub_dir = os.path.join( xbmc.translatePath( "special://profile/" 
), "addon_data", os.path.basename( __cwd__ ),"sub_tmp" )
+    self.tmp_sub_dir = os.path.join( __profile__ ,"sub_tmp" )
 
     if not self.tmp_sub_dir.endswith(':') and not 
os.path.exists(self.tmp_sub_dir):
       os.makedirs(self.tmp_sub_dir)
diff --git a/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py 
b/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
index 48912e4..794b71b 100644
--- a/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
@@ -1,10 +1,11 @@
 import os, sys, re, xbmc, xbmcgui, string, urllib, ElementTree as XMLTree
 from utilities import log
 
-_ = sys.modules[ "__main__" ].__language__
-
-apiurl   = "http://api.bierdopje.com/";
-apikey   = "369C2ED4261DE9C3"
+_                = sys.modules[ "__main__" ].__language__
+__settings__     = sys.modules[ "__main__" ].__settings__
+apiurl           = "http://api.bierdopje.com/";
+apikey           = "369C2ED4261DE9C3"
+showids_filename = os.path.join( __settings__.getAddonInfo('profile') 
,"bierdopje_show_ids.txt" )
 
 
#====================================================================================================================
 # Functions
@@ -49,24 +50,34 @@ def gettextelements(xml, path):
     return textelements
 
 def getshowid(showname):
+    showids = {}
+    if os.path.isfile(showids_filename):
+        showids_filedata = file(showids_filename,'r').read()
+        showids = eval(showids_filedata)
+        if showname in showids:
+            log( __name__ ," show id for '%s' is '%s' (from cachefile '%s')" % 
(showname, showids[showname], showids_filename))
+            return showids[showname]
     response = apicall("GetShowByName",[showname])
     if response is not None:
         showid = gettextelements(response,"response/showid")
         if len(showid) == 1:
             log( __name__ ," show id for '%s' is '%s'" % (showname, 
str(showid[0])) )
+            showids[showname] = str(showid[0])
+            file(showids_filename,'w').write(repr(showids))
             return str(showid[0])
-        else:
+        elif ("'" in showname):
             response = 
apicall("GetShowByName",[string.replace(showname,"'","''")])
             if response is not None:
                 showid = gettextelements(response,"response/showid")
                 if len(showid) == 1:
                     log( __name__ ," show id for '%s' is '%s' (replaced ' with 
'')" % (string.replace(showname,"'","''"), str(showid[0])) )
+                    showids[showname] = str(showid[0])
+                    file(showids_filename,'w').write(repr(showids))
                     return str(showid[0])
-                else:
-                    okdialog = xbmcgui.Dialog()
-                    ok = okdialog.ok("Error", "Failed to get a show id from 
Bierdopje for " + showname)
-                    log( __name__ ," failed to get a show id for '%s'" % 
showname )
-        
+        okdialog = xbmcgui.Dialog()
+        ok = okdialog.ok("Error", "Failed to get a show id from Bierdopje for 
" + showname)
+        log( __name__ ," failed to get a show id for '%s'" % showname )
+
 
 def isexactmatch(subsfile, moviefile):
     match = re.match("(.*)\.", moviefile)

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

Summary of changes:
 script.xbmc.subtitles/addon.xml                    |    2 +-
 script.xbmc.subtitles/changelog.txt                |    4 ++
 script.xbmc.subtitles/default.py                   |    1 +
 script.xbmc.subtitles/resources/lib/gui.py         |   10 ++++--
 .../resources/lib/services/Bierdopje/service.py    |   31 +++++++++++++------
 5 files changed, 33 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to