Kodi Community Forum

Full Version: plugin.video.themoviedb.helper - Access to TheMovieDb API for Skinners
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
TheMovieDb Helper
See the WIKI on github for more details.

Download
https://github.com/jurialmunkey/plugin.v...edb.helper

Donate
https://ko-fi.com/jurialmunkey
**RESERVED**
Errrrrrrrrrrr. Thank god that I've just started a proof of concept for a extendedinfo replacement on the paper and no code line was written yet.
You saved me a lot of time. I'll take a look at it. Thanks!
Code:

2019-07-31 12:25:07.107 T:27484   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeEncodeError'>
                                            Error Contents: 'ascii' codec can't encode character u'\xe9' in position 3: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 564, in <module>
                                                router(sys.argv[2][1:])
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 547, in router
                                                list_items(items[category['request_key']], category['item_dbtype'], category['request_dbtype'])
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 457, in list_items
                                                url = get_url(info='item', tmdb_id=i.get('id', ''), type=item_dbtype, title=title)
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 237, in get_url
                                                return '{0}?{1}'.format(_url, urlencode(kwargs))
                                              File "E:\Kodi-Leia\system\python\Lib\urllib.py", line 1343, in urlencode
                                                v = quote_plus(str(v))
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 3: ordinal not in range(128)
                                            -->End of Python script error report<--
(2019-07-31, 12:26)sualfred Wrote: [ -> ]
Code:

2019-07-31 12:25:07.107 T:27484   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeEncodeError'>
                                            Error Contents: 'ascii' codec can't encode character u'\xe9' in position 3: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 564, in <module>
                                                router(sys.argv[2][1:])
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 547, in router
                                                list_items(items[category['request_key']], category['item_dbtype'], category['request_dbtype'])
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 457, in list_items
                                                url = get_url(info='item', tmdb_id=i.get('id', ''), type=item_dbtype, title=title)
                                              File "E:\Kodi-Leia\portable_data\addons\plugin.video.themoviedb.helper\main.py", line 237, in get_url
                                                return '{0}?{1}'.format(_url, urlencode(kwargs))
                                              File "E:\Kodi-Leia\system\python\Lib\urllib.py", line 1343, in urlencode
                                                v = quote_plus(str(v))
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 3: ordinal not in range(128)
                                            -->End of Python script error report<--

What were you trying to do that caused this error? Or was it just opening from video add-ons?
Just opening from the addons. Popular movies for example is returning this error.

Btw:
What is def. a must have is a select dialog for multiple results like extendedinfo does. For example if multiple actors with the same name are available.
Hmm. I can't recreate the error at all. Unicode errors are a pita.

What version of Leia are you using? I might try a portable install and see if I can recreate the error.

Yeah definitely will have a pop-up for multiple results when searching by name rather than tmdb_id.
I'm hoping to try to minimize the need for look-ups by name only as much as possible though.

EDIT: Are you by chance using Kodi Matrix (v19)? I'm wondering if it's a Python 3 thing. That character in the error is "é", which would be from "Pokémon Detective Pikachu" in Popular Movies. I just can't recreate the error though - I tried on Leia on both Windows and LibreElec and it works perfectly fine.
Congratulations!
@jurialmunkey, this is fantastic, thanks! Will you be adding in the future other movie properties like budget and revenue?

Regards,

Bart
(2019-07-31, 19:52)bsoriano Wrote: [ -> ]@jurialmunkey, this is fantastic, thanks! Will you be adding in the future other movie properties like budget and revenue?

Regards,

Bart
+1

Ratings for movies and tvshows would be great too.
(2019-07-31, 19:52)bsoriano Wrote: [ -> ]@jurialmunkey, this is fantastic, thanks! Will you be adding in the future other movie properties like budget and revenue?

Added.
ListItem.Property(budget) and ListItem.Property(revenue)

Keep in mind that detailed info is only available when you "enter into" the item (i.e. the first screenshot). TMDB api only provides basic info when searching lists like Recommended. I don't want to go into SkinHelper territory of running a service, so I only call the detailed info for the item when you click on it

Other properties available:
ListItem.Property(Genre.X.Name)
ListItem.Property(Studio.X.Name)
ListItem.Property(Country.X.Name)
^ These three all provide Genre.X.ID which will be used when I implement Genre.Studio/Country look-ups (coming soon! Wink )

For people there are:
ListItem.Property(birthday)
ListItem.Property(deathday)
ListItem.Property(aliases) - aka "known as"
ListItem.Property(role) - aka "know for" (e.g. "Actress" or "Director")
ListItem.Property(born) - aka "place of birth"

All also put tmdb_id as property in
ListItem.Property(tmdb_id)
(2019-07-31, 20:19)Edworld Wrote: [ -> ]
(2019-07-31, 19:52)bsoriano Wrote: [ -> ]@jurialmunkey, this is fantastic, thanks! Will you be adding in the future other movie properties like budget and revenue?

Regards,

Bart
+1

Ratings for movies and tvshows would be great too.

Script already puts TMDB rating in ListItem.Rating for the item.
TMDB doesn't supply any other ratings. Though I doubt it would be that difficult to work in OMDB as well.

EDIT: Oh Do you mean ListItem.MPAA? TMDB doesn't supply that. I will have to use OMDB. Looking at the API, it should be too difficult to implement though.
(2019-08-01, 00:27)jurialmunkey Wrote: [ -> ]
(2019-07-31, 19:52)bsoriano Wrote: [ -> ]@jurialmunkey, this is fantastic, thanks! Will you be adding in the future other movie properties like budget and revenue?

Added.
ListItem.Property(budget) and ListItem.Property(revenue)

Keep in mind that detailed info is only available when you "enter into" the item (i.e. the first screenshot). TMDB api only provides basic info when searching lists like Recommended. I don't want to go into SkinHelper territory of running a service, so I only call the detailed info for the item when you click on it

Other properties available:
ListItem.Property(Genre.X.Name)
ListItem.Property(Studio.X.Name)
ListItem.Property(Country.X.Name)
^ These three all provide Genre.X.ID which will be used when I implement Genre.Studio/Country look-ups (coming soon! Wink )

For people there are:
ListItem.Property(birthday)
ListItem.Property(deathday)
ListItem.Property(aliases) - aka "known as"
ListItem.Property(role) - aka "know for" (e.g. "Actress" or "Director")
ListItem.Property(born) - aka "place of birth"

All also put tmdb_id as property in
ListItem.Property(tmdb_id) 
@jurialmunkey , thanks!! I was planning on using those properties in the video info dialog, so I would call the plugin with "?info=item&title=$INFO[ListItem.Title]&year=$INFO[ListItem.Year]&&type=movie", correct? Given that I do not necessarily have the tmdbid for the movie.

Regards,

Bart
@jurialmunkey

Your Unicode issue is here: 'v = quote_plus(str(v))'

Remove 'str'... for sanity avoid using 'str'....

BTW kudos on the release.
(2019-08-01, 00:37)bsoriano Wrote: [ -> ]
(2019-08-01, 00:27)jurialmunkey Wrote: [ -> ]
(2019-07-31, 19:52)bsoriano Wrote: [ -> ]@jurialmunkey, this is fantastic, thanks! Will you be adding in the future other movie properties like budget and revenue?

Added.
ListItem.Property(budget) and ListItem.Property(revenue)

Keep in mind that detailed info is only available when you "enter into" the item (i.e. the first screenshot). TMDB api only provides basic info when searching lists like Recommended. I don't want to go into SkinHelper territory of running a service, so I only call the detailed info for the item when you click on it

Other properties available:
ListItem.Property(Genre.X.Name)
ListItem.Property(Studio.X.Name)
ListItem.Property(Country.X.Name)
^ These three all provide Genre.X.ID which will be used when I implement Genre.Studio/Country look-ups (coming soon! Wink )

For people there are:
ListItem.Property(birthday)
ListItem.Property(deathday)
ListItem.Property(aliases) - aka "known as"
ListItem.Property(role) - aka "know for" (e.g. "Actress" or "Director")
ListItem.Property(born) - aka "place of birth"

All also put tmdb_id as property in
ListItem.Property(tmdb_id) 
@jurialmunkey , thanks!! I was planning on using those properties in the video info dialog, so I would call the plugin with "?info=item&title=$INFO[ListItem.Title]&year=$INFO[ListItem.Year]&&type=movie", correct? Given that I do not necessarily have the tmdbid for the movie.

Regards,

Bart
Yes that's correct, though you've got a double ampersand at the end there - only need one.

Plus I think you need to replace & with &amp; in skin xml.

You should also be able to get the tmdb_id as a property from that list to then use for other lists in the info dialog.

This is the general idea of one of the main use cases. I haven't tested extensively in info dialog yet, so I'm interested in how it goes.