v19 How to populate the actor images on the Info dialog?
#1
Any idea how the actor images can be added in the video addon? I'm able to specify the cast for a movie through the info tag but actor photos are not shown in the Info dialog, just names. Any particular API I need to use to populate the photo links?
Reply
#2
(2021-08-27, 15:22)abratchik Wrote: Any idea how the actor images can be added in the video addon? I'm able to specify the cast for a movie through the info tag but actor photos are not shown in the Info dialog, just names. Any particular API I need to use to populate the photo links?

I do it in a two step process.  First create a cast dictionary list and then add the cast list dictionary to the listitem.

python:
                actor_list = ''
    cast_dict = []    # Added cast & thumbnail display from Mezzmo server
    cast_dict_keys = ['name','thumbnail']
    actors = item.find('.//{urnConfusedchemas-upnp-org:metadata-1-0/upnp/}artist')
    if actors != None:
        actor_list = actors.text.encode('utf-8', 'ignore').split(',')
        for a in actor_list:                  
            actorSearchUrl = imageSearchUrl + "?imagesearch=" + a.lstrip().replace(" ","+")
            new_record = [ a.strip() , actorSearchUrl]
            cast_dict.append(dict(zip(cast_dict_keys, new_record)))


    info = {
            'duration': getSeconds(duration_text),
            'genre': genre_text,
            'year': release_year_text,
            'title': title,
            'plot': description_text,
            'director': creator_text,
            'tagline': tagline_text,
            'writer': writer_text,
            'cast': artist_text.split(','),
            'artist': artist_text.split(','),
            'rating': rating_val,
            'imdbnumber': imdb_text,
            'mediatype': categories_text,
            'season': season_text,
            'episode': episode_text,
            'lastplayed': last_played_text,
            'aired': release_date_text,
            'mpaa':content_rating_text,
            'studio':production_company_text,
            'playcount':playcount,
            'trailer':trailerurl,
            'tvshowtitle':album_text,
            'dateadded':date_added_text,
        }
    li.setInfo(mediaClass_text, info)

Here's a link using the setCast approach which is similar.  Here's the link to the newer InfoTagVideo
 approach.  I've not done any coding with it yet but I believe the same cast list dictionary works with it..

Note the utf-8 encode isn't needed for Kodi 19 and the cast append format changes to:

cast_dict.append(dict(list(zip(cast_dict_keys, new_record))))


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
Hi Jeff, thanks a lot, it worked! but only when I'm populating both cast and artist fields. Seems like setCast is essentially setting up the dictionary with cast information while info tags 'cast' and 'artist' only create placeholders.

One more question if I may - is there any way to have a delayed loading of cast information? For example, when I show the list of movies, I get only actor names from the server. If I need to get details on actors I need to query the server again for every movie. as a result, the movie list takes long time to load. Instead, I'd like to load actor dictionary when the Info dialog is displayed. Is it possible?

Also, when I click on the photo of an actor, some search on the actor is performed but nothing is returned. How do I customize this search so that either actor info or something meaningful is returned?

Thanks a lot for your help again!
Reply
#4
I can't speak for the info tags, as I haven't used them yet. 

To your second topic, the answer is "yes" but there's a few things to understand.  First, the setCast call can be done at any time for a specific listItem and so you don't necessarily have to set the cast with the listitem info dictionary like I do.  You could call setCast afterwards.  This is where your second and third items come together.  To get the cast to load (i.e. query your source) when you click the info button you'll need to intercept the button press in the skin and then do whatever you want with your code when you intercept it.  I've never been able to get that working  but I know it can be done.    This is the same for your third question about doing something when you click on the actor name (or photo depending upon your skin) in the info panel.  You can edit the DialogVideoInfo file for each skin but that could become unwieldy unless you are just doing it for a skin for yourself vs. many skins for multiple users.  I was faced with the same challenge for actor action.  I dropped Kodi into debug mode and found that Kodi issues SQL calls against the video database querying actors and directors. 

I ended up doing a bit of reverse engineering and I use SQL calls to insert (i.e. sync databases) between my source and Kodi.  So the SQL queries pull from the Kodi database but have pointers back to my source content.  It was a bit of a heavy lift approach but ended up working very well across all skins.  I originally tried to go the intercept approach but decided on the SQL insertion approach given my results. 

What is the source of your content ?  There are some Kodi database import efforts underway for certain source types.  My addon has a service component which does sync in the background


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#5
(2021-08-28, 19:39)jbinkley60 Wrote: I can't speak for the info tags, as I haven't used them yet. 

To your second topic, the answer is "yes" but there's a few things to understand.  First, the setCast call can be done at any time for a specific listItem and so you don't necessarily have to set the cast with the listitem info dictionary like I do.  You could call setCast afterwards.  This is where your second and third items come together.  To get the cast to load (i.e. query your source) when you click the info button you'll need to intercept the button press in the skin and then do whatever you want with your code when you intercept it.  I've never been able to get that working  but I know it can be done.    This is the same for your third question about doing something when you click on the actor name (or photo depending upon your skin) in the info panel.  You can edit the DialogVideoInfo file for each skin but that could become unwieldy unless you are just doing it for a skin for yourself vs. many skins for multiple users.  I was faced with the same challenge for actor action.  I dropped Kodi into debug mode and found that Kodi issues SQL calls against the video database querying actors and directors. 

I ended up doing a bit of reverse engineering and I use SQL calls to insert (i.e. sync databases) between my source and Kodi.  So the SQL queries pull from the Kodi database but have pointers back to my source content.  It was a bit of a heavy lift approach but ended up working very well across all skins.  I originally tried to go the intercept approach but decided on the SQL insertion approach given my results. 

What is the source of your content ?  There are some Kodi database import efforts underway for certain source types.  My addon has a service component which does sync in the background


Jeff

Hi Jeff, thanks a lot for your response and input!

The source of the content is a website, which has JSON api and returns detailed data on artists based on the movie ID. I get the list of movies first and generate the list items based on that. However, artist details are not returned along with the movie list, unfortunately. I can, of course, query all the artists iteratively while building the list of movies, but it will take 20-30-50 web site API calls over WAN, which will be slow and will ruin overall movie browsing experience.
One possible alternative would be to query the movie data explicitly when needed and then storing it in the database as you suggested. I'd like to minimize the API calls to the web site as much as possible.
Reply

Logout Mark Read Team Forum Stats Members Help
How to populate the actor images on the Info dialog?0