Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Music doesn't play in Kodi Matrix #357

Open
wormvortex opened this issue Jul 26, 2021 · 16 comments
Open

Music doesn't play in Kodi Matrix #357

wormvortex opened this issue Jul 26, 2021 · 16 comments

Comments

@wormvortex
Copy link

Since upgrading to matrix the plex-for-kodi app will not play music. Videos load fine but music just opens the player and stays at 0 seconds no matter what I try and play.

Details:

  • Add-on version: latest
  • Kodi version: matrix
  • OS Platform: libreleec
  • Hardware: pi4
@Asgardsurfer
Copy link

Asgardsurfer commented Jul 27, 2021

I'm seeing the exact same thing, thanks in advance to those that can fix this!

Details:

Add-on version: latest
Kodi version: matrix
OS Platform: Android
Hardware: minix U1 (Amlogic S905)

@Indrikis480
Copy link

Greetings. A similar problem. Hope for a solution soon. Thanks for your work.

Details:

Add-on version: latest
Kodi version: matrix
OS Platform: Android 9.0
Hardware: Ugoos AM6 Plus (Amlogic S922XJ)

@SonGoku90
Copy link

I also have such a problem on nvidia shield in kodi 19.1

@Buri
Copy link

Buri commented Sep 18, 2021

It looks like the playlist data coming in is wrong?

2021-09-18 10:51:25.306 T:2641    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: a bytes-like object is required, not 'str'
                                                   Traceback (most recent call last):
                                                     File "/home/buri/.kodi/addons/script.plex/lib/windows/kodigui.py", line 105, in onInit
                                                       self.onFirstInit()
                                                     File "/home/buri/.kodi/addons/script.plex/lib/windows/musicplayer.py", line 64, in onFirstInit
                                                       self.play()
                                                     File "/home/buri/.kodi/addons/script.plex/lib/windows/musicplayer.py", line 152, in play
                                                       player.PLAYER.playAudioPlaylist(self.playlist, startpos=list(self.playlist.items()).index(self.track), fanart=fanart)
                                                     File "/home/buri/.kodi/addons/script.plex/lib/player.py", line 858, in playAudioPlaylist
                                                       url, li = self.createTrackListItem(track, fanart, index=index)
                                                     File "/home/buri/.kodi/addons/script.plex/lib/player.py", line 874, in createTrackListItem
                                                       data = base64.urlsafe_b64encode(track.serialize())
                                                     File "/usr/lib64/python3.6/base64.py", line 118, in urlsafe_b64encode
                                                       return b64encode(s).translate(_urlsafe_encode_translation)
                                                     File "/usr/lib64/python3.6/base64.py", line 58, in b64encode
                                                       encoded = binascii.b2a_base64(s, newline=False)
                                                   TypeError: a bytes-like object is required, not 'str'
                                                   -->End of Python script error report<--

@jhoms
Copy link

jhoms commented Sep 26, 2021

Found a way to fix it. Not sure it is the best though. I made changes in plugin.py and player.py:

~/.kodi/addons/script.plex/plugin.py

play()
#44
-        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data))
+        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:]))

~/.kodi/addons/script.plexli/player.py

extractTrackInfo()

#516
-            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data.encode('utf-8')))
+            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:].encode('utf-8')))

createTrackListItem()

#870
-        data = base64.urlsafe_b64encode(track.serialize())
+        data = base64.urlsafe_b64encode(bytearray(track.serialize(),'utf-8'))

Hope it helps.

@basildane
Copy link

Found a way to fix it. Not sure it is the best though. I made changes in plugin.py and player.py:

~/.kodi/addons/script.plex/plugin.py

play()
#44
-        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data))
+        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:]))

~/.kodi/addons/script.plexli/player.py

extractTrackInfo()

#516
-            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data.encode('utf-8')))
+            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:].encode('utf-8')))

createTrackListItem()

#870
-        data = base64.urlsafe_b64encode(track.serialize())
+        data = base64.urlsafe_b64encode(bytearray(track.serialize(),'utf-8'))

Hope it helps.

I have an Nvidia Shield running Kodi / Plex. Where and how would I even find these files?

@jhoms
Copy link

jhoms commented Nov 27, 2021

Found a way to fix it. Not sure it is the best though. I made changes in plugin.py and player.py:

~/.kodi/addons/script.plex/plugin.py

play()
#44
-        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data))
+        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:]))

~/.kodi/addons/script.plexli/player.py

extractTrackInfo()

#516
-            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data.encode('utf-8')))
+            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:].encode('utf-8')))

createTrackListItem()

#870
-        data = base64.urlsafe_b64encode(track.serialize())
+        data = base64.urlsafe_b64encode(bytearray(track.serialize(),'utf-8'))

Hope it helps.

I have an Nvidia Shield running Kodi / Plex. Where and how would I even find these files?

Maybe this could help

https://forum.kodi.tv/showthread.php?tid=285399

@basildane
Copy link

@jhoms That worked PERFECTLY! Thank you.
I am now able to use Plex for the first time since this summer!

I do have some questions. Why did it break in the first place? And why not put this fix in the production code?

Also, my Shield says the current version is 0.3.4, but GitHub says latest version is 0.1.6.
I just want to have this work - permanently and understand what the situation is.

And thanks for responding!

@jhoms
Copy link

jhoms commented Nov 28, 2021

Why did it break in the first place?

My guess is that with Matrix upgrade some python libraries got upgraded to and they work different.

And why not put this fix in the production code?

I don't know. I was just in the same situation as you, but with my little knowledge of python found a workaround. I am glad it is working for you too.

Regarding the versions, I don't know. Maybe the people who takes care of this piece of code can. They can also make this change in the original code (even find a better fix) so future upgrades work fine out of the box.

@DarkissGit
Copy link

This solution worked for me.

Details:

Add-on version: latest (0.3.4)
Kodi version: Matrix v19.3
OS Platform: Android 11.0
Hardware: Nvidia Shield

Thx @jhoms

@jaysh-yin
Copy link

Found a way to fix it. Not sure it is the best though. I made changes in plugin.py and player.py:

~/.kodi/addons/script.plex/plugin.py

play()
#44
-        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data))
+        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:]))

~/.kodi/addons/script.plexli/player.py

extractTrackInfo()

#516
-            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data.encode('utf-8')))
+            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:].encode('utf-8')))

createTrackListItem()

#870
-        data = base64.urlsafe_b64encode(track.serialize())
+        data = base64.urlsafe_b64encode(bytearray(track.serialize(),'utf-8'))

Hope it helps.

it's worked!Thank you very much!!
But,have a new issues.
when click “Next Track” or “Previous Track” button,plex Add-on will crash.

@jhoms
Copy link

jhoms commented Jun 18, 2022

Found a way to fix it. Not sure it is the best though. I made changes in plugin.py and player.py:

~/.kodi/addons/script.plex/plugin.py

play()
#44
-        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data))
+        plexObject = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:]))

~/.kodi/addons/script.plexli/player.py

extractTrackInfo()

#516
-            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data.encode('utf-8')))
+            track = plexobjects.PlexObject.deSerialize(base64.urlsafe_b64decode(data[1:].encode('utf-8')))

createTrackListItem()

#870
-        data = base64.urlsafe_b64encode(track.serialize())
+        data = base64.urlsafe_b64encode(bytearray(track.serialize(),'utf-8'))

Hope it helps.

it's worked!Thank you very much!! But,have a new issues. when click “Next Track” or “Previous Track” button,plex Add-on will crash.

I was trying to reproduce your problem but in my installation is working fine, so it is hard for me to find a way to fix it. Sorry.

@Kotva666
Copy link

I have the same problem which as you can see has been there since 2021 ... today I installed the new libreelec on RPi4 and the plex script on it, everything works except the music itself. Is it such a problem for the developers to care and fix this bug? When I download the Composite add-on I can play the audio in it without any problems.

@yangn0
Copy link

yangn0 commented Aug 5, 2022

when click “Next Track” or “Previous Track” button,plex Add-on will crash.

me too.it's worked.but when click “Next Track” or “Previous Track” button,plex Add-on will crash.

@ericconnelly
Copy link

Same

Add-on version: latest
Kodi version: matrix
OS Platform: libreleec
Hardware: pi4

@mike-d-b
Copy link

mike-d-b commented Nov 2, 2022

Still have the problem with Plex-Addon. I haven't tried the workaround yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests