Displaying and populating movieinformation window
#1
I'm working on a plugin that allows browsing and playing (via Chrome Launcher) of Starz Play, Encore Play, and Movieplex Play movies and original series.

I've created a pretty standard movie directory for browsing, but would like to add a "Movie information" context menu option similar to the movie info option in the Movies library. I can open the movieinformation window, but my efforts to populate the window with information have been unsuccessful.

Help?

This is basically what I have now:
Code:
window = xbmcgui.Window(12003)

# What to do here to populate the window with the movie data?

window.show()
Reply
#2
Found it! For others that may be looking for something similar, add a context menu option with 'XBMC.Action(Info)' as the link

Roughly:
Code:
contextmenu = []
contextmenu.append(('Movie information', 'XBMC.Action(Info)'))
listitem.addContextMenuItems(contextmenu)
Reply
#3
Hey Brad,
first, thanks for sharing this ! that fixed an issue of mine : I was using 'XBMC.ActivateWindow("movieinformation")', which was quite similar to your first solution - Window had no clue on which movie to get data from.

I'm also trying to display a movie directory, but to be able to quickly check the results of scrapping. Could you describe a bit more how you created the list of items on which you added the context menu ? I'm only having weird incomplete behavior : Info Window does not contain full information and the 'refresh' button is greyed out). I think this comes from how I created my list...

I currently have this :

Code:
# set addon content
xbmcplugin.setContent(addon_handle, 'videos')

....

url = movie["file"] # something like smb://my_file_path.avi
filename = ntpath.basename(url)
li = xbmcgui.ListItem(filename, filename, None , movie["thumbnail"] if "thumbnail" in movie else None, url)
li.setInfo(type='video', infoLabels={'year':movie["year"],
                     'title': movie["label"],
                     'director': movie["director"],
                     'plot': (movie["plot"] if "plot" in movie else '') })
li.addContextMenuItems([('Movie Information', 'XBMC.Action(Info)')])
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)

Do you see any difference with what you're doing ?
Thanks in advance Smile

BePov
Reply
#4
Hey BePov, just reading through, what you have seems good. What information is missing? The info window seems to be populated primarily by the information supplied in the infolabels.

My full code is here: https://github.com/bradyemerson/plugin.v...ie.py#L158
Reply
#5
It's mostly missing 2 things :
- The refresh button is greyed out, so I can't update the movie/tvshow/file
- The choose art button only lets me browse through local art, and does not allow online art search as it would in the library mode

It's as if the info window didn't actually have the correct path/file-id/link to the video. I'm wondering if that's actually feasible... I would have to do something like XBMC.Action(Info, movieid) or something

I've checked your code, but, if i understand correctly, you link only to external files and so you probably don't need this refresh button (I can't test yet because I don't have any of the required accounts)
Reply
#6
If you are looking to populate the Info screen with meta data then you can use my script Metahandlers to do it all for you - https://github.com/Eldorados/script.module.metahandler

It scrapes from TMDB/IMDB, and TVDB.. gives you all meta data in format you need

If you need help using it just ask
Reply
#7
Yes, what Eldoardo said. The refresh button is only available when viewing items in the Kodi library. Within your plugin, you need to supply all of the information you want to display in the info window. Eldoardo's plugin provides a unified interface for pulling from several scrapers, or if you would prefer to not have the dependency, here is an example of integrating with TVDB from the USTVOD plugin https://github.com/moneymaker365/plugin....on.py#L434

I'm not sure how the art chooser works. You may be able to look through the artwork downloader plugin and see if there are any integration points you can use. https://github.com/XBMC-Addons/script.ar...downloader
Reply
#8
Quote:Yes, what Eldoardo said. The refresh button is only available when viewing items in the Kodi library.

that's what i feared

ok thanks, i'll take a look at those links !
Reply
#9
(2015-01-22, 16:03)Eldorado Wrote: If you are looking to populate the Info screen with meta data then you can use my script Metahandlers to do it all for you - https://github.com/Eldorados/script.module.metahandler

It scrapes from TMDB/IMDB, and TVDB.. gives you all meta data in format you need

If you need help using it just ask

@Eldorado, does your script also retrieve posters and fanarts? Any tutorials on usage?
I want to make addon a bit fancy when listing videos but don't want the addon to hang (especially rpi). Any tips on implementation (async)?
Reply
#10
Yes it grabs all meta info including posters/banners and fanart

I don't have anything written up, but it's pretty easy

example:

Code:
from metahandler import metahandlers

metaget=metahandlers.MetaData()

#Get a movie
#Media type and movie name are required, imdb id will give you exact match, if no imdb id then include the year for more accurate match
#Media type and Name are required, rest are optional
meta=metaget.get_meta('movie', 'The Hangover', imdb_id=imdb_id, year=year)

#Get a tvshow
#Same as movie
meta=metaget.get_meta('tvshow', 'The Simpsons', imdb_id, year=year)

#Get tv seasons
#imdb_id is required as you should already have it from the tv show
#seasons is a list, list of seasons for given tv show you wish to retrieve
meta=metaget.get_seasons('The Simpsons', imdb_id=imdb_id, seasons)


#Get tv episode
meta=metaget.get_episode_meta('The Simpsons', imdb_id, season, episode)

All data is returned properly formatted to pass into your listitem

eg.
Code:
liz = xbmcgui.ListItem(name, iconImage=meta['cover_url'], thumbnailImage=meta['cover_url'])
liz.setInfo(type="Video", infoLabels=meta)
liz.setProperty('fanart_image', meta['backdrop_url'])

See my github - https://github.com/Eldorados/script.module.metahandler
Reply
#11
I will try the code. What is the best practice to retrieve metadata for addons? I'm worried about performance.
If my directory listing has 25 tv shows I don't want it to take like 25 seconds before showing the list to the user.
Do I need to add a scheduled background process which retrieves meta data? Can I retrieve meta data asynchronous?
Reply
#12
It won't take that long, and as it grabs the meta data it stores it in a cache db so the next time you load the list it's much faster as it doesn't have to do any web calls

You need the meta data as you build each list item, so the process has to wait for it... ie. you can't show the list if you don't have the pieces to create it yet

Give it a try and test the speeds, on decent machines it would process 25 shows in just a couple seconds, there is a dependency on the response time from the scraper sites though
Reply
#13
I'm trying to get decent speeds on a Raspberry Pi so I think I need to find a better friendly solution to grab meta data in the background.

I tried your meta data but bump to some problems/questions:
- get_matching_shows from a TheTVDB instance doesn't use the tvdb configured language. I've fixed it in my fork.
- How can I pass unicode show names to the get_meta function? I got the famous UnicodeDecodeError exception. After encoding the show name to utf-8 grabbing data works, BUT the unicode/utf? charcters in the show names aren't stored in the database. Tips? I'll wait for your answer before going deeper in your code.
Reply
#14
I believe the current language option was only built for TMDB, but would gladly accept any changes that applies it to TVDB as well

You need to encode the name as you have done, the database stores them stripped of any special characters as I found it too difficult to handle, what is stored in the DB shouldn't affect you though as what you send in for the Title will be what's sent back to you, the title in the DB is only used to check for existing cache entries, I found this the simplest solution for more consistent matching

Not sure how you will be able to grab meta data in the background, unless you do something like build the list first, display, once meta data is retrieved re-build the list... but seems to be a waste to do this way

Also remember once it's cached, the response time is much faster
Reply
#15
Thanks for you reply.

I will send a pull request for my change so you can review it. That will fixed the configured language of the metahandler module. In my opinion that configuration is just for the default language. Addons still need to use the function with a language passed to it because there are addons with different languages.

I will take a look at your code. I need the chinese characters to be stored in the database as well.
This is why my addon doesn't retrieve the correct metadata because a tv show with only chinese (special) characters are stored as blank. Retrieving from the cache is always matching the one with the blank entry Sad.

I thought about building the list first for the user so they can continue to use the addon without having to wait for grabbing the metadata. They won't see any metadata yet the first time until the next time they revisit the list.
The first time to grab metadata is taking too long and blocking the UI. That's why I'm trying to find a better solution.
Reply

Logout Mark Read Team Forum Stats Members Help
Displaying and populating movieinformation window0