MoojMidge / service.upnext

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

Configuration Settings #33

Open vella9 opened 1 month ago

vella9 commented 1 month ago

I am new to this addon and have never used it before, but I cannot get it to work. I was looking for a guide/wiki but couldn't find what settings I need to configure. I am using a custom skin on Kodi. Can someone please guide me? I just installed the latest version, and it is not showing the popup at all. I tried multiple episodes.

What settings should I configure for this to work please?

Sorry @MoojMidge if this is not the place for such question, as this is not an issue per se. I couldn't find a better place so ask this however.

MoojMidge commented 1 month ago

It should work without needing to configure anything.

If it is not working, it is probably because you are trying to use it with a video plugin that doesn't play nice with other addons.

If you have an issue the first step is to provide a log. Make sure to enable debug logging in the UpNext addon settings (Settings > Expert > Log Level, set to Debug).

vella9 commented 1 month ago

Log attached. Thank you for looking into this!

MoojMidge commented 1 month ago

The log snippet misses a lot of important information, but I'm not going to spend too much time looking into this as you are using one of these:

If it is not working, it is probably because you are trying to use it with a video plugin that doesn't play nice with other addons.

It could be due to a misconfigured player, but if the player only works without

"is_resolvable": "true"

then that is almost always a plugin issue. It's usually not actually too difficult to fix in the plugin, but that's something to raise with the plugin author

vella9 commented 1 month ago

"is_resolvable": "true"

This is how the player is configured.

Then it is almost certain to be a plugin issue.

Thank you for your time.

MoojMidge commented 1 month ago

This is how the player is configured.

To clarify, does the player actually have "is_resolvable": "true" in it? If it does, then it should work, but that is not what your log shows.

vella9 commented 1 month ago

Yes, I have "is_resolvable": "true" configured on the player in tmdbh

vella9 commented 1 month ago

I managed to get the popup to show, by changing "make_playlist": from "no" to "upnext"

However now, when popup is displayed and I press the play button, nothing happens 🙁

MoojMidge commented 1 month ago

It's not going to work.

Even though you have "is_resolvable": "true" set in the player, the plugin you are using does not actually do this. A plugin url is not being opened, it is opening the video stream url directly.

If the plugin doesn't do what it should be doing to play a video, there is not much other plugins can do to integrate with it in a standard way.

MoojMidge commented 1 month ago

Saw your linked issue. Specific plugin integration is not required to get this to work, that is just an optional method for more seamless integration.

The bare minimum that is required is to use the xbmcplugin.setResolvedUrl callback function, rather than using xbmc.Player().play directly i.e. the "proper" way for plugins to play something in Kodi, by linking the user/script/plugin/external action that triggers the playback to the item in the Kodi GUI that was interacted with.

Without this, or without the specific plugin integration you linked to in the Wiki, nothing is possible

vella9 commented 1 month ago

First of all thank you very much for getting out of your way and taking the initiative to explain this for me. I really appreciate.

The bare minimum that is required is to use the xbmcplugin.setResolvedUrl callback function, rather than using xbmc.Player().play directly

I would really like this to work. However, I believe that this is still something that needs to be done from the plugin developer, and as you might already know, integration is out of question. I do not think that I can simply 'find & replace' xbmc.Player().play with xbmcplugin.setResolvedUrl. Unfortunately, I do not have the knowledge. I would really appreciate any assistance here.

Thank you

MoojMidge commented 1 month ago

I do not think that I can simply 'find & replace' xbmc.Player().play with xbmcplugin.setResolvedUrl

Tbh it is often pretty much is, although the parameters for each method are different with the former accepting a stream url, and the latter requiring a plugin handle and listitem with the path of the stream url.

It is not to say that this will work without creating other issues, but it is an extremely simple change to make depending on the architecture of the plugin.

However, I believe that this is still something that needs to be done from the plugin developer

Yep, but also pretty easy to do yourself if you wanted to try.

I would really appreciate any assistance here.

Can't point you in the right direction unfortunately. Don't use the plugin and only the zipped packages are on Github. Too much effort required to go looking.

vella9 commented 1 month ago

Hi @MoojMidge, thanks for your reply once again,

I searched the whole addon and I only found the below that relates to xbmc.Player

player, xbmc_player, numeric_input, xbmc_monitor, translatePath = xbmc.Player(), xbmc.Player, 1, xbmc.Monitor, xbmcvfs.translatePath

If the above is where the change is required to happen, will you be able to provide a sample code that I can follow, maybe?

Thank you for your time

MoojMidge commented 1 month ago

Not really sure this will be a productive exercise... but do you see anything like the following anywhere?

player.play(...)

xbmc_player().play(...)

vella9 commented 1 month ago

I found just this entry player.play(window_player_url)

Thank you for your time

MoojMidge commented 1 month ago

Try this, search for any instance of .play(.

This could be something like player.play(window_player_url) or blah_blah_blah.play(url, list_item) or something else entirely (all just guesswork).

Wherever you see a line like that replace it with the following, making sure to keep everything indented at the same level as the original code. Will likely break things so make a backup first. Will also likely not work, but curious to see if it does.

def _play(item=None, listitem=None, *_args, **_kwargs):
    import sys
    import xbmc
    import xbmcplugin
    import xbmcgui

    xbmc.log('Attempting use of xbmcplugin.setResolvedUrl', xbmc.LOGINFO)

    try:
        handle = int(sys.argv[1])
    except (IndexError, TypeError, ValueError):
        xbmc.log('Failed - not a plugin invocation', xbmc.LOGWARNING)
        raise RuntimeError

    if handle == -1:
        xbmc.log('Failed - invalid handle', xbmc.LOGWARNING)
        raise RuntimeError

    if not item:
        xbmc.log('Failed - no item to play', xbmc.LOGWARNING)
        raise RuntimeError

    if not listitem:
        listitem = xbmcgui.ListItem(path=item, offscreen=True)

    xbmc.log('xbmcplugin.setResolvedUrl called', xbmc.LOGINFO)
    xbmcplugin.setResolvedUrl(handle, True, listitem)

try:
    _play(item, listitem)
except RuntimeError:
    blah_blah_blah.play(item, listitem)  # original code here
vella9 commented 1 month ago

Hi @MoojMidge, I found two instances in total.

player.play(window_player_url) in resources\lib\windows\base_window.py self.play(self.url, self.make_listing()) in resources\lib\modules\player.py

I removed this line of code from each file and added the code you provided. This is the [edited base_window.py]() lines 124-156 This is the [edited player.py]() lines 29-63 This is the kodi [log]()

I also have the following configured on TMDBHelper Player;

fl player

The behavior is the same, popup is shown, but when I press play nothing happens. If I set make_playlist:false (default setting) popup does not show.

Thank you for your time and patience once again.

MoojMidge commented 1 month ago

This is the edited base_window.py lines 124-156

You should probably revert this to the original. Looks like this is for trailer playback.

This is the edited player.py lines 29-63

That looks like it worked. The problem now is with UpNext I think. Everything appears to work but it fails to load the correct item from the playlist. Will have to have a look.

If I set make_playlist:false (default setting) popup does not show.

Can you get a log of this?

Edit: Didn't notice this before, but the log is not indicating you are using any of the internal player cores. Also doesn't identify that the internal playlist is active. Neither of which should be possible.

This is the reason it fails to play the next episode after you edited those files, but it was the same in your original log too.

Will need a full debug log, with Announce logging enabled in the component logging too, to understand why that is happening.

vella9 commented 4 weeks ago

Hi @MoojMidge, log attached. Please note that player has make_playlist:false configured.

MoojMidge commented 4 weeks ago

Thanks. Looks like two issues:

  1. Regression from Kodi 19 onwards where Kodi is incorrectly determining the media type of a playing item when adding it to its internal playlist.
  2. Issue with UpNext where I didn't account for the fact that you are starting playback directly from TMDbHelper, rather than the actual video plugin that ends up being used.

The second issue will be fixed. Not sure how best to handle the first issue.

vella9 commented 4 weeks ago

The second issue will be fixed.

Thank you for this @MoojMidge.

  1. Regression from Kodi 19 onwards where Kodi is incorrectly determining the media type of a playing item when adding it to its internal playlist.

So even though this works when using local library items, it won't work when using a video addon? Can I raise this issue elsewhere? maybe here? if not already mentioned.

Thanks for your time

MoojMidge commented 4 weeks ago

Can I raise this issue elsewhere? maybe here? if not already mentioned.

You won't get anywhere with that, given the purpose of the plugin you are using.

Whether or not it is a regression is also not certain. Can you try and play something directly using a video plugin, rather than through TMDbHelper, and get a log of that?

So even though this works when using local library items, it won't work when using a video addon?

Well it works with a whole bunch of other plugins just fine without needing to do anything, so the question is what is different for this one.

One of the differences was not using setResolvedUrl, but that was a trivial change.

The implication of not using the internal video playlist also extends much further than just getting UpNext to work. I would imagine normal Kodi playlist functionality would be partially broken as well (i.e. you wouldn't be able to play something then queue up another video, or even just view/modify/re-arrange/shuffle/clear the playlist)

For UpNext, it should be possible to detect this and potentially workaround it, but I have no way of testing it.

vella9 commented 4 weeks ago

Hi @MoojMidge, I will get a log later on today. What I wanted to mention is that in the Video OSD of the skin that I am using, there is a button that acts as an 'Up Next' button. When this is in focus, while an episode is playing or once it has finished, it displays the Up Next pop up with the next available episode and all. If pressed, this will start the next episode successfully. I do not know if this might be of assistance, or this is something else entirely.

vella9 commented 4 weeks ago

Can you try and play something directly using a video plugin, rather than through TMDbHelper, and get a log of that?

Hi @MoojMidge, kindly find log attached. This time I used the video addon directly to play an episode (I do not think it was used this time but TMDbHelper Player was configured with make_playlist:false)

Up Next popup did not show.

[log]()

MoojMidge commented 4 weeks ago

Can you test https://github.com/MoojMidge/service.upnext/commit/684738235a7bd54d9500cc0cbb00c16d8ea731fe

It probably still won't play anything, but you should get the popup now, regardless of whether you are playing directly, or through TMDbHelper, and regardless of the make_playlistplayer configuration parameter.

BTW I appreciate the detailed testing you are doing.

vella9 commented 4 weeks ago

but you should get the popup now

Sorry @MoojMidge, but I replaced the resources/lib/state.py file but still the popup did not show. I played an episode via TMDbHelper player.

Hi MoojMidge, I will get a log later on today. What I wanted to mention is that in the Video OSD of the skin that I am using, there is a button that acts as an 'Up Next' button. When this is in focus, while an episode is playing or once it has finished, it displays the Up Next pop up with the next available episode and all. If pressed, this will start the next episode successfully. I do not know if this might be of assistance, or this is something else entirely.

This is the edited player.py lines 29-63

I noticed that the video skin OSD button as mentioned in the above comment is not working with the edited player.py in the video addon. I reverted the player.py to the original code and OSD button works fine. Could this video skin OSD button be of assistance is someway? since when pressing this video skin OSD button, the next episode plays fine using the same video addon and all.

BTW I appreciate the detailed testing you are doing

Thank you! I am doing what I can, to the best of my knowledge. I would like to make this work (hopefully) 🤞

EDITED: attaching a [log]() maybe this can be of assistance. I used the video OSD button of the skin here to go to the next episode and this works fine. Upon hovering over the button, the Up Next pop up is displayed (see screenshot below) and when pressed, the next episode starts using the same video addon.

This also works fine without the Up Next addon installed. I am referring to the below button highlighted in red in the below screenshot;

image

MoojMidge commented 3 weeks ago

Skins and plugins have different ways that they can play videos and get information on the playing video.

Plugins can use most of the same methods that skins can, but it is slow and cumbersome to do so.

Getting the information is also just one part of the problem, manipulating or changing the playback is the next issue.

By default UpNext uses TMDbHelper to create a playlist of all the next videos in a show for plugins that don't integrate with it directly, because the information for all the episodes is available through TMDbHelper, and creating the playlist means that it doesn't need to keep fetching the next episode information for every episode that is played.

Unfortunately TMDbHelper baulks at the same issue with the video not being loaded into the video playlist, so everything that UpNext expects to happen all works, except for the loading of the next videos into the internal video playlist. Because those videos never get loaded, UpNext thinks there is nothing coming next, and so no popup is shown.

Give https://github.com/MoojMidge/service.upnext/archive/refs/heads/master.zip a go. It attempts to work around the problem as best as I can. May also work with the unmodified player.py.

vella9 commented 3 weeks ago

Give https://github.com/MoojMidge/service.upnext/archive/refs/heads/master.zip a go. It attempts to work around the problem as best as I can. May also work with the unmodified player.py.

Hi @MoojMidge, sorry again, but I installed the above and I tried both versions of player.py however pop up is persisting and still not showing unless I am doing something wrong.

Are there any settings at all in Up Next/AF/TMDbH/Players/video addon/Kodi that I need to enable or make sure that they are configured correctly?

Plugins can use most of the same methods that skins can, but it is slow and cumbersome to do so.

I do not know the technicalities, but I thought that since is it working perfectly using the video skin OSD button, maybe the same behavior could be somehow replicated for Up Next. Guess I was wrong.

MoojMidge commented 3 weeks ago

Can you get a new log? The last few logs show it working until the point where it tries to load the playlist.

The additional workaround added was to load a single next episode only, if loading the playlist failed. It tries to do so in a way that would also put the next video in the video playlist, so that subsequent episodes would would work without needing the workaround, but that is obviously not working.

The skin is successful in doing the same thing, except it doesn't try to fix the playlist and just plays the next video. That is the last option, but I would like to try and identify what is happening.

vella9 commented 3 weeks ago

Can you get a new log?

Sure, log attached.

MoojMidge commented 3 weeks ago

I am using a video plugin that normally works and trying to break it in various ways to replicate what is in your log, but can't quite replicate the exact same thing.

A couple of things that may cause problems:

  1. Playing directly through TMDbHelper and without a default player set. Do you have one set for episodes? TMDbHelper > Settings > Players > Default player for episodes or selecting a default player for the specific show through the TMDbHelper context menu.
  2. Using the PlayMedia inbuilt function. Try enabling TMDbHelper > Settings > Expert > Reroute PlayMedia to xbmc.Player()

If either of those don't improve things I have added a new setting in UpNext > Settings > Expert > Enable TMDbHelper integration > Enable full integration. Try disabling this and seeing if it helps.

https://github.com/MoojMidge/service.upnext/archive/refs/heads/master.zip

vella9 commented 3 weeks ago
  1. Playing directly through TMDbHelper and without a default player set. Do you have one set for episodes? TMDbHelper > Settings > Players > Default player for episodes or selecting a default player for the specific show through the TMDbHelper context menu.

Yes, I have a default player for episodes configured as per screenshot. This is the 'auto play' player.

image

2. Using the PlayMedia inbuilt function. Try enabling TMDbHelper > Settings > Expert > Reroute PlayMedia to xbmc.Player()

This was already enabled.

If either of those don't improve things I have added a new setting in UpNext > Settings > Expert > Enable TMDbHelper integration > Enable full integration. Try disabling this and seeing if it helps.

https://github.com/MoojMidge/service.upnext/archive/refs/heads/master.zip

I updated to the above version and disabled Enable full integration and can confirm that the Up Next pop up window finally did pop this time as per screenshot.

Capture

Thank you very mush for this @MoojMidge. I really appreciate.

What I noticed is that;

  1. If you compare the above screenshot with the below below (popup windows) you can notice that the thumbnail, SxEx, Episode name, year and rating did not populate correctly.

image

  1. When the play button on the Up Next pop up window is pressed, the next episodes loads, however I need to select the plugin from the first context menu and also the player from another context menu as you can see in the below screenshots. Even though this is the same default player configured in TMDbHelper.

image

image

Other than the above, the next episode plays successfully.

Thank you for your work, I believe that we are getting near :)

Thank you!!

MoojMidge commented 3 weeks ago

If you compare the above screenshot with the below below (popup windows) you can notice that the thumbnail, SxEx, Episode name, year and rating did not populate correctly.

Yeah that's the reason why full integration was previously not optional. Pretty sure the rest of the problems can be figured out so this is not required, will just take some time.

2. When the play button on the Up Next pop up window is pressed, the next episodes loads, however I need to select the plugin from the first context menu and also the player from another context menu as you can see in the below screenshots. Even though this is the same default player configured in TMDbHelper.

I don't consider this previously, but it can also explain why everything appears to work in the log, prior to full integration being made optional, except for the very last step.

Will need to look into the TMDbHelper player code to see if there is an error with how I am calling it when the player is not known. For some reason the default player selection is not being used, but this does not happen when the player methods are used from within TMDbHelper itself.

Can you confirm whether it works if playing directly from the video plugin and with Settings > Expert > Enable TMDbHelper integration > Enable full integration enabled?

vella9 commented 3 weeks ago

Yeah that's the reason why full integration was previously not optional. Pretty sure the rest of the problems can be figured out so this is not required, will just take some time.

Understood.

Can you confirm whether it works if playing directly from the video plugin and with Settings > Expert > Enable TMDbHelper integration > Enable full integration enabled?

With Enable full integration enabled, and playing an episode from the video plugin itself, the Up Next pop up did not show.

Thank you for your time as always @MoojMidge.

If you require any logs, let me know.

Peter3344 commented 2 weeks ago

Thank you both @MoojMidge @vella9

You are doing great job.looking for more fix for this issue 🙏🙏

Peter3344 commented 2 weeks ago

I had a issue after I tried this update and t try to enable customise video length and play a video the osd freeze i can't pause or play

vella9 commented 2 weeks ago

Thank you both @MoojMidge @vella9

You are doing great job.looking for more fix for this issue 🙏🙏

the least I can do @Peter3344.

let me know if you want to continue testing on this @MoojMidge

titelheld commented 2 weeks ago

@vella9 thank you for doing such extensive testing on this.

I was wondering if you could share the settings you used that eventually got the video to play from the popup and if you used the modified player.py.

It's a bit hard rigidities out from the long conversation:S

MoojMidge commented 2 weeks ago

let me know if you want to continue testing on this @MoojMidge

I'm reasonably confident the issues can be resolved but it will take a while because I can't test it myself and I'm a bit busy with other things at the moment.

When I have something more to test I'll let you know in this issue

vella9 commented 2 weeks ago

I'm reasonably confident the issues can be resolved but it will take a while because I can't test it myself and I'm a bit busy with other things at the moment.

When I have something more to test I'll let you know in this issue

anytime @MoojMidge, let me know.

I was wondering if you could share the settings you used that eventually got the video to play from the popup and if you used the modified player.py.

Hi @titelheld, up till now, I only turned off Settings > Expert > Enable TMDbHelper integration > Enable full integration after installing UpNext from the location provided by MoojMidge. As to the player.py, no need to edit this, you can use the default.