jurialmunkey / plugin.video.themoviedb.helper

GNU General Public License v3.0
200 stars 95 forks source link

[question] button artwork select and refresh in season/episode level #803

Closed matke-84 closed 2 years ago

matke-84 commented 2 years ago

Hi Jurial. Just one short question. Is there a possibility to put these two buttons in the season/episode dialog info level? I am currently using this and it works in tv shows and movies in dialog info.

<onclick condition="$EXP[IsTvShowDBType] + System.HasAddon(plugin.video.themoviedb.helper)">Runscript(plugin.video.themoviedb.helper,select_artwork,tmdb_id=$INFO[ListItem.UniqueID(tmdb)],tmdb_type=tv)</onclick>
<onclick condition="$EXP[IsMovieDBType] + System.HasAddon(plugin.video.themoviedb.helper)">Runscript(plugin.video.themoviedb.helper,select_artwork,tmdb_id=$INFO[ListItem.UniqueID(tmdb)],tmdb_type=movie)</onclick>
<onclick condition="$EXP[IsTvShowDBType] + System.HasAddon(plugin.video.themoviedb.helper)">Runscript(plugin.video.themoviedb.helper,refresh_details,tmdb_id=$INFO[ListItem.UniqueID(tmdb)],tmdb_type=tv)</onclick>
<onclick condition="$EXP[IsMovieDBType] + System.HasAddon(plugin.video.themoviedb.helper)">Runscript(plugin.video.themoviedb.helper,refresh_details,tmdb_id=$INFO[ListItem.UniqueID(tmdb)],tmdb_type=movie)</onclick>
matke-84 commented 2 years ago

@jurialmunkey Sorry Jurial. Is this possible? I have tried various ways to get to these buttons in episode dialog info but I have not succeeded. Thanks in advance.

jurialmunkey commented 2 years ago

You need season and episode params

matke-84 commented 2 years ago

Doesn't matter. Forget.

matke-84 commented 2 years ago

Sorry, but I have to ask one more question. I am using this code and it works, but I want to define more detailed info about the episode and I try to set a condition $INFO[ListItem.Year] but it doesn't work. How to define the tv show year. <onclick>Runscript(plugin.video.themoviedb.helper,select_artwork,query=$INFO[ListItem.TvShowTitle],season=$INFO[ListItem.Season],type=episode,episode=$INFO[ListItem.Episode])</onclick>

matke-84 commented 2 years ago

I found this on the kodi forum, however, it doesn't return tv show it should by year, returns the last known one. <onclick>Runscript(plugin.video.themoviedb.helper,select_artwork,query=$INFO[ListItem.TvShowTitle],episode_year=$INFO[ListItem.Year],season=$INFO[ListItem.Season],type=episode,episode=$INFO[ListItem.Episode])</onclick>

jurialmunkey commented 2 years ago

year= is a strict match. For year you must have the exact premiere year of the show. TMDbHelper will use first search result for the query where searchresult_title==query and searchresult_year==year.

episode_year= is a fuzzy match because episode years might be later than tvshow premiere year. The episode_year matches first search result where searchresult_title=query and searchresult_year<=episode_year. It isn't always perfect because of this reason.

If you have ListItem.UniqueID(tmdb) you should combine it with query. There's no problem with mixing params - TMDbH will use the best info available.

For example tmdb_id=$INFO[ListItem.UniqueID(tmdb)],query=$INFO[ListItem.TVShowTitle] is acceptable. If ID is available it will be used, otherwise TMDbH will fall back to a query search.

jurialmunkey commented 2 years ago

Also, type should only ever be tv or movie. TMDbH determines if something is a season or episode because there is a season/episode number supplied.

matke-84 commented 2 years ago

Wait now I'm confused. My problem is that the button doesn't work for me in the info dialog of the episode. The button works perfectly in parent tv show info dialog. I tried with this combination but it doesn't work in the info dialog of the episode. Ok, I also put type=tv but still not working.

Runscript(plugin.video.themoviedb.helper,select_artwork,type=tv,tmdb_id=$INFO[ListItem.UniqueID(tmdb)],query=$INFO[ListItem.TVShowTitle],season=$INFO[ListItem.Season],episode=$INFO[ListItem.Episode])
matke-84 commented 2 years ago

I think this will work. tmdb_id=$INFO[ListItem.UniqueID(tmdb)] definitely can't go for seasons and episodes. <onclick>Runscript(plugin.video.themoviedb.helper,select_artwork,type=tv,query=$INFO[ListItem.TVShowTitle],year=$INFO[ListItem.Year],season=$INFO[ListItem.Season],episode=$INFO[ListItem.Episode])</onclick>

jurialmunkey commented 2 years ago

tmdb_id=$INFO[ListItem.UniqueID(tmdb)] definitely can't go for seasons and episodes.

Why not? TMDb only has IDs for tv or movies. If the item has TMDb ID then it will be for tvshow.

Runscript(plugin.video.themoviedb.helper,select_artwork,type=tv,query=$INFO[ListItem.TVShowTitle],year=$INFO[ListItem.Year],season=$INFO[ListItem.Season],episode=$INFO[ListItem.Episode])

This will only work for Season 1 episodes. In Season 2 the year will be wrong.

matke-84 commented 2 years ago

I do not know what's going on. It doesn't want to load the window for me. It just starts loading and that's it. Look at the code to see if I typed it correctly. Is that okay. Runscript(plugin.video.themoviedb.helper,select_artwork,type=tv,tmdb_id=$INFO[ListItem.UniqueID(tmdb)],query=$INFO[ListItem.TVShowTitle],season=$INFO[ListItem.Season],episode=$INFO[ListItem.Episode])

jurialmunkey commented 2 years ago

It looks right. What item are you trying it on?

matke-84 commented 2 years ago

Flash from 1990.

matke-84 commented 2 years ago
022-07-26 17:00:37.179 T:11996   DEBUG <general>: [plugin.video.themoviedb.helper]
                                                   lib.script.router - route_taken  select_artwork
2022-07-26 17:00:37.215 T:5416    DEBUG <general>: Activating window ID: 10160
2022-07-26 17:00:37.215 T:5416    DEBUG <general>: ------ Window Init (DialogBusy.xml) ------
2022-07-26 17:00:37.221 T:5416    DEBUG <general>: ------ Window Deinit (DialogBusy.xml) ------
2022-07-26 17:00:37.242 T:5416    DEBUG <general>: Activating window ID: 10160
2022-07-26 17:00:37.242 T:5416    DEBUG <general>: ------ Window Init (DialogBusy.xml) ------
2022-07-26 17:00:37.262 T:11996   DEBUG <general>: [plugin.video.themoviedb.helper]
                                                   CACHE: Initialized
2022-07-26 17:00:37.711 T:11996   DEBUG <general>: Skipped 1 duplicate messages..
2022-07-26 17:00:37.711 T:11996   DEBUG <general>: [plugin.video.themoviedb.helper]
                                                   HTTP Error Code: 404
                                                   Request: https://api.themoviedb.org/3/tv/13194/season/1?&append_to_response=credits,images,release_dates,content_ratings,external_ids,movie_credits,tv_credits,keywords,reviews,videos,watch/providers&region=US&language=en-US&include_image_language=en,null&include_video_language=en,null,en
2022-07-26 17:00:37.721 T:11996   DEBUG <general>: [plugin.video.themoviedb.helper]
                                                   CACHE: Closed database_v5_TMDb.db_simplecache
2022-07-26 17:00:37.721 T:11996   DEBUG <general>: [plugin.video.themoviedb.helper]
                                                   CACHE: Closed database_v5_ItemBuilder.db_simplecache
2022-07-26 17:00:37.721 T:11996    INFO <general>: CPythonInvoker(96, C:\Users\Marko\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\script.py): script successfully run
2022-07-26 17:00:37.721 T:11996   DEBUG <general>: CPythonInvoker::onExecutionDone(96, C:\Users\Marko\AppData\Roaming\Kodi\addons\plugin.video.themoviedb.helper\script.py)
2022-07-26 17:00:37.826 T:11996   DEBUG <general>: .
2022-07-26 17:00:38.031 T:11996    INFO <general>: Python interpreter stopped
2022-07-26 17:00:38.031 T:11996   DEBUG <general>: Thread LanguageInvoker 11996 terminating
jurialmunkey commented 2 years ago

Is this from something in the library? I just realised the default tv scraper dumps episodes IDs into that field eventhough they aren't useful because you cant search by episode ID on the API.

matke-84 commented 2 years ago

It's not. This is straight from the tmdb helper.

jurialmunkey commented 2 years ago

Oh use tvshow.tmdb in that case

$INFO[ListItem.UniqueID(tvshow.tmdb)]

matke-84 commented 2 years ago

Finally. Thanks.

jurialmunkey commented 2 years ago

Yeah sorry I got things mixed up. It is seasons where (tmdb) is the same as (tvshow.tmdb) -- episodes have their own ID it just isn't very useful as you cant search it in the API so needs to use (tvshow.tmdb) at episode level.