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.
(2023-07-04, 00:51)Sea Wolfe Wrote: [ -> ]@jurialmunkey

Another Trakt question:

"Your in-Progress TV Shows" from Trakt via TMDBhelper, I can see several shows with Seasons that have just returned, showing up on the Trakt Website, and through Trakt mobile Apps.  But these don't (yet) show up through TMDBHelper in Kodi.  Is this just another case of TMDBHelper pulling from the Trakt cache through the API, and I have to wait for whenever that cache gets updated next?

TIA

Yeah, that'll be a caching issue. How long are we talking though? Because it shouldn't be more than a day at very max (but shouldn't even be that long). The sync list is based on watched status, so sometimes watching something (i.e. update watched status on Trakt) can force it to refresh quicker.

If you haven't already, I recommend enabling "TMDbHelper Settings > Widgets > Next episodes checks calendar" as that will get you more accurate results for new episodes in these "next up" type lists. It was added because the sync list used for calculating In-Progress can often lag quite a bit for updating new episode details.

With the above setting enabled, I've never really had any issues with new episodes not showing up. I use the "In-Progress", "Next Episodes" and "Still to Watch" lists as homescreen widgets on my loungeroom setup, so these get used daily in my household and it would definitely get noticed if new episodes weren't showing up.
(2023-07-04, 05:30)jurialmunkey Wrote: [ -> ]Skin problem. Not using the plugin correctly.
Thank you for checking.
(2023-07-04, 05:58)jurialmunkey Wrote: [ -> ]If you haven't already, I recommend enabling "TMDbHelper Settings > Widgets > Next episodes checks calendar" as that will get you more accurate results for new episodes in these "next up" type lists. It was added because the sync list used for calculating In-Progress can often lag quite a bit for updating new episode details.
This was the solution I needed!  All good now!

I know you probably went over this is in the past...so I appreciate you taking the time to answer!  Cheers!
@jurialmunkey I would be grateful if you check where I'm going wrong because I can't get the service monitor to work.

Home.xml

<onload>Skin.SetString(TMDbHelper.MonitorContainer,99950)</onload>

DialogVideoInfo.xml

xml:

<onload>Skin.SetBool(TMDbHelper.Service)</onload>

<control type="list" id="99950">
<top>-10</top>
<width>10</width>
<height>1</height>
<viewtype label="">list</viewtype>
<orientation>horizontal</orientation>
<itemlayout height="1" width="1"/>
<focusedlayout height="1" width="1"/>
</control>

but <label>$INFO[Container(99950).ListItem.Property(Next_Aired)]</label> doesn't return anything. I can even change it to just Container(99950).ListItem.Label but it's still empty.

Thanks.
@Hitcher

What version of the plugin are you using?

The official Kodi repo version (v4.10) only supports the "classic" window property method. To use the container method, you need the version from my repo (v5+)

You should do the SkinSetBool(TMDbHelper.Service) at startup. It needs to be enabled when Kodi starts (it can be toggled on/off but the idle loop only checks the setting every 30 seconds so it isn't good for toggling on demand).

Otherwise your code should work for the library or info dialog.

For widgets on the home screen (or anywhere else), you need to set the "TMDbHelper.WidgetContainer" property to direct the service to the widget list ID you'd like to do the lookups for. You need to set this property whenever you want to get details for a container that isn't a library view specified by <views></views>

Usually I add this as an onfocus for my widgets so that it will change depending on which widget has focus e.g.

xml:


<!-- Widget 1234 -->
<control type="list" id="1234">
<onfocus>SetProperty(TMDbHelper.WidgetContainer,1234,Home)</onfocus>
[...]
</control>

<!-- Widget 5678 -->
<control type="list" id="5678">
<onfocus>SetProperty(TMDbHelper.WidgetContainer,5678,Home)</onfocus>
[...]
</control>
Thanks again for your help. I moved <onload>Skin.SetBool(TMDbHelper.Service)</onload> to the Home.xml and noticed I somehow had no . in the Skin.SetBool even though I copied it here correctly. Huh
I plan on using the 'Lists Next Aired Calendar' feature to replace my old 'TV Show Next Aired' layout but would like to check out how other skins implement it first. Do you use it any of yours use it or do you know of any other skins that do?

Thanks.
(2023-07-04, 05:40)jurialmunkey Wrote: [ -> ]Sorry, silly mistake - forgot to push the update to github. Should be fixed now in v0.0.5
https://github.com/jurialmunkey/script.w...tag/v0.0.5
Thanks for the update!

I had to install it manually which unfortunately the update is not linked to your repository and Wikipedia remains in version 0.0.4
(2023-07-06, 12:35)Hitcher Wrote: [ -> ]I plan on using the 'Lists Next Aired Calendar' feature to replace my old 'TV Show Next Aired' layout but would like to check out how other skins implement it first. Do you use it any of yours use it or do you know of any other skins that do?

Thanks.

Yep AH2 has a next aired calendar

Relevant part of the include for the widgets which should be plenty to get you started:
https://github.com/jurialmunkey/skin.arc...l#L83-L148

I use widgets setup for individual days covering a week starting from Yesterday (startdate=-1 days=1). You can use any startdate/day values in paths that you like if you want a wider range of dates or want widgets that cover a longer period (startdate=0 is today and days=X is number of days the list covers - from memory I think limit is up to 31 days either side).

I have two custom windows - one for Library based calendar and one for Trakt based calendar. The windows are identical and just switch the info param used in the plugin path.
https://github.com/jurialmunkey/skin.arc...tAired.xml
https://github.com/jurialmunkey/skin.arc...tAired.xml

Container(ID).ListItem.Property(widget) can be used to get the day name if days=1 (unless it's one of the below special labels)
if days=1 and startdate=-1|0|1 "Yesterday|Today|Tomorrow"
if days=7|14|30 and startdate=0 "This Week|Fortnight|Month"
if days=7|14|30 and startdate=-7|-14|-30 "Last Week|Fortnight|Month"
Perfect, just what I was looking. Thanks.
@jurialmunkey Got the Next Aired Calendar working but I have a request.

Can you add an option to let the skin override the 'stacked' option please?

Thanks.

EDIT: I also noticed that ListItem.Property(air_time) isn't using my regional setting for 'Time format' of h:mm:ss xx instead it's always using hh:mm.

EDIT2: Is it also possible to open the TV show in the library when clicking on an episode?
(2023-07-08, 21:01)Hitcher Wrote: [ -> ]Can you add an option to let the skin override the 'stacked' option please?

What's the justification for overriding the user's settings?

I try to avoid options overriding the user's settings because otherwise I end up with complaints and bug reports about settings being broken.

Happy to consider it but needs a compelling reason other than personal preference (in which case it should be up to the user).

(2023-07-08, 21:01)Hitcher Wrote: [ -> ]EDIT: I also noticed that ListItem.Property(air_time) isn't using my regional setting for 'Time format' of h:mmConfuseds xx instead it's always using hh:mm.

Seconds are stripped out intentionally as air time data doesn't include seconds and it wouldn't really make sense for air_time anyway.

The AM/PM for xx should be honoured (it works for me).

The 0 padded hours is because Kodi hardcodes "h" as %I which is 0 padded 12 hour time as seen here:
https://github.com/xbmc/xbmc/blob/5b7e88...c.cpp#L449

So that's working correctly according to what Kodi returns with getRegion()


(2023-07-08, 21:01)Hitcher Wrote: [ -> ]EDIT2: Is it also possible to open the TV show in the library when clicking on an episode?

ListItem.Property(tvshow.dbid) will give you the base tvshow library DBID as long as you have enabled the option to retrieve Kodi database details in settings (it's an option for performance reasons for users with large libraries - so it's not something that can be forced by a skin).

xml:

<onclick>ActivateWindow(videos,videodb://tvshows/titles/$INFO[Container(ID).ListItem.Property(tvshow.dbid)]/,return)</onclick>

There is also a user setting to automatically set this as the folderpath
Code:

TMDbHelper Settings > Widgets > Next aired library calendar links to local tvshow

However, I just realised that setting is only working for single episodes and I need to fix it for stacked ones.
(2023-07-09, 10:22)jurialmunkey Wrote: [ -> ]What's the justification for overriding the user's settings?

I try to avoid options overriding the user's settings because otherwise I end up with complaints and bug reports about settings being broken.

Happy to consider it but needs a compelling reason other than personal preference (in which case it should be up to the user).
Simply because this is a totally separate window that replicates the 'TV Show Next Aired' addon and isn't accessed via themoviedb.helper.

Custom window activated directly from the home menu -

Image

themoviedb.helper Next Aired Library -

Image

So the themoviedb.helper Next Aired Library layout will still stack episodes if the user enables it.

(2023-07-09, 10:22)jurialmunkey Wrote: [ -> ]Seconds are stripped out intentionally as air time data doesn't include seconds and it wouldn't really make sense for air_time anyway.

The AM/PM for xx should be honoured (it works for me).

The 0 padded hours is because Kodi hardcodes "h" as %I which is 0 padded 12 hour time as seen here:
https://github.com/xbmc/xbmc/blob/5b7e88...c.cpp#L449

So that's working correctly according to what Kodi returns with getRegion()
Weirdly it's now working this morning so there must be some delay when changing regional settings.

(2023-07-09, 10:22)jurialmunkey Wrote: [ -> ]ListItem.Property(tvshow.dbid) will give you the base tvshow library DBID as long as you have enabled the option to retrieve Kodi database details in settings (it's an option for performance reasons for users with large libraries - so it's not something that can be forced by a skin).

xml:
<onclick>ActivateWindow(videos,videodb://tvshows/titles/$INFO[Container(ID).ListItem.Property(tvshow.dbid)]/,return)</onclick>
That worked nicely.

(2023-07-09, 10:22)jurialmunkey Wrote: [ -> ]There is also a user setting to automatically set this as the folderpath

Code:
TMDbHelper Settings > Widgets > Next aired library calendar links to local tvshow
That has no effect because it's not using themoviedb.helper Next Aired Library views.

Massive thanks for all your help over the last few week.
FYI.  I was looking at Kodi issue 23445 (GH issue) and from some testing it looks like the problem is the plugin getting called but the sys.argv passed to it has RTL items inverted (like if bidi algo was applied prior to setting the argument. I'm going to set it up in debugger and see if I can determine how argv is getting set (haven't ever looked at it before).

scott s.
.
(2023-07-10, 01:08)scott967 Wrote: [ -> ]FYI.  I was looking at Kodi issue 23445 (GH issue) and from some testing it looks like the problem is the plugin getting called but the sys.argv passed to it has RTL items inverted (like if bidi algo was applied prior to setting the argument. I'm going to set it up in debugger and see if I can determine how argv is getting set (haven't ever looked at it before).

scott s.
.

Thanks. I've added some extra details to the issue thread.

Looking closer, I think you might be right about it being something in how sys.argv is getting set from the content tags in the skin engine. As far as I can tell, when the $INFO is used in a library xsp path it will work correctly and is not flipped, but as soon as it is passed to a plugin (any plugin, not just TMDbHelper) then it will be flipped.