The branch, frodo has been updated
       via  d5385da53ae492ae481c561483c2dc8424bd2793 (commit)
      from  08928bc8bad49b055a31d49ccfeaf92a18438017 (commit)

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

commit d5385da53ae492ae481c561483c2dc8424bd2793
Author: Martijn Kaijser <[email protected]>
Date:   Fri Jun 13 08:33:06 2014 +0200

    [script.module.metahandler] 2.7.0

diff --git a/script.module.metahandler/addon.xml 
b/script.module.metahandler/addon.xml
index 2f4674c..5a81f2b 100644
--- a/script.module.metahandler/addon.xml
+++ b/script.module.metahandler/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.module.metahandler" 
      name="metahandler" 
-     version="2.6.0" 
+     version="2.7.0" 
      provider-name="Eldorado">
   <requires>
     <import addon="xbmc.python" version="2.1.0" />
diff --git a/script.module.metahandler/changelog.txt 
b/script.module.metahandler/changelog.txt
index 61b9886..15e7e0c 100644
--- a/script.module.metahandler/changelog.txt
+++ b/script.module.metahandler/changelog.txt
@@ -1,3 +1,8 @@
+[B]Version 2.7.0[/B]
+- Corrected bug to ensure if we don't have a movie filename then send back an 
emtpy string instead of a partial TMDB url
+- Suppress myconnpy bug which throws errors on sql warnings
+- Bug fix on local cache image file checks
+
 [B]Version 2.6.0[/B]
 - Fixed small bug in tmdb config cache refresh logic
 - Changed location of logging addon version on init
diff --git a/script.module.metahandler/lib/metahandler/metahandlers.py 
b/script.module.metahandler/lib/metahandler/metahandlers.py
index 6b101cc..83696da 100644
--- a/script.module.metahandler/lib/metahandler/metahandlers.py
+++ b/script.module.metahandler/lib/metahandler/metahandlers.py
@@ -204,9 +204,12 @@ class MetaData:
                 if matchedrows:
                     dictrows = [dict(row) for row in matchedrows]
                     for row in dictrows:
-                        row["cover_url"] = '/' + 
row["cover_url"].split('/')[-1]
-                        row["thumb_url"] = '/' + 
row["thumb_url"].split('/')[-1]
-                        row["backdrop_url"] = '/' + 
row["backdrop_url"].split('/')[-1]
+                        if row["cover_url"]:
+                            row["cover_url"] = '/' + 
row["cover_url"].split('/')[-1]
+                        if row["thumb_url"]:
+                            row["thumb_url"] = '/' + 
row["thumb_url"].split('/')[-1]
+                        if row["backdrop_url"]:
+                            row["backdrop_url"] = '/' + 
row["backdrop_url"].split('/')[-1]
 
                     sql_update = "UPDATE movie_meta SET cover_url = 
:cover_url, thumb_url = :thumb_url, backdrop_url = :backdrop_url  WHERE imdb_id 
= :imdb_id and tmdb_id = :tmdb_id"
                     
@@ -262,6 +265,15 @@ class MetaData:
             sql_create = sql_create.replace("imdb_id TEXT","imdb_id 
VARCHAR(10)")
             sql_create = sql_create.replace("tmdb_id TEXT","tmdb_id 
VARCHAR(10)")
             sql_create = sql_create.replace("title TEXT"  ,"title 
VARCHAR(255)")
+
+            # hack to bypass bug in myconnpy
+            # create table if not exists fails bc a warning about the table
+            # already existing bubbles up as an exception. This suppresses the
+            # warning which would just be logged anyway.
+            # 
http://stackoverflow.com/questions/1650946/mysql-create-table-if-not-exists-error-1050
+            sql_hack = "SET sql_notes = 0;"
+            self.dbcur.execute(sql_hack)
+            
             self.dbcur.execute(sql_create)
             try: self.dbcur.execute('CREATE INDEX nameindex on movie_meta 
(title);')
             except: pass
@@ -948,87 +960,98 @@ class MetaData:
             DICT. Data formatted and corrected for proper return to xbmc addon
         '''      
 
-        #We want to send back the name that was passed in   
-        meta['title'] = name
-        
-        #Change cast back into a tuple
-        if meta['cast']:
-            meta['cast'] = eval(str(meta['cast']))
-            
-        #Return a trailer link that will play via youtube addon
         try:
-            meta['trailer'] = ''
-            trailer_id = ''
-            if meta['trailer_url']:
-                r = re.match('^[^v]+v=(.{3,11}).*', meta['trailer_url'])
-                if r:
-                    trailer_id = r.group(1)
-                else:
-                    trailer_id = meta['trailer_url']
-             
-            if trailer_id:
-                meta['trailer'] = 
'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % trailer_id
+            #We want to send back the name that was passed in   
+            meta['title'] = name
+            
+            #Change cast back into a tuple
+            if meta['cast']:
+                meta['cast'] = eval(str(meta['cast']))
                 
-        except Exception, e:
-            meta['trailer'] = ''
-            common.addon.log('Failed to set trailer: %s' % e, 3)
-            pass
-
-        #Ensure we are not sending back any None values, XBMC doesn't like them
-        meta = self._remove_none_values(meta)
-        
-        #Add TVShowTitle infolabel
-        if media_type==self.type_tvshow:
-            meta['TVShowTitle'] = meta['title']
-        
-        #Set Watched flag for movies
-        if media_type==self.type_movie:
-            meta['playcount'] = self.__set_playcount(meta['overlay'])
-        
-        #if cache row says there are pre-packed images then either use them or 
create them
-        if meta['imgs_prepacked'] == 'true':
-
-                #define the image paths               
+            #Return a trailer link that will play via youtube addon
+            try:
+                meta['trailer'] = ''
+                trailer_id = ''
+                if meta['trailer_url']:
+                    r = re.match('^[^v]+v=(.{3,11}).*', meta['trailer_url'])
+                    if r:
+                        trailer_id = r.group(1)
+                    else:
+                        trailer_id = meta['trailer_url']
+                 
+                if trailer_id:
+                    meta['trailer'] = 
'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % trailer_id
+                    
+            except Exception, e:
+                meta['trailer'] = ''
+                common.addon.log('Failed to set trailer: %s' % e, 3)
+                pass
+    
+            #Ensure we are not sending back any None values, XBMC doesn't like 
them
+            meta = self._remove_none_values(meta)
+            
+            #Add TVShowTitle infolabel
+            if media_type==self.type_tvshow:
+                meta['TVShowTitle'] = meta['title']
+            
+            #Set Watched flag for movies
+            if media_type==self.type_movie:
+                meta['playcount'] = self.__set_playcount(meta['overlay'])
+            
+            #if cache row says there are pre-packed images then either use 
them or create them
+            if meta['imgs_prepacked'] == 'true':
+    
+                    #define the image paths               
+                    if media_type == self.type_movie:
+                        root_covers = self.mvcovers
+                        root_backdrops = self.mvbackdrops
+                    elif media_type == self.type_tvshow:
+                        root_covers = self.tvcovers
+                        root_backdrops = self.tvbackdrops
+                        root_banners = self.tvbanners
+                    
+                    if meta['cover_url']:
+                        cover_name = self._picname(meta['cover_url'])
+                        if cover_name:
+                            cover_path = os.path.join(root_covers, 
cover_name[0].lower())
+                            if self.classmode == 'true':
+                                self._downloadimages(meta['cover_url'], 
cover_path, cover_name)
+                            meta['cover_url'] = os.path.join(cover_path, 
cover_name)
+                    
+                    if meta['backdrop_url']:
+                        backdrop_name = self._picname(meta['backdrop_url'])
+                        if backdrop_name:
+                            backdrop_path=os.path.join(root_backdrops, 
backdrop_name[0].lower())
+                            if self.classmode == 'true':
+                                self._downloadimages(meta['backdrop_url'], 
backdrop_path, backdrop_name)
+                            meta['backdrop_url'] = os.path.join(backdrop_path, 
backdrop_name)
+    
+                    if meta.has_key('banner_url'):
+                        if meta['banner_url']:
+                            banner_name = self._picname(meta['banner_url'])
+                            if banner_name:
+                                banner_path=os.path.join(root_banners, 
banner_name[0].lower())
+                                if self.classmode == 'true':
+                                    self._downloadimages(meta['banner_url'], 
banner_path, banner_name)
+                                meta['banner_url'] = os.path.join(banner_path, 
banner_name)
+    
+            #Else - they are online so piece together the full URL from TMDB 
+            else:
                 if media_type == self.type_movie:
-                    root_covers = self.mvcovers
-                    root_backdrops = self.mvbackdrops
-                elif media_type == self.type_tvshow:
-                    root_covers = self.tvcovers
-                    root_backdrops = self.tvbackdrops
-                    root_banners = self.tvbanners
-                
-                if meta['cover_url']:
-                    cover_name = self._picname(meta['cover_url'])
-                    cover_path = os.path.join(root_covers, 
cover_name[0].lower())
-                    if self.classmode == 'true':
-                        self._downloadimages(meta['cover_url'], cover_path, 
cover_name)
-                    meta['cover_url'] = os.path.join(cover_path, cover_name)
-                
-                if meta['backdrop_url']:
-                    backdrop_name = self._picname(meta['backdrop_url'])
-                    backdrop_path=os.path.join(root_backdrops, 
backdrop_name[0].lower())
-                    if self.classmode == 'true':
-                        self._downloadimages(meta['backdrop_url'], 
backdrop_path, backdrop_name)
-                    meta['backdrop_url'] = os.path.join(backdrop_path, 
backdrop_name)
-
-                if meta.has_key('banner_url'):
-                    if meta['banner_url']:
-                        banner_name = self._picname(meta['banner_url'])
-                        banner_path=os.path.join(root_banners, 
banner_name[0].lower())
-                        if self.classmode == 'true':
-                            self._downloadimages(meta['banner_url'], 
banner_path, banner_name)
-                        meta['banner_url'] = os.path.join(banner_path, 
banner_name)
-
-        #Else - they are online so piece together the full URL from TMDB 
-        else:
-            if media_type == self.type_movie:
-                if not meta['cover_url'].startswith('http'):
-                    meta['cover_url'] = self.tmdb_image_url  + 
common.addon.get_setting('tmdb_poster_size') + meta['cover_url']
-                if not meta['backdrop_url'].startswith('http'):                
    
-                    meta['backdrop_url'] = self.tmdb_image_url  + 
common.addon.get_setting('tmdb_backdrop_size') + meta['backdrop_url']
-
-        common.addon.log('Returned Meta: %s' % meta, 0)
-        return meta  
+                    if meta['cover_url'] and len(meta['cover_url']) > 1 and 
not meta['cover_url'].startswith('http'):
+                        meta['cover_url'] = self.tmdb_image_url  + 
common.addon.get_setting('tmdb_poster_size') + meta['cover_url']
+                    else:
+                        meta['cover_url'] = ''
+                    if meta['backdrop_url'] and len(meta['backdrop_url']) > 1 
and not meta['backdrop_url'].startswith('http'):
+                        meta['backdrop_url'] = self.tmdb_image_url  + 
common.addon.get_setting('tmdb_backdrop_size') + meta['backdrop_url']
+                    else:
+                        meta['backdrop_url'] = ''
+    
+            common.addon.log('Returned Meta: %s' % meta, 0)
+            return meta  
+        except Exception, e:
+            common.addon.log('************* Error formatting meta: %s' % e, 4)
+            return meta  
 
 
     def update_meta(self, media_type, name, imdb_id, tmdb_id='', 
new_imdb_id='', new_tmdb_id='', year=''):

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

Summary of changes:
 script.module.metahandler/addon.xml                |    2 +-
 script.module.metahandler/changelog.txt            |    5 +
 .../lib/metahandler/metahandlers.py                |  185 +++++++++++---------
 3 files changed, 110 insertions(+), 82 deletions(-)


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