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.
@jurialmunkey 
This is great!... although i can't make it work yet. I've follow your instructions but after the video info dialog closes and the custom window is open it stays there without doing nothing. This is my custom window code...
xml:
<?xml version="1.0" encoding="UTF-8"?>
<window type="window" id="1140">
    <defaultcontrol always="true">9999</defaultcontrol>
    <controls>
        <control type="group">
                <include>FanartFade</include>
            <control type="image">
                <include>FullscreenDimensions</include>
                <colordiffuse>$VAR[BG.GlobalColor]</colordiffuse>
                <texture background="true">special://skin/extras/backgrounds/SKINDEFAULT.jpg</texture>
            </control>
            <control type="image">
                <include>FullscreenDimensions</include>
                <texture background="true">windows/bg/bg_vignette.png</texture>
            </control>
            <control type="image">
                <include>FullscreenDimensions</include>
                <texture background="true">windows/bg/bg_overlay.png</texture>
            </control>
        </control>
        <control type="list" id="9999">
            <include>HiddenListContainer</include>
            <content target="videos">$INFO[Window(Home).Property(TMDbHelper.Path.Current)]</content>
        </control>
    </controls>
</window>

and i am running the script from an <onright/> tag like this...
xml:
<onright condition="!String.IsEmpty(ListItem.CastAndRole)">RunScript(plugin.video.themoviedb.helper,add_path=$INFO[ListItem.FolderPath],call_auto=1140)</onright>

EDIT: Also i notice that the $INFO[Window(Home).Property(TMDbHelper.Path.Current] is filled with the ListItem.FileNameAndPath of the item that the video info dialog was open.

What am i doing wrong?
(2020-01-03, 13:25)bsoriano Wrote: [ -> ]@jurialmunkey, this is great, thanks! So if I understand correctly, now there is no need for the intermediate window that calls the window that used to have the person info, correct?

Now it is just the custom window and dialog video info.

Also, no need for the previous on back actions in the video info widget lists, correct?

Finally, I do not need to do any del_path or reset_path actions anywhere, correct?

When you have a chance, please confirm so I know how to modify my existing code. Thanks.

Yep, correct on all accounts.

Make sure that you remove all the onback, del_path, reset_path, Dialog.Close() etc. commands as they will mess with the window manager.

EDIT: Also, you will need to use direct plugin paths for the lists in person info now. e.g. you can't use <content>Container(9999).ListItemAbsolute(1).FolderPath</content> anymore for the Cast in Movies list - instead, you will need to use <content>plugin://plugin.video.themoviedb.helper?info=stars_in_movies&amp;type=person&amp;tmdb_id=$INFO[ListItem.Property(tmdb_id)]</content>

See the wiki for the paths:
https://github.com/jurialmunkey/plugin.v...ts-Related
Also, if you need to close the dialog for any reason (e.g. to play a video etc.) then run this command to close the dialog and clear the service monitor before doing your action (replace 1190 with your custom window id).
Code:
<onclick>RunScript(plugin.video.themoviedb.helper,close_dialog=1190)</onclick>

Make sure you have v2.2.3
(2020-01-03, 14:09)jurialmunkey Wrote: [ -> ]Make sure you have v2.2.3
Same result. Still cant make it work.
(2020-01-03, 13:48)nessus Wrote: [ -> ]and i am running the script from an <onright/> tag like this...
xml:
<onright condition="!String.IsEmpty(ListItem.CastAndRole)">RunScript(plugin.video.themoviedb.helper,add_path=$INFO[ListItem.FolderPath],call_auto=1140)</onright>

EDIT: Also i notice that the $INFO[Window(Home).Property(TMDbHelper.Path.Current] is filled with the ListItem.FileNameAndPath of the item that the video info dialog was open.

What am i doing wrong?

Is this for a cast list that is NOT supplied by TMDbHelper? It won't have the correct path to call. You need to pass a info=details path to add_path.

Instead, to call person details from Kodi's inbuilt cast list you need to use add_query= and specify type=person
xml:
<onclick>RunScript(plugin.video.themoviedb.helper,add_query=$INFO[Container(50).ListItem.Label],type=person,call_auto=1190)</onclick>

You can also do this method for other plugins or kodi library paths that supply movies/tvshows by specifying type=movie or type=tv. Make sure to change Container(50) to match the container ID.

If multiple matching items are found when using add_query then the user will be presented with a dialog box to select the correct one.

Basically this method looks up the correct info=details path automatically for you and then passes it to the add_path method -- it's like doing ?info=details&amp;query= but you get a dialog box to select the correct item rather than the script guessing.
Basically, if it's a list from TMDbHelper use add_path= as that will be the exact path.
If it's a list from anywhere else then use add_query= with type= as the script needs to do a query look-up first to find the correct path.
So, all the infolabels & infoproperties they will be for a detailed item?
(2020-01-03, 14:47)nessus Wrote: [ -> ]So, all the infolabels & infoproperties they will be for a detailed item?

Yep, it's exactly the same as before but now you don't need to worry about managing the windows with del_path/reset_path/onload/onback conditions.

You just add the path/query and the script handles the rest.

In simplified terms, the basic flow is:
  1. You call add_query and the script finds the detailed item path and then adds it to TMDbHelper.Path.Current
  2. The script closes the info dialog.
  3. The script opens the custom window if it's the first run through.
  4. The script waits for Container(9999).IsUpdating to finish and then does SetFocus(9999) and then Action(Info).
  5. Once the info dialog is open, the script waits for one of the following scenarios:
  • If the add_path/query is called again then it goes to 1 and repeats.
  • If the dialog window is closed then it deletes the current path and replaces it with the previous path and goes to 2 and repeats.
  • If there is no previous path then the script clears all properties and exits.
  • If the custom window gets closed (user presses back twice quickly or hits ESC), then script clears all properties and exits
  • If the close_dialog method is called, then script clears all properties and exits
@jurialmunkey , on another note, I just saw this, multiple times in the log (trakt is correctly authenticated):

xml:

2020-01-03 12:30:32.508 T:15384  NOTICE: [plugin.video.themoviedb.helper]
                                            HTTP Error Code: 404
                                            Request: https://api.trakt.tv//shows/tt7671598/se.../4/ratings
2020-01-03 12:30:32.508 T:15384  NOTICE: [plugin.video.themoviedb.helper]
                                            Func: get_listitem
                                            Unknown format code 'f' for object of type 'str'

I can understand the 404 error, but the other error I guess is one you need to fix in the code?

Regards,

Bart
(2020-01-03, 18:35)bsoriano Wrote: [ -> ]@jurialmunkey , on another note, I just saw this, multiple times in the log (trakt is correctly authenticated):

xml:

2020-01-03 12:30:32.508 T:15384  NOTICE: [plugin.video.themoviedb.helper]
                                            HTTP Error Code: 404
                                            Request: https://api.trakt.tv//shows/tt7671598/se.../4/ratings
2020-01-03 12:30:32.508 T:15384  NOTICE: [plugin.video.themoviedb.helper]
                                            Func: get_listitem
                                            Unknown format code 'f' for object of type 'str'

I can understand the 404 error, but the other error I guess is one you need to fix in the code?

Regards,

Bart

It's fine - just the service monitor logging an error that it can't format a number because it got a string due to 404 on trakt.
EDIT: On latest update (v2.2.4) you shouldn't get this error anymore. Also improved clean-up of window manager.
(2020-01-03, 14:29)jurialmunkey Wrote: [ -> ]Instead, to call person details from Kodi's inbuilt cast list you need to use add_query= and specify type=person
xml:
<onclick>RunScript(plugin.video.themoviedb.helper,add_query=$INFO[Container(50).ListItem.Label],type=person,call_auto=1190)</onclick>
Using this i get unicode error for some actor names.
Example... Movie: The 5th Wave, Actor: Chloë Grace Moretz
xml:
Error Type: <type 'exceptions.UnicodeDecodeError'>
Error Contents: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)
(2020-01-05, 13:24)nessus Wrote: [ -> ]
(2020-01-03, 14:29)jurialmunkey Wrote: [ -> ]Instead, to call person details from Kodi's inbuilt cast list you need to use add_query= and specify type=person
xml:
<onclick>RunScript(plugin.video.themoviedb.helper,add_query=$INFO[Container(50).ListItem.Label],type=person,call_auto=1190)</onclick>
Using this i get unicode error for some actor names.
Example... Movie: The 5th Wave, Actor: Chloë Grace Moretz
xml:
Error Type: <type 'exceptions.UnicodeDecodeError'>
Error Contents: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)

Surprised I've missed that one. Should be fixed now. Can you test and confirm.
(2020-01-05, 22:10)jurialmunkey Wrote: [ -> ]Surprised I've missed that one. Should be fixed now. Can you test and confirm. 
Yep... it's fixed.

Thanks
Nessus
@jurialmunkey 
Two more things about this.

1. If you click twice on a item (either a tmdb widget item or a cast item from standard Kodi's list), the (video/actor) info is open but when click/back to close it reopens for second time. If you click three times then it reopens three times and so on.

2. With this call_auto method, in actor info, can we have the ListItem.Property(numitems.tmdb) (separate for movies & tv shows) & ListItem.Property(numitems.dbid) (total for movies & tv shows), filled without the need to show/update their lists containers ?


Cheers
Nessus
(2020-01-06, 12:20)nessus Wrote: [ -> ]1. If you click twice on a item (either a tmdb widget item or a cast item from standard Kodi's list), the (video/actor) info is open but when click/back to close it reopens for second time. If you click three times then it reopens three times and so on.
If you're setting focus to another control first, I honestly don't understand how you have enough time to click twice (let alone three times!). I tried to double click as fast as I possible could and my second click always hits the control I sent focus to onclick rather than my list.

If you click multiple times on any onclick action, the command is going to activate multiple times no matter what it is -- there's not much I can do about that other than say don't do that...

(2020-01-06, 12:20)nessus Wrote: [ -> ]2. With this call_auto method, in actor info, can we have the ListItem.Property(numitems.tmdb) (separate for movies & tv shows) & ListItem.Property(numitems.dbid) (total for movies & tv shows), filled without the need to show/update their lists containers ?

Try latest. You should now get some window properties
EDIT: I've now moved these to infolabels attached to the detailed item instead:
xml:

$INFO[ListItem.Property(NumItems.DBID.Movies)]
$INFO[ListItem.Property(NumItems.DBID.TvShows)]
$INFO[ListItem.Property(NumItems.DBID.Episodes)]
$INFO[ListItem.Property(NumItems.DBID.Total)]
$INFO[ListItem.Property(NumItems.TMDB.Cast)]
$INFO[ListItem.Property(NumItems.TMDB.Crew)]
$INFO[ListItem.Property(NumItems.TMDB.Total)]
$INFO[ListItem.Property(NumItems.TMDB.Movies.Cast)]
$INFO[ListItem.Property(NumItems.TMDB.Movies.Crew)]
$INFO[ListItem.Property(NumItems.TMDB.Movies.Total)]
$INFO[ListItem.Property(NumItems.TMDB.TvShows.Cast)]
$INFO[ListItem.Property(NumItems.TMDB.TvShows.Crew)]
$INFO[ListItem.Property(NumItems.TMDB.TvShows.Total)]

DBID properties are the number of items returned by JSON-RPC from kodi library where person name matches either actor, writer or director. "NumItems.DBID" is the combined total. Note that Episodes seem to only be counted if the person is a guest star, not a regular cast member. For instance, when I looked up Alec Baldwin, I got hardly any episodes despite having the entire 30 Rock box set scanned to my library. Whereas I got a lot of episodes for Elizabeth Banks as she was a guest star for a couple of seasons.

The results from TMDb are the Total Number of the Item returned -- so this number will also include items in your library. This is the best I can do without iterating through every item and checking it individually.

I haven't tested this on a lower powered system yet, so please let me know how it fairs performance wise. Seems fine on my laptop but that's relatively powerful compared to most htpc boxes.