MoojMidge / service.upnext

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

Configuration Settings #33

Closed vella9 closed 2 months ago

vella9 commented 5 months 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 5 months 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 5 months ago

Log attached. Thank you for looking into this!

MoojMidge commented 5 months 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 5 months 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 5 months 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 5 months ago

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

vella9 commented 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months ago

I found just this entry player.play(window_player_url)

Thank you for your time

MoojMidge commented 5 months 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 5 months 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 5 months 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 5 months ago

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

MoojMidge commented 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months ago

Can you get a new log?

Sure, log attached.

MoojMidge commented 5 months 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 5 months 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 5 months 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 5 months 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 4 months ago

Thank you both @MoojMidge @vella9

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

Peter3344 commented 4 months 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 4 months 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 4 months 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 4 months 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 4 months 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.

titelheld commented 3 months ago

@MoojMidge @vella9 I've got the thumbnail to show up by leaving "enable full integration" enabled and "exact match only" turned off.

But when selecting play it still shows the player selection window. Maybe @jurialmunkey can help in finding out how to properly call the default player set in themoviedb helper.

Having high hopes that this will eventually work.

MoojMidge commented 3 months ago

I've got the thumbnail to show up by leaving "enable full integration" enabled and "exact match only" turned off.

But when selecting play it still shows the player selection window.

Yes, thats what will happen when you set it up like that.

Having high hopes that this will eventually work.

I'll have some time to look at it next week.

titelheld commented 3 months ago

@titelheld I tried your way but I need to ask does it show the episode thumbnail or not Because it show the thumbnail of the tvshow not the episode for me

It displays the tv show season thumbnail

I was also hoping to see the episode thumbnail

Jcloak commented 3 months ago

I just stumbled upon this thread because I was experiencing the same thing. This might not be the ideal permanent solution, but I changed the query in the tmdb_helper.py generate_tmdbhelper_play_url to this and it automatically uses the default player without prompting to select the player:

query = urlencode({
        'info': 'play',
        'tmdb_type': 'episode',
        'tmdb_id': tmdb_id,
        'query': title,
        'season': season,
        'episode': episode,
        'ignore_default': False
})
titelheld commented 3 months ago

Just got home and have it a try it works indeed. Great find!

Now if we could get the episode thumbnail instead of the season thumbnail it would be perfect.

image

Edit: I stopped an episode with the X and the video file stopped playing immediately (not sure if that's intended, my expectation was that only the upnext widow would disappear). Also after doing this Kodi crashed when returning back to the GUI around the time the timer would have timed out. Not sure if that is related to upnext. Usually I do not experience crashes.

vella9 commented 3 months ago

I stopped an episode with the X and the video file stopped playing immediately (not sure if that's intended, my expectation was that only the upnext widow would disappear)

only the upnext window should have disappeared in this case and the crash might be related to upnext.

I believe that once @MoojMidge allocates some time on this, once he is available, it will be sorted out.

Peter3344 commented 3 months ago

@Jcloak nice work I tested it's working but when you choose a default player for a season or tvshow the player dialogue pop up

MoojMidge commented 3 months ago

I stopped an episode with the X and the video file stopped playing immediately (not sure if that's intended, my expectation was that only the upnext widow would disappear).

The "X" can be configured as either a stop button or a close button, and by default it is actually a stop button, so yes that is intended. If you only want to close the window you can hit escape on a keyboard or back on a remote, or disable Settings > Appearance > Show a "Stop" button instead of a "Close" button

Also after doing this Kodi crashed when returning back to the GUI around the time the timer would have timed out. Not sure if that is related to upnext. Usually I do not experience crashes.

Will need a log to see if it is related.

@vella9 - I have lost track of where things were since I last looked at this. Have made some changes, that may or may not help. When you get a chance can you test using https://github.com/MoojMidge/service.upnext/archive/refs/heads/master.zip and get another log?

Anyone else who wants to test and provide a log too, feel free.

vella9 commented 3 months ago

Hi @MoojMidge, glad that you found some time to continue working on this. Thank you!

I have lost track of where things were since I last looked at this.

So after a lot of testing, I had;

  1. installed a version as you provided and disabled Enable full integration and the popup did show
  2. when pressing the play button, the next episodes loads, however I needed to select the plugin from the first context menu and also the player from the next context menu. then the next episode plays successfully but the issue is that it is not played automatically without the context menus.
  3. the other issue was that in the popup window, thumbnail, SxEx, Episode name, year and rating did not populate correctly.

Below you can find the exact findings I had commented.

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!!

When you get a chance can you test using https://github.com/MoojMidge/service.upnext/archive/refs/heads/master.zip

I did install this, disabled Enable full integration and I had the same results as above.

kodi.log

MoojMidge commented 3 months ago

@vella9 - thanks for that. To confirm, when you have Enable full integration enabled then no popup shows up? Can you get me a log of that as well?

Can you also post the player file that you are using?

@Jcloak - can you post the player file for the default plugin you have selected?

Jcloak commented 3 months ago

@Jcloak - can you post the player file for the default plugin you have selected?

{
    "name": "Fen Light Auto Play",
    "plugin": "plugin.video.fenlight",
    "priority": 500,     
    "is_resolvable" : "true", 
    "play_movie": "plugin://plugin.video.fenlight/?mode=playback.media&media_type=movie&query={name}&year={year}&poster={poster}&title={title}&tmdb_id={id}&autoplay=true",
    "play_episode": "plugin://plugin.video.fenlight/?mode=playback.media&media_type=episode&query={showname}&year={year}&season={season}&episode={episode}&ep_name={title}&tmdb_id={tmdb}&premiered={firstaired}&autoplay=true"
}