jurialmunkey / plugin.video.themoviedb.helper

GNU General Public License v3.0
203 stars 96 forks source link

New service monitor methods #876

Closed matke-84 closed 2 years ago

matke-84 commented 2 years ago

What are the benefits of the new system? Is there any reason to switch to it? Do I need to change anything in the skin code because of these changes? Thanks in advance for the answers.

jurialmunkey commented 2 years ago

Yes you would need to make significant changes to use the new method. Look at the changelog diff in AH2 0.5.1 release notes for what was involved in the skin. You can still use the old method however.

The basic gist is that instead of setting window properties, the new method sets a listitem with the details to a hidden container you specify. You can then reference that container just like any other standard listitem. The main benefit is that the names are exactly the same as a normal item eg to get tvshowtitle it is container(id).listitem.tvshowtitle instead of window(home).property(tmdbhelper.listitem.tvshowtitle)

The other benefit is cached items display faster and with fewer "gaps" with blank data temporarily showing - so there is less on screen flicker. It also allows for TMDBh to update it while scrolling through a list rather than blanking the properties. The data doesn't need to be reconfigured for window property names and iterated through to be set/clear 100s of properties - instead TMDbH can just grab the cached listitem and add it directly to the list as one object which makes things much smoother.

And at least on Windows where I've been testing, the general performance overall on the skin side is also better because referencing listitems is slightly quicker than checking properties. Kodi is designed to use listitems so they're always going to be better than window properties which aren't really designed for this purpose.

Main downside (other than reconfiguring skin code) is that you need to have the hidden list in every window and dialog you want to use the detailed lookup. You can't access the container in myvideonav from the info dialog - the info dialog must have its own. Also make sure that the ID you choose will not conflict with other control IDs or you will have bad results (eg if you accidentally reuse it for a button kodi will probably crash since you can't add listitems to a button).

I'll document all these new features soon.

matke-84 commented 2 years ago

I tried a little test. I must have missed something. I put it at the start of the skin: <onload>Skin.SetString(TMDbHelper.MonitorContainer,99950)</onload> Also in the dialogvideoinfo.xml

<control type="list" id="99950">
            <width>1</width>
            <height>1</height>
            <itemlayout />
            <focusedlayout />
            <left>-1920</left>
</control>

$INFO[Container(99950).ListItem.Property(Awards)] But I don't get anything.

jurialmunkey commented 2 years ago

First check that you actually did set the string by looking at $INFO[Skin.String(TMDbHelper.MonitorContainer)]

Make sure service monitor is on. Skin.SetBool(TMDbHelper.Service)

Make sure you didn't use that ID for anything else.

Also use something more straightforward to check like label $INFO[Container(99950).ListItem.Label]

Also note you can only get the Container listitem from the same dialog as it is in. If you are using some custom overlay to check the properties it won't be visible to it. If the list is in DialogVideoInfo.xml then the label must be there too.

matke-84 commented 2 years ago

Got it all. Now works. I'm going to continue testing. There will be a lot of work here until all lines are replaced.

matke-84 commented 2 years ago

I replaced the code and everything works smoothly. Well done mate. Every day tmdb helper is getting better and better. I found a small bug, maybe it's not up to the new service monitor method. When you enter the episodes and start navigating through them, everything is fine, when you return to previous episodes, trakt and emmy awards suddenly appear and imdb and tmdb rating start showing the rating of the entire tv shows. This also happens in ah2. More precisely, only emmy appears in ah2 because you put trakt that it only appears in movies and tv shows, so it doesn't appear in episodes but everything else happens. You can see everything in the video, except that tmdb behaves normally for this tv show, but for some others it happens that when returning, it starts to show the rating of the whole tv show. Fun fact that trakt gives some ratings for episodes since I know you told me that it's not possible at the moment but I'm not sure if they are correct.

https://user-images.githubusercontent.com/74268331/192608971-350ae8f3-2d73-491e-8312-f41649feb87e.mp4

matke-84 commented 2 years ago

I found another bug. I can't get top250 in search hub. I checked some other properties and they work. Ratings mostly don't work (TMDb rating works). It worked with the old service monitor. $INFO[Container(99950).ListItem.Property(Top250)]

jurialmunkey commented 2 years ago

Ratings get joined after the listitem is added so it doesn't have to wait for them. That might mean there is a delay between when the details are added and when the ratings are added if it involves a lookup.

jurialmunkey commented 2 years ago

Works fine for me:

Screenshot 2022-09-28 174842

Screenshot 2022-09-28 175049

matke-84 commented 2 years ago

If you are using some custom overlay to check the properties it won't be visible to it.

I forgot about this fact.

matke-84 commented 2 years ago

I have a small glitch in dialog info. When I enter info dialog, top 250 rating appears. When I enter the next content that is not in the top 250, it appears for a second and disappears. When you re-enter the content that is in the top 250, then the rating flashes again. It looks like it doesn't clear the property on exit and it's loading it again upon entry, but as you can see, it only happen with top 250. Other things appear and disappear normally. Of course I use it in widgets: <onfocus>SetProperty(TMDbHelper.WidgetContainer,Home)</onfocus> This worked normally with old service monitor.

https://user-images.githubusercontent.com/74268331/192761095-dc64ee61-335c-4393-a382-13ed5960f3f7.mp4

jurialmunkey commented 2 years ago

Yeah it's because each window has its own hidden list so the item in MyVideoNav is actually entirely separate from the one in DialogVideoInfo.

The service monitor won't be able to update the hidden list in the info dialog until the dialog is opened again. Which means there's a very short delay inbetween opening the dialog and the hidden list updating where Kodi will have kept the old item loaded.

The reason you didn't see the changeover in the old method is because the window property was already overwritten when you were focused on the item in the viewtype. The update still happened again when you opened the info dialog - it's just that it's the same info in that case.

Not really any solution -- the list needs to exist before it can be updated. It's a small price to pay for the many other benefits the new method.

jurialmunkey commented 2 years ago

Note that if you put a short delay of about 400ms for when your main info hidden animation triggers and your dialog info windowopen animation triggers then you shouldn't see this changeover. And to the user it will look the same because the animations will sync.

e.g. something like the following in the top left info group.

**Main View**
<visible>!Window.IsVisible(DialogVideoInfo.xml)</visible>
<animation effect="fade" start="100" end="0" delay="399" time="1">Hidden</animation>

**Info Dialog**
<animation effect="fade" start="0" end="100" delay="399" time="1">WindowOpen</animation>
matke-84 commented 2 years ago

Yes, I already did something similar. Thanks for advice. Is there a solution for those ratings in episodes, that when returning back, start to give ratings from a level above, more precisely from the whole tv show?

jurialmunkey commented 2 years ago

Nope. I'm aware of that issue. Episode ratings haven't worked properly for a while.

~I think your "imdb" rating is probably just ListITem.Rating which will be TMDb's one. Then that's getting overridden by the actual IMDB rating lookup which is only available for tvshow from OMDb.~ Nope that's not the case, it's from somewhere else - not sure where that's coming from

But I should be able to get individual TMDb and Trakt ratings for episodes.

matke-84 commented 2 years ago

I use almost all the ratings from tmdb helper, and imdb of course. Also in ah2 it has imdb rating for episodes. I don't know what you think about that, like in the skin helper sevice, all ratings from the entire tv shows are displayed for episodes, as they are displayed for the seasons. Maybe it will be the simplest variant. I know there will be questions about my skin, why don't all the ratings appear in the episodes as well, even though no one realizes that they are not ratings from the episodes. People like to see as many ratings as possible, no matter where they come from.

jurialmunkey commented 2 years ago

Do you have the "Get additional details from Kodi database" option enabled?

I guarantee that the original rating that you're getting is from your Kodi library, then that is being overwritten by the one retrieved from OMDb afterwards.

matke-84 commented 2 years ago

Nope. unnamed

jurialmunkey commented 2 years ago

Did you have it on previously? If you did it would've been cached.

There's only two places the IMDB_Rating property comes from - Kodi library and OMDb. OMDb doesn't give episode ratings, only tvshow ratings - so the only possible way for you to have different IMDb ratings for episodes is if it is coming from your library.

matke-84 commented 2 years ago

Pay attention to the ratings. The same thing happens in ah2. The imdb and tmdb ratings on the way back get the ratings from the entire tv shows. The episodes opens now for the first time. Ratings were not cashed.

https://user-images.githubusercontent.com/74268331/193060586-e31322cb-3454-46db-a8d7-4cc2028ce627.mp4

matke-84 commented 2 years ago

The tv show is from tmdb helper. I don't have it in my local library.

jurialmunkey commented 2 years ago

Okay it appears that TMDb is now giving IMDb numbers for individual episodes which means it is possible to get the IMDb rating for the episode from OMDb (the only way to get the episode rating from there is with the IMDb number for the episode -- can't get it with TV IMDb + episode number).

That's why you're seeing that behaviour - the initial lookup was getting the episode value because the IMDb was intact and then it was getting overwritten by the TV show details when the ratings updated for the tvshow. v5.0.5 will allow to have both side-by-side . You will need to reset ItemBuilder cache for it to work.

matke-84 commented 2 years ago

One word. Perfect. Now tvdb rating is missing and we have perfect ratings for tv shows. I hope that the people who maintain tvdb will give us their ratings like before even for old tv shows.

matke-84 commented 2 years ago

Oh yeah. I forgot to ask, are you going to disable ratings that give a 0.0 rating in tmdb helper or should I do it in the skin?