script.module.metautils dev

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
k_zeon Offline
Senior Member
Posts: 204
Joined: Aug 2011
Reputation: 0
Post: #101
these are wrong. does anyone know what should be passed if nothing is found

if infolabels['rating'] is None:
infolabels['rating']=float(0) <<< wrong

if infolabels['duration'] is None:
infolabels['duration']=int(0) wrong
find quote
slyi Offline
Junior Member
Posts: 39
Joined: Sep 2011
Reputation: 0
Post: #102
For the add directory i use
PHP Code:
def add_directory(selfqueriestitleinfoLabels={}, img=''fanart=''
                      
total_items=0is_folder=True):
        
'''
        Add a directory to the list of items to be displayed by XBMC.
        
        When selected by the user, directory will call the addon with the 
        query values contained in `queries`.
        
        Args:
            queries (dict): A set of keys/values to be sent to the addon when 
            the user selects this item.
            
            title (str): The name to be displayed for this entry.
        
        Kwargs:
            img (str): A URL to an image file to be used as an icon for this
            entry.
            
            fanart (str): A URL to a fanart image for this entry.
            
            total_items (int): Total number of items to be added in this list.
            If supplied it enables XBMC to show a progress bar as the list of
            items is being built.

            is_folder (bool): if ``True`` (default), when the user selects this 
            item XBMC will expect the plugin to add another set of items to 
            display. If ``False``, the '
Loading Directory' message will not be
            displayed by XBMC (useful if you want a directory item to do 
            something like pop up a dialog).
        
        '''
        
title self.unescape(title)
        
url self.build_plugin_url(queries)
        
self.log_debug(u'adding dir: %s - %s' % (titleurl))
        
listitem xbmcgui.ListItem(titleiconImage=img
                                    
thumbnailImage=img)
        if  
len(infoLabels)>0:
            
listitem.setInfo(type="Video"infoLabels=infoLabels)
        
listitem.setProperty('fanart_image'fanart)
        
xbmcplugin.addDirectoryItem(self.handleurllistitem
                                    
isFolder=is_foldertotalItems=total_items
find quote
Eldorado Offline
Posting Freak
Posts: 922
Joined: May 2009
Reputation: 11
Post: #103
slyi Wrote:Yes I be happy to help, do you have a github for icefilms using t0mmo lib yet or is too early, I updated the two files above for some updates which seen to fix most remaining issues apart from a dup "Seven days" issue on "s".

Check the icefilms dev thread in this forum, one of the last posts I gave a link to a forked version where I merged the master branch with stable, master is the unfinished branch with many new features

Not sure about merging with t0mm0's lib, there's a lot of cleanup that would need to be done in the icefilms code to get to that point
find quote
Eldorado Offline
Posting Freak
Posts: 922
Joined: May 2009
Reputation: 11
Post: #104
k_zeon Wrote:hey Eldorado

found that when adding the Plot, i get through approx 157 then it errors

self.log_debug(u'adding movie: %s - %s' % (infolabels['title'], infolabels['plot']))

listitem.setInfo('video', {'Title': infolabels['title'], 'Genre': infolabels['genre'], 'Plot': infolabels['plot']})

Looked through the Log http://pastebin.com/W6SMz97B
and found a the Plot being returned as None.
This is not a str or int

should it not return 'None' as a string or just ' '

Edit:

In my new Def i have added a check that if infolabels['plot'] = None then make infolabels['plot'] ='' (ie a string)
maybe i will come accross more of these when adding each infolabel.
I did:
Code:
if infolabels['plot'] is None:
            infolabels['plot']=''
         if infolabels['rating'] is None:
            infolabels['rating']=float(0)
         if infolabels['genre'] is None:
            infolabels['genre']=''
         if infolabels['duration'] is None:
            infolabels['duration']=int(0)  
         if infolabels['mpaa'] is None:
            infolabels['mpaa']=''
         if infolabels['trailer_url'] is None:
            infolabels['trailer_url']=''
         if infolabels['cast'] is None:
            infolabels['cast']=''

Maybe you should change the return from None to ''

Edit:
Also found that Trailer Urls load but when trying to play they dont. Is there a way to get the Youtube trailer to play using the Youtube addon.

Thanks for the log, first one I've seen where that has happened.. I'll have to do a little debugging to see how that None is falling thru, it should be getting picked up..
find quote
Eldorado Offline
Posting Freak
Posts: 922
Joined: May 2009
Reputation: 11
Post: #105
k_zeon Wrote:these are wrong. does anyone know what should be passed if nothing is found

if infolabels['rating'] is None:
infolabels['rating']=float(0) <<< wrong

if infolabels['duration'] is None:
infolabels['duration']=int(0) wrong

What happens when you pass in those values? Do you see 0's in xbmc?

I would hope it would just not display them.. sort of like a i' value > 0' then display type of check
find quote
k_zeon Offline
Senior Member
Posts: 204
Joined: Aug 2011
Reputation: 0
Post: #106
Eldorado Wrote:What happens when you pass in those values? Do you see 0's in xbmc?

I would hope it would just not display them.. sort of like a i' value > 0' then display type of check

Hey Eldorado

No i keep getting script errors after loading so many menu Dirs, i think on Rating or Duration.
when i take out the code for them and dont add them to dir it works.
Nothing is getting displayed when using infolabels['rating']=float(0) etc but this must be where it errors out


Here is my def to load Directories.
Code:
def add_Metadirectory(self, queries, infolabels,title='', img='', fanart='', resolved=False, total_items=0,  item_type='video'):

    
         infolabels = self.unescape_dict(infolabels)
        
         url = self.build_plugin_url(queries)
        
         listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img)
         self.log_debug(u'adding movie: %s - %s' % (infolabels['title'], infolabels['rating']))

         if infolabels['plot'] is None:
            infolabels['plot']=''
         if infolabels['rating'] is None:
            infolabels['rating']=str('')
         if infolabels['genre'] is None:
            infolabels['genre']=''
         if infolabels['duration'] is None:
            infolabels['duration']=str('')  
         if infolabels['mpaa'] is None:
            infolabels['mpaa']=''
         if infolabels['trailer_url'] is None:
            infolabels['trailer_url']=''
         if infolabels['cast'] is None:
            infolabels['cast']=''
  
         listitem.setInfo('video', {'Title': title, 'Genre': infolabels['genre'], 'Plot': infolabels['plot'], 'Rating': float(infolabels['rating']),
                                    'Duration': infolabels['duration'],'Cast': infolabels['cast'],'Trailer': infolabels['trailer_url']})

         xbmcplugin.addDirectoryItem(self.handle, url, listitem, isFolder=True, totalItems=total_items)

and the calling line in my addon is:
addon.add_Metadirectory({'mode' : 'GetMovieSource', 'url' : url }, meta ,total_items=len(match),title=CleanHTML(name) + ' (' + sYear + ')' , img=meta['cover_url'])

Just Pushed a New Git for you to test.

if i do this listitem.setInfo('video', {'Title': title, 'Genre': infolabels['genre'], 'Plot': infolabels['plot'],'Cast': infolabels['cast'],'Trailer': infolabels['trailer_url']})
then it works and the menu's get load and i can see the thumbnail, i can get plot etc.
(This post was last modified: 2011-10-22 18:30 by k_zeon.)
find quote
k_zeon Offline
Senior Member
Posts: 204
Joined: Aug 2011
Reputation: 0
Post: #107
Hey Eldorado. any luck with why some of the infolabels are failing.

Also how to play the Youtube Trailers as they all do not work at present
The animated circle shows then just disappears.
(This post was last modified: 2011-10-22 22:08 by k_zeon.)
find quote
slyi Offline
Junior Member
Posts: 39
Joined: Sep 2011
Reputation: 0
Post: #108
k_zeon Wrote:Also how to play the Youtube Trailers as they all do not work at present
The animated circle shows then just disappears.

I find this works ok
PHP Code:
infoLabels['trailer'] = urlresolver.HostedMediaFile(url=meta['trailer_url']).resolve() 
find quote
slyi Offline
Junior Member
Posts: 39
Joined: Sep 2011
Reputation: 0
Post: #109
Eldorado Wrote:Check the icefilms dev thread in this forum, one of the last posts I gave a link to a forked version where I merged the master branch with stable, master is the unfinished branch with many new features

Not sure about merging with t0mm0's lib, there's a lot of cleanup that would need to be done in the icefilms code to get to that point

Ok i can do that, it will take me a few days to complete a patch but have you considered creating a urlresolver branch aswell for icesfilms most the major functionality are working now eg: ice resolver sample on http://dl.dropbox.com/u/6589941/icefilms...lms.py.txt, it could be a future point release 1.1.0. Anarchintosh's original code works well but it does need refactoring around the new script modules.

BTW: Im seeing
PHP Code:
Error attempting to insert into cache tablecolumns imdb_idtvdb_idepisode_idtitleseasonepisode are not unique 
for "my name is earl" episodes, have you encountered this before?
find quote
k_zeon Offline
Senior Member
Posts: 204
Joined: Aug 2011
Reputation: 0
Post: #110
slyi Wrote:I find this works ok
PHP Code:
infoLabels['trailer'] = urlresolver.HostedMediaFile(url=meta['trailer_url']).resolve() 

Hi Slyi

I use Eldorado's Metahandler module to get the meta data.
in this module is meta['trailer_url'] = md.get('trailer', '')

if i try:
infoLabels['trailer'] = urlresolver.HostedMediaFile(url=md.get('trailer', '')).resolve() << this should work but does not
tried adding this to metahandler. did not work. but got circle animation.


I tried this in my addon before adding to the Dir. Did not work. script error
tried adding to t0mm0's module , but script error.

whare should i try to put it.

tks
(This post was last modified: 2011-10-23 15:29 by k_zeon.)
find quote
Post Reply