DisplayVideoInfo.xml Update Actor Image control
#1
I have a video add-on that calls DisplayVideoInfo.xml via a context menu add command:

li.addContextMenuItems([ (addon.getLocalizedString(30347), 'Container.Refresh'), (addon.getLocalizedString(30346), 'Action(ParentDir)'), (addon.getLocalizedString(30348), 'XBMC.Action(Info)') ])

I am having difficulty passing the image info (in this case I am testing with the Confluence skin) to the Actor image control in the DisplayVideoInfo.xml file.  Specifically:

              <control type="image">
                    <description>Actor image</description>
                    <left>210</left>
                    <top>480</top>
                    <width>160</width>
                    <height>160</height>
                    <texture>$INFO[Container(50).Listitem.Icon]</texture>
                    <aspectratio>keep</aspectratio>
                    <visible>Control.IsVisible(50)</visible>
                </control>

If I change the texture parameter to a hard coded file name I get the image so I know the basic skin functionality is working as I want.  I am passing the DisplayVideoInfo.xml the rest of the parameters in the video info window just fine via the following code in my add-on:

if mediaClass_text == 'video':  
                    li.addContextMenuItems([ (addon.getLocalizedString(30347), 'Container.Refresh'), (addon.getLocalizedString(30346), 'Action(ParentDir)'), (addon.getLocalizedString(30348), 'XBMC.Action(Info)') ])
                    
                    info = {
#                        'id': '1234',
                        '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,
                        'code': imdb_text,
                        'mediatype': categories_text.split(','),
                        'season': season_text,
                        'episode': episode_text,
                        'lastplayed': lastplayed_text,
                        'aired': aired_text,
                        'mpaa':content_rating_text,
                        'playcount':playcount,
                        'trailer':trailerurl,
                        'icon':'d:\gbutler.jpg',
                    }
                    li.setInfo(mediaClass_text, info)
                    li.setProperty('ResumeTime', dcmInfo_text)
                    li.setProperty('TotalTime', str(getSeconds(duration_text)))
                    video_info = {
                        'codec': video_codec_text,
                        'aspect': aspect,
                        'width': video_width,
                        'height': video_height,
                    }
                    li.addStreamInfo('video', video_info)
                    li.addStreamInfo('audio', {'codec': audio_codec_text, 'language': audio_lang, 'channels': int(audio_channels_text)})
                    li.addStreamInfo('subtitle', {'language': subtitle_lang})


I tried hard coding the red text above for testing  but passing the icon variable is not supported this way according to: http://mirrors.kodi.tv/docs/python-docs/...em-setInfo
 
And the logs confirm it:

2020-03-26 19:51:47.544 T:34480   ERROR: NEWADDON Unknown Video Info Key "icon"

Can someone point me in the right direction here ?  I want to pass a list of URLs which point to files on my uPNP server to populate the  <texture>$INFO[Container(50).Listitem.Icon]</texture> skin element.  I know I am missing something simple here but just can't see it.

Thanks in advance,

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
#2
you need to pass the list of actors (name/role/icon) to kodi using the ListItem.setCast() method:
https://codedocs.xyz/xbmc/xbmc/group__py...fb7ccd3619

... moving this to python develoment
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thank you so much.  That is the solution and I've already got it coded and working.  I am running into one problem and am wondering what the recommended practice is for solving.  I am somewhat new to Kodi development.  The problem I am trying to solve is that there are times where I will query actor thumbnails from the uPNP server but I don't have a thumbnail image yet in the server database.  When that occurs the uPNP server sends back a generic thumbnail image vs. the real actor image.  Kodi then stores this in the textures database for caching.  If I then update the image on the uPNP server it starts sending it back but Kodi continues to look at the textures database.  Does Kodi have a caching timer and will eventually update it's database or do I need to figure out another solution ?   Since the skin code is getting the URL response I can't try and catch the generic image.  Looking for some direction here.

Thanks in advance
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
#4
I've been doing some reading and caching incorrect images into the texture database seems to be a common problem with scrapers and such, where there are utilities out to manage or you can blow away the textures database.  I am not going to try and solve this right now.  I do have one other major Kodi skin functionality question (I know I am probably over my limit already) which is the key on whether all this work or whether it will end up being a waste of time. 

In the DisplayVideoInfo.xml file that creates the Video Info dialog window I want to override the functionality when you click on a cast member not to query the Kodi database but instead query my uPNP database for a list of movies the cast member stars in.  I already have the uPNP add-on function written to create the new window with the list of movies but am looking for how I override the functionality calling the Kodi database.  

I found the onClick method https://codedocs.xyz/xbmc/xbmc/group__py...aa78bcc4ef which I think might work.  If so, I need to figure out how to grab the control ID from the control and how to call the method.  It seems to indicate that Kodi will call it automatically.   

This is the last step .  If I get this working I am fully functional with the add-on.

Can someone with more skinning and Python knowledge weigh in here ?

 

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
I resolved the Kodi textures database caching issue.  I wrote a textures database delete query that will delete all images in the texture table based upon the URL of my uPNP server when the add-on starts.  I created an add-on setting to allow the user to enable and disable the caching setting.   It is working perfectly. 

I continue to explore my main challenge with the DisaplayVideoInfo window.  I am able to get the window ID and the control ID for the cast panel is 50.  It appears that  DisaplayVideoInfo is an internal Kodi control and that I may not be able to get the selected value from control 9000 when the user clicks on it.  From what I am slowly piecing together Python has some limitations working with built-in skin controls.  I tried the brute force by adding an OnClick command to the DisaplayVideoInfo.xml file for panel control and it had no effect.  Looking for some advice.
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
#6
I've come up with a brute force approach to solving my problem but I am quite sure it isn't recommended by the Kodi folks.  It involves writing my uPNP server metadata (actors, description, genre etc..) and movie paths into the Kodi database with the path pointing to the uPNP server streams for the movies.  I've done it manually by hand and it works.  When I click on an actor panel entry (control ID 50) n the DisplayVideoInfo.xml generated info window Kodi searches its database finds the movie by actor and brings up the search results for the movie I input into the Kodi database.  Then when I click on the movie it plays from the uPNP server since I entered that path info into the Kodi database vs. a normally local Kodi scraped local file path. 

Again this is not a pretty solution and I doubt the Kodi database was meant to be used like this but it does work.  Hopefully I can find a way to intercept the built-in calls from the DisplayVideoInfo.xml  window and avoid all of this.  Besides I really don't want to do this level of SQL Lite database coding.
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
#7
So I ended up coding the SQL approach, reverse engineering the Kodi database and populating it from my uPNP server.  Aside from the slow initial load time to populate the Kodi database as I go through each playlist and folder, it is working very well.  It wasn't my preferred approach but it is working.
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
#8
(2020-03-30, 20:19)jbinkley60 Wrote: I resolved the Kodi textures database caching issue.  I wrote a textures database delete query that will delete all images in the texture table based upon the URL of my uPNP server when the add-on starts.  I created an add-on setting to allow the user to enable and disable the caching setting.   It is working perfectly. 

I continue to explore my main challenge with the DisaplayVideoInfo window.  I am able to get the window ID and the control ID for the cast panel is 50.  It appears that  DisaplayVideoInfo is an internal Kodi control and that I may not be able to get the selected value from control 9000 when the user clicks on it.  From what I am slowly piecing together Python has some limitations working with built-in skin controls.  I tried the brute force by adding an OnClick command to the DisaplayVideoInfo.xml file for panel control and it had no effect.  Looking for some advice.
Now that I've gotten quite a bit better at Kodi plugin development I've gone back and improved how I handle the textures database issue for my uPNP server cached images.  I wrote a background process which runs every 30 minutes and with an SQL query looks at the Textures database texture table where the the lasthashchecked field is blank and the URL is pointing to my uPNP server.  These become blank as the user browses the playlists from the uPNP server and Kodi checks the image freshness and then blanks the field.  When this happens I use another set SQL query to update the blanks to the current time minus 3 days.  This forces Kodi to recheck the image for freshness to see if the uPNP server has a newer image.

def updateTexturesCache(contenturl):     # Update Kodi image cache timers
 
    try:
        from sqlite3 import dbapi2 as sqlite
    except:
        from pysqlite2 import dbapi2 as sqlite
                      
    DB = os.path.join(xbmc.translatePath("special://database"), "Textures13.db")
    db = sqlite.connect(DB)

    rfpos = contenturl.find(':',7)      #  Get uPNP server info
    serverport = '%' + contenturl[rfpos+1:rfpos+6] + '%'
    newtime = (datetime.now() + timedelta(days=-3)).strftime('%Y-%m-%d %H:%M:%S')

    cur = db.execute('UPDATE texture SET lasthashcheck=? WHERE URL LIKE ? and lasthashcheck=?', \
    (newtime, serverport, ""))          # Update uPNP image cache timers with no dates
    rows = cur.rowcount       
    db.commit()
    db.close()
    xbmc.log('uPNP textures cache timers '  + str(rows) + ' rows updated.', xbmc.LOGNOTICE)      

So far this solution has been working very well to maintain image freshness but still support caching.
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

Logout Mark Read Team Forum Stats Members Help
DisplayVideoInfo.xml Update Actor Image control0