Don't use `Player.Open` especially in case of Music Plugins

Issue description:
There’s an ever lasting bug in Kodis core which has yet to be fixed (I’m actually trying to do so myself but am not to familiar with c++ or Kodis core so when and if this gets fixed is very much up in the air).

The actual issue

The issue manifests itself when a music plugin tries to make a infinite playlist.

Following chain of events works for a video plugin but does not for a music one:

  1. RPC Call: Player.Open with '{"file": "plugin://<addon-path to setResolveUrl>"}
  2. Plugin Code: Playlist.Clear()
  3. Plugin Code: Playlist.add(<resolved url>, <item with resolved url>)
  4. Plugin Code: xbmcplugin.setResolvedUrl(<handle>, True, <item with resolved url>)
  5. Plugin Code: Playlist.add(<another item with proper urls etc.>)
  6. Points 4. and 5. start cycling to create an infinite playlist

Expected result (works for video):

  • Player is playing something
  • First playlist entry is the currently playing item (Highlighted as such by kodi)
  • Player can skip to the next item in playlist

Actual result (only for audio):

  • Player is playing something
  • First playlist entry is NOT displayed as being playing
  • Can NOT skip to next item.
    Seems like the player thinks there’s no more items in the playlist

As a dev myself I do understand that this should preferably be fixed in kodi and not be worked around by external clients but as mentioned above, this has been an issue for a long time and I’m not sure if I (without help) can get this fixed.
Initial feedback was that this might not be as easy to fix as I was making it out to be.

The workaround

Instead of using Player.Open with the item-path, doing the following works (e.g. Chorus2 does that)

  1. Playlist.Clear: playlistid 0
  2. Playlist.Insert: playlistid 0, position 0
  3. Player.Open: playlistid 0

This will obviously also work for video (given the correct playlistid) so no need to keep separate code.

I really hope you agree on changing this over :slight_smile:

As you said long lasting Kodi issue :wink: You should ask the Json maintainer, ho well I forget I was banned for saying there’s no one :stuck_out_tongue:

Some addons does work so something can be done at addon level.

Your workaround is applied on some cases where I know for sure the playlist, but as you know Kodi playlist handling is a mess and addons can be audio and/or video and some ever do not announce their type.
It’s impossible to properly handle the correct playlist for each cases and Kodi mixed playlist have even more bugs to rely on only pushing to video playlist and Kodi magic.

The only addons that work are the ones not creating infinite playlists (like I do).
The reason for this is because the way plugin urls are resolved is different when they come from the internal playlist vs. through Player.Open
From a plugin perspective I tried literally everything imaginable to make this work (been about 6 hours now, no kidding) but there’s no way to make it work properly.

My outline workaround should always work no matter the content type so again, please consider changing this.

Edit: https://forum.kodi.tv/showthread.php?tid=315249&pid=2694920#pid2694920

Have you read what I wrote?

You do understand that I need to pass the playlist id for the call? And that addons can be video and/or audio and I have, a lot of the time, no way to know what playlist I should use?

Let’s avoid repeating the Wear/Google+ stuff and your actions please. I have maybe just a little more experience on Kodi core and Json than you may have :wink:

And yes I’m fully aware of that answer since I did gave the same a lot of times earlier on that same forum. (https://forum.kodi.tv/showthread.php?tid=315249&pid=2593814#pid2593814 even just in that same thread a year earlier…)
And I do that for music playlist since I’m able to know the kind of media and use the proper playlist.

Furthermore you can easily do the exact same thing from the addon :wink:
You do know you have access to JSON and can do the call from the addon yourself and it’s even better since you know the playlist type?

I wonder why I try to help Team Kodi on Json part when I was banned for trying to help on Json part, ask the great Martijn he is a master on Kodi core and Json and addons :slight_smile:
Or at least he will be able to tell you who to ask since he banned the only one who cared about that part.

@gdpr since you no more answer I suppose you have not understood that I still helped you here despite the situation as I always did :wink:

  1. You can easily detect when your plugin is started from GUI or from Json by the number of arguments passed
  2. You can call Json yourself to restart your addons in workaround mode
    xbmc.executeJSONRPC('[{"id":0,"jsonrpc":"2.0","method":"Playlist.Clear","params":{"playlistid":XXX}},{"id":1,"jsonrpc":"2.0","method":"Playlist.add","params":{"playlistid":XXX,"item":{"file":"%s"}}},{"id":2,"jsonrpc":"2.0","method":"Player.Open","params":{"playlistid":XXX,"position":0}}]' % TheAddonPath)

Of course no need to say thanks I’m the bad guy since all those years after all :wink:

1 Like

I am at work so time for replies is limited.
Further, I hope you understand that your attitude is quite… stuck up and to be honest, I had to calm myself first because who knows what I would have written otherwise.

Because I’m mainly interested in a solution I am appreciative of any help so thanks.
I did figure out at some point that the handle is valid in case of e.g. Player.Open while it’s not for my listitem (no folder and not playable) and used that to work around prior issues already.
Me figuring this out was about 5 hours worth of frustration already.

I honestly forgot that this would re-open the possibility to call myself.

if valid_handle:
    # Item activated through e.g. Chorus2
    xbmcplugin.setResolvedUrl(HANDLE, False, item)
    xbmc.executebuiltin('RunPlugin({})'.format(
        utils.build_path('play', network, channel, cache=True)))
else:
    # Item activated through Kodi itself
    xbmc.Player().play()

Initial tests show promise although this causes a few more busy dialogs to pop up than there should but ¯_(ツ)_/¯.

Many of my earlier attempts involved me doing an explicite play without telling kodi that - whatever it tried just now - failed (setResolvedUrl(HANDLE, False, item) in this case) causing a crash because two play events (kodi internally and my addon) would overlap (At least that’s what I suspect)

Anyway, I’m sure you really don’t care so… Again thanks. This seems to be the only solution giving me what I want.

So let me resume to be sure :slight_smile:

You are Team Kodi and participated indirectly in the ban from forum and github preventing me to fix many things in Kodi.
You ask me to add a workaround in Yatse for a bug in Kodi.
I give you the details about why I can’t do that (still no way to get the playlist id)
I give you the proper solution.

And yet you are mad at me? My attitude is perfectly fine, not sure I can say the same from you, seeing how you acted previously for Wear and bad rating for feature requests without any excuses.
And now despite solutions and details why your workaround does not work on Yatse side you continue to think I’m stuck and the bad guy. Repeating I want that, when I’ve explained why it’s not possible is not a nice way.

I should have just deleted your requests and banned you, yet I did everything correctly.

Seriously, we do not see the same reality right now :slight_smile: I know you don’t care and certainly will never understand that the issue here is your attitude. And that the fact that I did gave you the solution 2 times means that I do care…

Some people really amaze me by being totally unable to see the whole picture.

And as you already know if you want the busy dialogs to go, ask Json maintainer, I could fix Kodi but can’t thanks to marvelous Martijn :slight_smile: that prefer his pride over Kodi.

1 Like

Posting here so that everyone can see the real you :slight_smile:

You ask for help to someone who have no reason to help, yet have the help and act like a little princess :slight_smile:

I guess you have no shame :wink: To be honest I’m the one speechless because your acts were easy to predict but I really did not thought you’d do it after all :slight_smile:

1 Like

My dear Tadly you won’t get out that easily from your actions :slight_smile:

You do not take responsibility for your actions that fine, but since posting that bad rating is acting like an asshole, people have the right to know who you are and the kind of people you are.

tadly (tadly) · GitHub from Team Kodi, yes everything I wrote was just the truth, sorry princess.

1 Like

Since Tadly continues with the help of Bry to update their bad ratings.

Some details about “Let’s avoid repeating the Wear/Google+ stuff and your actions please.”

When he blackmailed me in 2018 to try to get features in Yatse despite a very long time trying to explain him why I would not add that.


Exact same behavior, is persuaded to be right, do not read or try to understand the explanations and think that I owe him everything so can use bad ratings or insults as he wants.

Each times despite your actions, I take time to answer and help, and each times you think you can insult and bad rate despite getting proper answers and help.

And 5 months later little kid continues to update his rating :slight_smile:

Some people are really pathetic and unable to face truth :frowning:

Read that. Speechless also.

I think it does not worth to keep help neither reply them anymore @tolriq

Hat off to you, and thanks for your patience and all your great work! Keep your energy.:wink: