ukdtom/WebTools.bundle

Playlist Import Length Limited to 30 titles

Psychocrysma opened this issue · 20 comments

Environment

  • PMS Platform(s) OS: Windows 10
  • PMS Version: v3.0.0
  • Name of Browser: Chrome

Error shown

  • Symptom: Not exactly an error but basically, it's an issue with the limitations of the playlist import and I have found the exact length where the playlist breaks. Essentially, any playlist containing more than 30 songs stops importing at 30. I can download a playlist with 31 songs and when I import it, it doesn't add the 31st song.

Steps to reproduce

  1. Build a playlist of 31 songs or more.
  2. Download it.
  3. Delete it from Plex.
  4. Import it.

Expected behaviour

  1. The whole playlist, no matter the size, will be imported.

Actual behaviour

  1. Upon importation, the actual playlist on plex will contain only 30 songs.

Additional Info

I have produced this bug not manually but while trying to cheat the system. I made a quick C# converter to convert my winamp playlists into a usable file. And they work very well, but they stop at 30. This is why I checked if this issue was produced manually, and it is.

PMSLogs_20181116-082935.zip

Checklist

  • Listed environment
  • Included PMS log zip and WebTools log (THIS IS MANDATORY!)
  • Included screenshots (where appropriate)
  • Checked that this isn't already an issue

I see errors in the log, like:

2018-11-16 07:29:23,601 (359c) : CRITICAL (core:574) - Exception happened in Playlist import was: 'utf8' codec can't decode byte 0x8c in position 0: invalid start byte (most recent call last): File "D:\Users\Gabriel\AppData\Local\Plex Media Server\Plug-ins\WebTools.bundle\Contents\Code\playlistsV3.py", line 367, in IMPORT success.append(unicode(items[item]['title'])) UnicodeDecodeError: 'utf8' codec can't decode byte 0x8c in position 0: invalid start byte

Got a title that starts with ƌperhaps?

Also: Ƒ seen in:
2018-11-16 08:08:57,871 (359c) : CRITICAL (core:574) - Exception happened in Playlist import was: 'utf8' codec can't decode byte 0x91 in position 0: invalid start byte (most recent call last): File "D:\Users\Gabriel\AppData\Local\Plex Media Server\Plug-ins\WebTools.bundle\Contents\Code\playlistsV3.py", line 367, in IMPORT success.append(unicode(items[item]['title'])) UnicodeDecodeError: 'utf8' codec can't decode byte 0x91 in position 0: invalid start byte

Also, you should switch locale of your server to utf-8

******* Started WebTools V3.0.0 on Windows at 2018-11-16 07:25 with locale set to ('en_GB', 'cp932')

Scratch above, since you are running Windows :(

Ah yes sorry this was during testing. Many of my song titles are in Japanese, so my playlists go through encoding JIS. And then I convert them to UTF 8 manually.

In these examples, I simply forgot to manually convert them. My bad.

Can you provide a fresh set of logs, in utf-8?

That said, the Japanese title were being imported with no issue. It really is only the 30 length limit that was problematic for me. After all, my playlists have around 700 titles each.

I still would like a fresh set of logs ;)

Sure, let me run my virtual machine again...

As a side note, what do the ID and ListID stand for in the playlists?

ID: Key of media within PMS
ListID: Key of Media within the Playlist itself

Is this something that is set by Plex already or you can set it yourself? Also, here are the clean logs. The first shot was done with a manual playlist. The second was done with the playlist stored within the ZIP.
Logs and Playlist.zip

The reason I ask is that my IDs and ListIDs from my custom edit are randomly generated from each previous number within a difference of 20. That may be involved in the breaking. And yet, it still adds some. And it's always the same ones.

See for yourself, by browsing to:

http://IPOFPMS:32400/playlists/KEYOFPLAYLIST/items?X-Plex-Token=YOURTOKEN

So if on the server, try:
http://127.0.0.1:32400/playlists/3823/items?X-Plex-Token=YOURTOKEN

You can get your TOKEN from the TechModule of WebTools

That gives me an Error 404.

Means not found, so you deleted the playlist in the mean time ;)

Try:
http://127.0.0.1:32400/playlists?X-Plex-Token=YOURTOKEN

to get a list of playlists, and then use the ratingkey value as KEYOFPLAYLIST

I guess that value is set then but the first track's there and the ID the playlist had set was completely different so I really am not sure if that's the issue.

Alright I want to update regarding this: I am pretty sure my issue is caused by the fact that my rating keys are broken. I have done some more testing with valid rating keys I've gotten through /library/metadata/ and it seems to be working better. However, at that point, I think it becomes less necessary to use WebTools at all. I am going to start working on an application in C# tomorrow that will run through http://192.168.0.xxx:32400/library/sections/1/all?X-Plex-Token= and basically pick off all its children and loop till it gets all the files necessary and basically make a valid playlist, then do a http://192.168.0.xxx:32400/playlists/upload?sectionID=1&path=F:\Music\Playlist.m3u8&X-Plex-Token= to directly upload it. And for the sake of efficiency, I might do a run through command line instead of using the urls.

Edit: Can you tell me where I could easily fetch ServerID (MachineID) programmatically? Should I go through \HKEY_CURRENT_USER\Software\Plex, Inc.\Plex Media Server in Regedit to fetch ProcessedMachineIdentifier (I don't like that the app would require additional administrator rights though) or is there another way?

http://IP_OF_PMS:32400/identity

The application is pretty much complete but I still seem to be unable to upload the playlist and the error I get from WebTools is
"Error: playlistService.importPlaylist - Exception happened in Playlist import was: local variable 'ratingKey' referenced before assignment"

That said, all ratingKeys are taken from Plex. The only thing that I have assumed was not needed to be specific was ListID but perhaps I just don't understand what it is. Isn't that value representing like the index of a track within the playlist? Does it have to be specific or can it be one by one?

Sadly, dev work has been put on hold, due to plugins been discontinued by Plex

Ref: https://www.plex.tv/blog/subtitles-and-sunsets-big-improvements-little-housekeeping/

No new versions will be release, and this project has been put on hold

UAS will still be maintained for as long as it lasts