MoojMidge / service.upnext

GNU General Public License v2.0
19 stars 5 forks source link

[New idea] Pause after "Watch now" #9

Closed notoco closed 9 months ago

notoco commented 1 year ago

Some plugins look for the next episode for quite a long time after selecting "Play next" - sometimes the episode we were watching ends and the Kodi home page appears. Is it possible to add a "pause" after selecting "Play next...|

MoojMidge commented 1 year ago

It should be possible to do, but it might also prevent proper playback of the next episode. Will need a log to assist.

Can you change the log level in the Expert plugin settings to Debug, then use UpNext to play a next episode where the first episode ends and you end up back at the home screen prior to playback starting of the next episode?

MoojMidge commented 1 year ago

I don't think this will be possible to do without adding a lot of complexity to the playback sequence, which is already not very robust.

If the playback delay causes issues, send through a log and I can have a look, otherwise not much can be done.

MoojMidge commented 11 months ago

@notoco, @psp2111-ADSLGATE, Added a new option to pause playback until the next video starts.

You can download from master and check if the new option works: UpNext > Settings > Behaviour > Pause after "Watch now"

psp2111-ADSLGATE commented 11 months ago

@MoojMidge Ok, I did some testing and most of the time does not work properly.

I tested with two addons, Seren and Umbrella.

For Umbrella: the episode paused and start playing agian right after the TMDbH player or the scraper initiated.

For Seren: it is working properly when the pre-emptive scraping is working, but for the next episode when pre-emptive scraping is not working "Seren BUG", and Seren has to initiate its scraper same Umbrella behaviour happened.

idk but I think it need few seconds delay before pausing or change the "pause" with "stop" instead?!

MoojMidge commented 11 months ago

The problem is with how the player files and the plugins themselves work. I tested it with local files and plugins that use xbmc.setResolvedUrl (there is a reason why this is the "proper" way for plugins to play a video), and it works fine.

If a plugin directly controls the player, then it is a futile exercise for UpNext to try to do anything here, the plugin will either override what UpNext does or the playback sequence will otherwise get interrupted.

Pause or stop, won't change anything, either the stop will be overridden or it will mess up the playback sequence. Delaying things won't help, it will either make no difference or will pause/stop the new video that is taking time to start.

If you provide a debug log I can see whether anything can be done to make the new option work better but I doubt it will be successful.

psp2111-ADSLGATE commented 11 months ago

here a logs for the players behavior as stated in my previous comment seren.log umbrella.log

The problem is with how the player files and the plugins themselves work. I tested it with local files and plugins that use xbmc.setResolvedUrl (there is a reason why this is the "proper" way for plugins to play a video), and it works fine.

OK I quickly configured the players with TMDbH and forced them to use xbmc.setResolvedUrl, and did some testing and you are right the "pause" function worked as intended, BUT I faced an error with seren after few plays. seren+setResolvedUrl.log behavior: after 1st and 2nd UpNext episode working fine BUT after the 3rd episode I get a Seren error + Playlist: cant find the next item to play.

Umbrella+setResolvedUrl.log behavior: quick testing every thing seems to be working fine.

MoojMidge commented 11 months ago

That is an error in Seren, UpNext and the TMDB Helper integration seem to be working fine.

You can try and fix the error in Seren. Change: https://github.com/nixgates/plugin.video.seren/blob/0d60385af1201e345653e785e44ebb0a627c2174/resources/lib/modules/smartPlay.py#L333-L340

From:

action_args = [
            g.legacy_action_args_converter(g.legacy_params_converter(dict(parse.parse_qsl(i.split("?")[-1]))))[
                "action_args"
            ]
            for i in playlist_uris
        ]

        show_ids = {tools.deconstruct_action_args(i).get('trakt_show_id') for i in action_args}

To:

action_args = [
            g.legacy_action_args_converter(g.legacy_params_converter(dict(parse.parse_qsl(i.split("?")[-1])))).get(
                "action_args"
            )
            for i in playlist_uris
        ]

        show_ids = {tools.deconstruct_action_args(i).get('trakt_show_id') for i in action_args if i}
notoco commented 11 months ago

We have already changed the reaction to upnext in our add-on, so it's hard for me to check right now. In addition, it will start searching for the next source, when it is playing, we just pause it.

psp2111-ADSLGATE commented 11 months ago

That is an error in Seren, UpNext and the TMDB Helper integration seem to be working fine.

You can try and fix the error in Seren. Change: https://github.com/nixgates/plugin.video.seren/blob/0d60385af1201e345653e785e44ebb0a627c2174/resources/lib/modules/smartPlay.py#L333-L340

That fix it and in top of that it fixed the Pre-emptive scraping bug and now working all the time. @MoojMidge Thank you so much for you time and knowledge.

MoojMidge commented 11 months ago

@psp2111-ADSLGATE - no problem

@notoco - the new option should hopefully work fine, if not and if you have already made changes in the video plugin to do the same, then the option can always be disabled in UpNext

notoco commented 9 months ago

Sorry I'm a little late. We changed the operation of our plugin and our previous trick stopped working. However, your solution works and saved us a lot of work. I'm closing