The branch, frodo has been updated
       via  aae17cf9811e0d9256b2458d562f6789fdb4ef5d (commit)
      from  5f927f86cae2c89a40bce21dfc26e367fb151797 (commit)

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

commit aae17cf9811e0d9256b2458d562f6789fdb4ef5d
Author: Martijn Kaijser <[email protected]>
Date:   Sun Nov 10 22:26:28 2013 +0100

    [script.module.metahandler] 2.2.0

diff --git a/script.module.metahandler/addon.xml 
b/script.module.metahandler/addon.xml
index 2050418..c2d07ac 100644
--- a/script.module.metahandler/addon.xml
+++ b/script.module.metahandler/addon.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.module.metahandler" 
      name="metahandler" 
-     version="2.1.0" 
+     version="2.2.0" 
      provider-name="Eldorado">
   <requires>
     <import addon="xbmc.python" version="2.1.0" />
+    <import addon="script.module.simplejson" version="3.3.0"/>
     <import addon="script.module.t0mm0.common" version="1.1.0"/>
-    <import addon="script.module.myconnpy" version="0.3.2"/>
   </requires>
   <extension point="xbmc.python.module" library="lib" />
   <extension point="xbmc.addon.metadata">
diff --git a/script.module.metahandler/changelog.txt 
b/script.module.metahandler/changelog.txt
index fa2d0c6..4c7fb2a 100644
--- a/script.module.metahandler/changelog.txt
+++ b/script.module.metahandler/changelog.txt
@@ -1,3 +1,8 @@
+[B]Version 2.2.0[/B]
+- Reverted back to simplejson import for TMDB scraper
+- Updated metacontainers folder deleting functionality
+- Added legacy check on xbmcvfs.mkdir
+
 [B]Version 2.1.0[/B]
 - Updated TMDB scraper to use v3 api
 - Added multithreaded support
diff --git a/script.module.metahandler/lib/metahandler/TMDB.py 
b/script.module.metahandler/lib/metahandler/TMDB.py
index 43d178a..c46d9de 100644
--- a/script.module.metahandler/lib/metahandler/TMDB.py
+++ b/script.module.metahandler/lib/metahandler/TMDB.py
@@ -5,10 +5,7 @@
 # also searches imdb (using http://www.imdbapi.com/) for missing info in 
movies or tvshows
 
 import sys
-if sys.version_info >=  (2, 7):
-    import _json as simplejson
-else:
-    import simplejson as simplejson 
+import simplejson as simplejson 
 
 import urllib, re
 from datetime import datetime
diff --git a/script.module.metahandler/lib/metahandler/metacontainers.py 
b/script.module.metahandler/lib/metahandler/metacontainers.py
index e1ae0d1..7777118 100644
--- a/script.module.metahandler/lib/metahandler/metacontainers.py
+++ b/script.module.metahandler/lib/metahandler/metacontainers.py
@@ -73,15 +73,7 @@ class MetaContainer:
      
         
common.addon.log('---------------------------------------------------------------------------------------',
 2)
         #delete and re-create work_path to ensure no previous files are left 
over
-        if xbmcvfs.exists(self.work_path):
-            import shutil
-            try:
-                common.addon.log('Removing previous work folder: %s' % 
self.work_path, 2)
-                # shutil.rmtree(self.work_path)
-                xbmcvfs.rmdir(self.work_path)
-            except Exception, e:
-                common.addon.log('Failed to delete work folder: %s' % e, 4)
-                pass
+        self._del_path(self.work_path)
         
         #Re-Create work folder
         self.make_dir(self.work_path)
@@ -103,38 +95,28 @@ class MetaContainer:
             if not os.path.exists(mypath): os.makedirs(mypath)  
 
 
-    def _del_metadir(self, path=''):
-
-        if path:
-            cache_path = path
-        else:
-            catch_path = self.cache_path
-      
-        #Nuke the old meta_caches folder (if it exists) and install this 
meta_caches folder.
-        #Will only ever delete a meta_caches folder, so is farly safe (won't 
delete anything it is fed)
-
-        if xbmcvfs.exists(catch_path):
-                try:
-                    shutil.rmtree(catch_path)
-                except:
-                    common.addon.log('Failed to delete old meta', 4)
-                    return False
-                else:
-                    common.addon.log('deleted old meta', 0)
-                    return True
-
-
     def _del_path(self, path):
 
         if xbmcvfs.exists(path):
+            try:
+                common.addon.log('Removing folder: %s' % path, 2)
                 try:
-                    shutil.rmtree(path)
-                except:
-                    common.addon.log('Failed to delete old meta', 4)
-                    return False
-                else:
-                    common.addon.log('deleted old meta', 0)
-                    return True
+                    dirs, files = xbmcvfs.listdir(path)
+                    for file in files:
+                        xbmcvfs.delete(os.path.join(path, file))
+                    success = xbmcvfs.rmdir(path)
+                    if success == 0:
+                        raise
+                except Exception, e:
+                    try:
+                        common.addon.log('Failed to delete path using xbmcvfs: 
%s' % e, 4)
+                        common.addon.log('Attempting to remove with shutil: 
%s' % path, 2)
+                        shutil.rmtree(path)
+                    except:
+                        raise
+            except Exception, e:
+                common.addon.log('Failed to delete path: %s' % e, 4)
+                return False
 
 
     def _extract_zip(self, src, dest):
diff --git a/script.module.metahandler/lib/metahandler/metahandlers.py 
b/script.module.metahandler/lib/metahandler/metahandlers.py
index ff8d4bd..f352fbe 100644
--- a/script.module.metahandler/lib/metahandler/metahandlers.py
+++ b/script.module.metahandler/lib/metahandler/metahandlers.py
@@ -68,7 +68,10 @@ except:
 def make_dir(mypath, dirname):
     ''' Creates sub-directories if they are not found. '''
     subpath = os.path.join(mypath, dirname)
-    if not xbmcvfs.exists(subpath): xbmcvfs.mkdirs(subpath)
+    try:
+        if not xbmcvfs.exists(subpath): xbmcvfs.mkdirs(subpath)
+    except:
+        if not os.path.exists(subpath): os.makedirs(subpath)              
     return subpath
 
 
@@ -541,7 +544,7 @@ class MetaData:
         '''                 
 
         if not xbmcvfs.exists(path):
-            xbmcvfs.mkdirs(path)
+            make_dir(path)
         
         full_path = os.path.join(path, name)
         self._dl_code(url, full_path)              
@@ -1601,6 +1604,8 @@ class MetaData:
             sql_select = "SELECT tvdb_id FROM tvshow_meta WHERE imdb_id = 
'%s'" % imdb_id
         elif name:
             sql_select = "SELECT tvdb_id FROM tvshow_meta WHERE title = '%s'" 
% name
+        else:
+            return None
             
         common.addon.log('Retrieving TVDB ID', 0)
         common.addon.log('SQL SELECT: %s' % sql_select, 0)
@@ -1964,6 +1969,7 @@ class MetaData:
             tmp_meta['title'] = name
             tmp_meta['season']  = season
             tmp_meta['episode'] = episode
+            tmp_meta['premiered'] = air_date
             
             if not watched:
                 watched = self._get_watched_episode(tmp_meta)
@@ -2245,7 +2251,7 @@ class MetaData:
         
         try:
             images = tvdb.get_show_image_choices(tvdb_id)
-        except:
+        except Exception, e:
             common.addon.log('************* Error retreiving from thetvdb.com: 
%s ' % e, 4)
             images = None
             pass

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

Summary of changes:
 script.module.metahandler/addon.xml                |    4 +-
 script.module.metahandler/changelog.txt            |    5 ++
 script.module.metahandler/lib/metahandler/TMDB.py  |    5 +--
 .../lib/metahandler/metacontainers.py              |   56 +++++++-------------
 .../lib/metahandler/metahandlers.py                |   12 +++-
 5 files changed, 36 insertions(+), 46 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to