The branch, frodo has been updated
       via  f2b66ac844508ddb86f661e938a0fd1fb771b78d (commit)
      from  8e4b1794998f53b2f31166e7c1daf14573def2d6 (commit)

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

commit f2b66ac844508ddb86f661e938a0fd1fb771b78d
Author: beenje <[email protected]>
Date:   Wed Jun 12 21:34:02 2013 +0200

    [plugin.image.dilbert] updated to version 1.1.1

diff --git a/plugin.image.dilbert/addon.py b/plugin.image.dilbert/addon.py
index 70d56e9..04e021b 100644
--- a/plugin.image.dilbert/addon.py
+++ b/plugin.image.dilbert/addon.py
@@ -30,24 +30,50 @@ for link in match:
     
xbmcplugin.addDirectoryItem(handle=thisPlugin,url=u,listitem=liz,isFolder=False)
     lastu=u
 del req
+cachedir=os.path.join(addon.getAddonInfo('path'),'cache')
+if  not os.path.exists(cachedir):
+    os.makedirs(cachedir)
+    print('Created cached directory '+cachedir)
+# n= number of entries added to the menu
+n=0
+# i= number of entries actually read from the network (not cached)
 i=0
-while i < 7:
-    req = urllib2.Request(u1+'/'+day.strftime('%Y-%m-%d')+'/')
-    req.add_header('User-Agent', ' Mozilla/5.0 (Windows; U; Windows NT 5.1; 
en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
-    response = urllib2.urlopen(req)
-    page=response.read()
-    response.close()
-    match=re.compile('(.dyn.str_strip.*strip.*.zoom.gif)').findall(page)
-    for link in match:
-        u='http://dilbert.com/'+link
-        if u != lastu:
-            print(u)
-            name=day.strftime('%Y-%m-%d')+' Dilbert'
-            iconimage=os.path.join(addon.getAddonInfo('path'),"icon.png")
-            liz=xbmcgui.ListItem(unicode(name), 
iconImage=iconimage,thumbnailImage=iconimage)
-            liz.setInfo( type="Image", infoLabels={ "Title": name })
-            
xbmcplugin.addDirectoryItem(handle=thisPlugin,url=u,listitem=liz,isFolder=False)
-        lastu=u
+while i < 5 or n <10:
+    p=os.path.join(cachedir,day.strftime('%Y-%m-%d')+'.link')
+    if os.path.isfile(p):
+        print('reading cache')
+        text_file = open(p, "r")
+        u=text_file.read()
+        text_file.close()
+        name=day.strftime('%Y-%m-%d')+' Dilbert'
+        iconimage=os.path.join(addon.getAddonInfo('path'),"icon.png")
+        liz=xbmcgui.ListItem(unicode(name), 
iconImage=iconimage,thumbnailImage=iconimage)
+        liz.setInfo( type="Image", infoLabels={ "Title": name })
+        
xbmcplugin.addDirectoryItem(handle=thisPlugin,url=u,listitem=liz,isFolder=False)
+        n=n+1
+    else:
+        req = urllib2.Request(u1+'/'+day.strftime('%Y-%m-%d')+'/')
+        req.add_header('User-Agent', ' Mozilla/5.0 (Windows; U; Windows NT 
5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
+        response = urllib2.urlopen(req)
+        page=response.read()
+        response.close()
+        match=re.compile('(.dyn.str_strip.*strip.*.zoom.gif)').findall(page)
+        for link in match:
+            u='http://dilbert.com/'+link
+            if u != lastu:
+                print(u)
+                name=day.strftime('%Y-%m-%d')+' Dilbert'
+                iconimage=os.path.join(addon.getAddonInfo('path'),"icon.png")
+                liz=xbmcgui.ListItem(unicode(name), 
iconImage=iconimage,thumbnailImage=iconimage)
+                liz.setInfo( type="Image", infoLabels={ "Title": name })
+                
xbmcplugin.addDirectoryItem(handle=thisPlugin,url=u,listitem=liz,isFolder=False)
+                n=n+1
+                if not os.path.isfile(p):
+                    print('writing cache '+p)
+                    text_file = open(p, "w")
+                    text_file.write(u)
+                    text_file.close()
+            lastu=u
+        i=i+1
     day=day-oneday
-    i=i+1
 xbmcplugin.endOfDirectory(handle=thisPlugin, succeeded=True, 
updateListing=False, cacheToDisc=True)
diff --git a/plugin.image.dilbert/addon.xml b/plugin.image.dilbert/addon.xml
index a70bdc3..cee72e6 100644
--- a/plugin.image.dilbert/addon.xml
+++ b/plugin.image.dilbert/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.image.dilbert" name="Dilbert" version="1.0.0" 
provider-name="RPiola">
+<addon id="plugin.image.dilbert" name="Dilbert" version="1.1.1" 
provider-name="RPiola">
     <requires>
         <import addon="xbmc.python" version="2.1.0"/>
     </requires>
diff --git a/plugin.image.dilbert/changelog.txt 
b/plugin.image.dilbert/changelog.txt
index 164e9e6..09d26d3 100644
--- a/plugin.image.dilbert/changelog.txt
+++ b/plugin.image.dilbert/changelog.txt
@@ -1,2 +1,4 @@
 0.X.Y initial development versions
 1.0.0 first release
+1.1.0 added link cache
+1.1.1 bug fixing

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

Summary of changes:
 plugin.image.dilbert/addon.py      |   62 +++++++++++++++++++++++++----------
 plugin.image.dilbert/addon.xml     |    2 +-
 plugin.image.dilbert/changelog.txt |    2 +
 3 files changed, 47 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to