jurialmunkey / plugin.video.themoviedb.helper

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

Autoplaylist creation and upnext addon integration #768

Closed IG2022 closed 2 years ago

IG2022 commented 2 years ago

Hi Jurial,

This isn't an issue but more of a question. I noticed recently that tmdb helper now creates a playlist of the next episodes of a tv show you are watching automatically which is fantastic (I am actually not sure if it is tmdb helper or AH2 that does this as I have both installed but either way it's great)

I was wondering if it would be possible to use the upnext plugin with this auto created tmdb helper (AH2) playlist so that I am promoted at the end of an episode to go to the next episode. I am using a video plugin for my content so it isn't local and the plugin I am using does not support the next up plugin. This might be something you are working on or something that already exists or something that isn't possible, but I just wanted to find out.

Thanks thanks again for both these projects (TMDBH and AH2) I am really enjoying using them.

jurialmunkey commented 2 years ago

In AH2 the "playlist" for episodes is faked if the actual playlist is empty. It is just the season folder in TMDbH for that particular episode. Since it isn't actually a playlist, it won't work with up next.

HOWEVER, tmdbh does support a player param to auto make REAL playlists for tvshows on playback (which should then work with up next correctly). You can add the option to a player via the player configuration dialog in TMDbH settings (or see the wiki for details about writing your own player files).

Note that the make playlist player parameter will only work for plugins which correctly use setresolvedurl. If the plugin use xbmc.player hacks then you might have unexpected results (many 3rd party plugins use hacks because they never go through official code review). It's still worth trying even if the plugin doesn't resolve correctly because it may still work - I just won't be able to solve any issues that arise as a result of plugins using hacks that they aren't meant to.

IG2022 commented 2 years ago

In AH2 the "playlist" for episodes is faked if the actual playlist is empty. It is just the season folder in TMDbH for that particular episode. Since it isn't actually a playlist, it won't work with up next.

HOWEVER, tmdbh does support a player param to auto make REAL playlists for tvshows on playback (which should then work with up next correctly). You can add the option to a player via the player configuration dialog in TMDbH settings (or see the wiki for details about writing your own player files).

Note that the make playlist player parameter will only work for plugins which correctly use setresolvedurl. If the plugin use xbmc.player hacks then you might have unexpected results (many 3rd party plugins use hacks because they never go through official code review). It's still worth trying even if the plugin doesn't resolve correctly because it may still work - I just won't be able to solve any issues that arise as a result of plugins using hacks that they aren't meant to.

Thanks for information, I'm not sure if the plugin I use is using hacks or not but ill give it a try and see if it works. I did try before by setting make playlist under the plugin player I use to true and I was not getting the nextup pop up so it's quite possible it is using hacks. Anyway thanks for you explanation I really appreciate it!

jurialmunkey commented 2 years ago

Yeah it can't hurt to try.

The way you can check is after starting playback, go back to a normal view and from the side menu you can get player controls. There's a playlist button there which will take you to the playing queue - so you can see there if the playlist was made.

The problem with plugins assigning the playable url directly to xbmc.player is that it restarts the queue so the playlist is lost - plugins that do things that way need to manage their own playlist creation in that case because there's no way to do it from the kodi side if they override playback functions.

IG2022 commented 2 years ago

Yeah it can't hurt to try.

The way you can check is after starting playback, go back to a normal view and from the side menu you can get player controls. There's a playlist button there which will take you to the playing queue - so you can see there if the playlist was made.

The problem with plugins assigning the playable url directly to xbmc.player is that it restarts the queue so the playlist is lost - plugins that do things that way need to manage their own playlist creation in that case because there's no way to do it from the kodi side if they override playback functions.

Okay I've done this and I see no playlist that has been made so it looks like the plugin I'm using is not using setresolvedurl correctly. Bummer. Thanks again though at least now I have an idea why it isn't working.

jurialmunkey commented 2 years ago

I looked into things further and I found an extra functionality of Up Next that I wasn't really aware of: https://github.com/im85288/service.upnext/wiki/Integration

That actually looks quite promising. If I'm reading it correctly, theoretically I should be able to send the TMDbH plugin:// url for the next episode directly to Up Next. That would then give a way to get Up Next working with player addons that aren't compatible with the make_playlist function.

It won't give a proper playlist queue that can be skipped manually. However, it should at least allow for a way to get the Up Next addon displaying at the end of the episode.

I'm going to mess around with it a bit on the weekend and see if I can get something working because that would be an amazing feature if I can.

IG2022 commented 2 years ago

I looked into things further and I found an extra functionality of Up Next that I wasn't really aware of: https://github.com/im85288/service.upnext/wiki/Integration

That actually looks quite promising. If I'm reading it correctly, theoretically I should be able to send the TMDbH plugin:// url for the next episode directly to Up Next. That would then give a way to get Up Next working with player addons that aren't compatible with the make_playlist function.

It won't give a proper playlist queue that can be skipped manually. However, it should at least allow for a way to get the Up Next addon displaying at the end of the episode.

I'm going to mess around with it a bit on the weekend and see if I can get something working because that would be an amazing feature if I can.

This would be fantastic! Thanks for doing Abit more research on this. If this could be implemented it would help alot of plugins that don't currently support the upnext plugin. Let me know if you are able to get it working and if you need me to test.

JacopoV commented 2 years ago

Just commenting in here as 👍 on this one. I randomly discovered last night the next episodes opening up while hovering on the stop button, and found it really really handy and neat!

And thought immediately about a popup in the top showing the thumb of the next episode and being able to select and proceed, as Up Next.

Having it really embedded and fitting AH2 skin would be amazing 🥇

jurialmunkey commented 2 years ago

@IG2022 - Could you test v4.10.12? I'm pretty sure I've got upnext integration working correctly https://github.com/jurialmunkey/plugin.video.themoviedb.helper/releases/tag/v4.10.12

Adds an additional option for make_playlist to set as upnext. Setting "make_playlist": "upnext" instead of true will send a next episode signal to UpNext add-on instead of making a full playlist. You can also change this setting via the configure players GUI in TMDbH settings.

I've only tested with setResolvedURL based addons (and it worked correctly). However, I think it should also work with types of addons since the signal is sent after playback starts.

JacopoV commented 2 years ago

@jurialmunkey just a question regarding this topic.

Is there a way from TMDBHelper to automatically build a temporary playlist that doesn't exist in Kodi and feed Up Next, regardless if it's local content or not ?

Just thinking the situation like :

The user is watching episode 1 of a tv show. TMDHelper has all the info regarding that. At that point build the playlist for the next (or all) episodes , still driven by data from TMDB. In that case feed Up Next.

In AH2 when hovering on the stop button, the popup showing up has all the episodes, thumbs etc. So then, creating on start the playlist.

Is it something that can be done on your end, or is not possible at all with Kodi as code/structure/logic ?

Many thanks! I hope i made myself clear enough to be understood what i mean :)

jurialmunkey commented 2 years ago

@JacopoV

You are confusing two completely different things.

  1. UpNext is an addon which displays a Netflix style "Continue Watching" prompt at the end of the episode -- support for that addon is what is being discussed in this issue.
  2. Stop/Next in AH2 button has nothing to do with the UpNext addon and nothing to do with the feature in this issue.

The stop/next button in AH2 is simply another widget which displays either: (1) the current playlist queue (if available); else (2) the season from the library (if show in library); else (3) TMDbHelper's season folder for that tvshow's currently playing episode.

Could you please describe what you are trying to achieve rather than what you think the solution is. You're creating a classic XY problem and I have no clue what you are trying to describe.

IG2022 commented 2 years ago

@IG2022 - Could you test v4.10.12? I'm pretty sure I've got upnext integration working correctly https://github.com/jurialmunkey/plugin.video.themoviedb.helper/releases/tag/v4.10.12

Adds an additional option for make_playlist to set as upnext. Setting "make_playlist": "upnext" instead of true will send a next episode signal to UpNext add-on instead of making a full playlist. You can also change this setting via the configure players GUI in TMDbH settings.

I've only tested with setResolvedURL based addons (and it worked correctly). However, I think it should also work with types of addons since the signal is sent after playback starts.

Hey thanks for working on this I appreciate it! It doesn't seem to be working when I just tried it.. I set the option for make playlist to "upnext only" and I did not get the notification. Something strange did happen though, when I navigated to the next episode in the "playlist" within the video player after the next episode started playing I saw the notification for a split second then it went away.

Not sure how helpful that is but here is my log as well in case you see something in there.

https://paste.kodi.tv/dibiyobuwe

JacopoV commented 2 years ago

@jurialmunkey maybe not confusing but more likely i haven't explained correctly. But i do apologise nonetheless.

From what i see, everything works great with local files (using 4.10.13 with the recent changes and set to "Up next" ,i do see the popup). If do use another addon (with player configured) either doesn't show up or, if it does, it says that doesn't have another item in the playlist ( which is indeed correct by checking from the OSD in the playlist view). So the problem in that case is not (and never been) on your side, but it's on the addon which doesn't support Up Next (and never will because outdated and abandoned).

I brought up AH2 stop button ( i do know and understand the difference as you explained) simply because if i click the next episode from there (even from the addon, which again doesn't support Up Next), Kodi proceed by exiting the player, and loading the next episode and start playing. So i just wondered if there was any chance/way to bind this very same behaviour into Up Next, even tho there's no item in the list.

Again, i do apologise for the confusion or lack of clarity in the previous message.

jurialmunkey commented 2 years ago

@JacopoV that's literally what this new player setting does - it sends the next episode path from tmdbh to the upnext addon.

After playback starts, if the make playlist setting for that player is set to upnext then TMDbH will retrieve the next episode and send its callback plugin url to upnext.

As far as I can tell, tmdbh is doing everything correctly as I tested with several slyguy plugins which use the proper setresolvedurl method which kodi expects.

The problem with a lot of these 3rd party plugins is that they use player hacks which break and override basic kodi functions.

The only thing from tmdbh side which possibly could be tweaked is the time out. Currently the time out to wait for playback is 30 seconds, so if the end plugin takes longer than that to start playback then it's possible that the signal gets sent before playback starts.

JacopoV commented 2 years ago

@jurialmunkey thanks for the long and detailed explanation! 🙏 I ll try to see what I can do on my end in the case of the old addon or empty Playlist!

Again thanks again and apologies i took too much of your time..! 👌

IG2022 commented 2 years ago

I'll close this I think the plugin I'm using is using hacks and that's why it isn't working for me it has nothing to do with tmdb helper. Thanks for making the effort to sort this out for me.

burke1980 commented 1 year ago

I recently came across this thread and have begun using the nextup option. I am using a popular 3rd party addon as my player with tmdbhelper. I'm experiencing:

1) when I choose to "play" for example the 3rd episode of a series. After that episode plays the next episode played is the first episode in the season. No matter if it is marked as watch or not. Then each episode in the order.

2) when I choose "play from here" of the same 3rd episode. After the episode plays the next episode played is the third episode again and then each episode in the order.

I sometimes prefer to binge watch shows. What I would like to know is there a way or maybe just a setting that would allow me to select and episode and have it continue to play the next episode in order of the series?

I hope I was able to explain this clearly and thank you in advance.

MoojMidge commented 1 year ago

This was one of the use cases I had for #965. The idea was to call TMDb Helper from UpNext to get the next episode from whatever plugin was playing a video, if there was a player setup for it.

If a plugin and player properly support building a playlist then it is created and used the first time that TMDb Helper is called by UpNext, otherwise UpNext will just query the plugin via the TMDb Helper player after every episode.

burke1980 commented 1 year ago

So is there anyway I can binge watching a show using tmdb helper via a 3rd party addon as my selected player?

MoojMidge commented 1 year ago

It sounds like the 3rd party plugin you are using has a bug with its playlist handling code (just a guess without knowing which plugin you are talking about, or what the code actually is).

When you press play, the existing playlist created by TMDb Helper is used, and it sounds like the plugin is seeing that a playlist is being used, but assuming that playback should always begin from the first entry of the playlist.

When you press play from here, a new playlist is created from the original playlist, starting from the selected episode, and then the same bug occurs with the plugin assuming that a playlist should be played from the first item, rather than from after the just played item.

This should be easy to fix (again without knowing anything about the code), but if not, then these type of issues can be worked around with the proposed changes to TMDb Helper and UpNext.

I have no way to actually test this myself, but if the changes are accepted then you can test it out for yourself.

burke1980 commented 1 year ago

I apologize for my ignorance. I am have been primarily using The Crew addon, I just recently tried scrubsv2 and also experiencing similar issues. I am not sure if this is because the addon does not allow or if setting I have incorrect. I am currently not using any premium services like RD. I prefer not to use library integration . If you could help guide what the best way if any that I could accomplish being able to start an episode and have it continue to play the next episode in the succession. It would be greatly appreciated. Thank you for all your help thus far

MoojMidge commented 1 year ago

I don't use those plugins so can't provide anything more than idle speculation. But once the changes in TMDb Helper and UpNext are available for use I can let you know and you can test whether it works for yourself.