The branch, eden has been updated
       via  b55c824c0f9ff055e706308acdab4027021e7836 (commit)
      from  320e5a5e4ca3cb2a0baba55b7242847e1ee28951 (commit)

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

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

    [script.module.metahandler] 1.2.0

diff --git a/script.module.metahandler/addon.xml 
b/script.module.metahandler/addon.xml
index 7eb6ae3..6a5d549 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="1.1.0" 
-            provider-name="Eldorado (inspired by anarchintosh, westcoast, 
daledude, t0mm0)">
+     name="metahandler" 
+     version="1.2.0" 
+     provider-name="Eldorado (inspired by anarchintosh, westcoast, daledude, 
t0mm0)">
   <requires>
     <import addon="xbmc.python" version="2.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 9954863..ebf4a5a 100644
--- a/script.module.metahandler/changelog.txt
+++ b/script.module.metahandler/changelog.txt
@@ -1,3 +1,8 @@
+[B]Version 1.2.0[/B]
+- Reverted back to simplejson import for TMDB scraper
+- Updated metacontainers folder deleting functionality
+- Added legacy check on xbmcvfs.mkdir
+
 [B]Version 1.1.0[/B]
 - Updated TMDB scraper to use v3 api
 - Added multithreaded support
@@ -29,4 +34,4 @@
 - Corrected Ratings and Episode values on TV Shows not returning in proper 
format in all scenarios
 
 [B]Version 1.0.0[/B]
-- Initial Release.
+- Initial Release.
\ No newline at end of file
diff --git a/script.module.metahandler/lib/metahandler/TMDB.py 
b/script.module.metahandler/lib/metahandler/TMDB.py
index 43d178a..8bd7464 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
@@ -345,7 +342,7 @@ class TMDB(object):
             ##Retry without the year
             if meta and meta['total_results'] == 0 and year:
                 meta = self._search_movie(name,'')
-            if meta and meta['total_results'] != 0:
+            if meta and meta['total_results'] != 0 and meta['results'][0]:
                 tmdb_id = meta['results'][0]['id']
                 if meta['results'][0].has_key('imdb_id'):
                     imdb_id = meta['results'][0]['imdb_id']
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                |    8 ++--
 script.module.metahandler/changelog.txt            |    7 ++-
 script.module.metahandler/lib/metahandler/TMDB.py  |    7 +--
 .../lib/metahandler/metacontainers.py              |   56 +++++++-------------
 .../lib/metahandler/metahandlers.py                |   12 +++-
 5 files changed, 40 insertions(+), 50 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