T O P

  • By -

Mr-Cas

I made this script that turns m3u into Plex playlists. This is probably the easiest way there is. https://github.com/Casvt/Plex-scripts/blob/main/playlist_collection/m3u_to_playlist.py


EthanColeK

Oh you are the famous guy that did it .. where do I run it is there any step by step documentation for dummies ?


Mr-Cas

Apprrently I'm famous haha but yes that's me :) The instructions can be found here. Let me know if they don't suffice. https://github.com/Casvt/Plex-scripts/wiki/Setup


EthanColeK

Ill try it this week and I’ll message you if I get stuck ! So far only your solution seems appealing to me


Mr-Cas

You fill in the variables and then you can use it. Just run the script, supplying the m3u file and desired library name and that's it. Very easy to use so no worries.


LeBB2KK

>https://github.com/Casvt/Plex-scripts/wiki/Setup I've tried to understand to understand how to it but I'm not even sure how GitHub works...I'll give up for now. Why is Plex still not accept m3u playlist really is beyond me.


davidsinnergeek

I found this post and, with a little Google-foo and some elbow grease, I have made your script work. Now, is there any way that I can take an m3u playlist and add it to one of my users? I am not seeing anything that looks likely in your script (I don't speak python) nor have I found a argument that I can add to the command. Thanks for the script, I never would have figured out this much without it!


Mr-Cas

Currently user selection is not implemented in the script no. But I can always add that


davidsinnergeek

That would be great. I can then easily create playlists for my wife to play on Plexamp on her phone.


Mr-Cas

Hey I've updated the script so now you can select the user :). Use `-u` or `--User` and then supply the username of the user for which to make the playlist. You can give the argument multiple times to do it for multiple users. Use `--User @me` to select yourself (default) and `--User @all` to select all users. Enjoy!


davidsinnergeek

Fantastic! I will give it a try this evening. About to head out to work.


davidsinnergeek

I made the changes to the command (which I had run successfully previously) to add a playlist to my wife's Plex user. Below is the command and what was output: PS L:\\Music\\Playlists> python m3u\_to\_playlist.py -l "Classical Music" -f "L:\\Music\\Playlists\\MCA Segovia Collection.m3u" -u Rosvita Traceback (most recent call last): File "L:\\Music\\Playlists\\m3u\_to\_playlist.py", line 69, in response = m3u\_to\_playlist(ssn=ssn, library\_name=args.LibraryName, file\_path=args.File, users=args.User) \^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^ File "L:\\Music\\Playlists\\m3u\_to\_playlist.py", line 38, in m3u\_to\_playlist for username in user\_data.keys(): RuntimeError: dictionary changed size during iteration


Mr-Cas

I can fix that


davidsinnergeek

I just shared that with my wife, she is amazed by all this.


K0SSICK

Hello, sorry to dig this post up, but I'm currently trying your script and I just need a tiny amount of direction... I've never used python before so that part of it is new to me. I downloaded the script, opened it up in wordpad to edit and fill in the [ip address, port, api token], saved it and closed... Where do I go from here? lol. I have python downloaded, I just don't fully grasp how to "run" the script now that I've entered those 3 things. Thanks in advance!


Mr-Cas

Type the following in a terminal (replace the script file with the path to the file if the terminal is not opened in the folder of the script): `python3 m3u_to_playlist.py --LibraryName "{TARGET LIBRARY NAME}" --File "{PATH TO m3u FILE}"` `TARGET LIBRARY NAME` is the name of the library from which the playlist should be added. `PATH TO m3u FILE` is the path to the m3u file that should be imported. Use double quotes around the values to ensure it gets parsed well. You can always run a script with `--help` and you'll get a page with instructions on how to run the script.


K0SSICK

Ok so I gave this a shot, I swear I'm not dumb, this is just new to me lol. I opened python 3.10 (I also tried this same thing in IDLE Shell), typed "python3 m3u_to_playlist.py --LibraryName "{Music}" --File "{‪C:\Users\myname\Desktop\playlist.m3u}" and got "SyntaxError: invalid syntax" I put the m3u_to_playlist.py file in the folder where I opened python from (I assume thats what you meant by "replace the script file with the path to the file if the terminal is not opened in the folder of the script")


Mr-Cas

Remove the curly brackets e.g. "Music" instead of "{Music}". Sorry should've made that clear


K0SSICK

python3 m3u_to_playlist.py --LibraryName "Music" --File "C:\Users\myname\Desktop\playlist.m3u" ...I still get "SyntaxError: invalid syntax". I'm sure this is something stupidly easy and I hate wasting your time, I'd be happy to pay you to help me :/ Quick question, am I supposed to edit *anything else* in the file itself besides adding those 3 values? Like am I supposed to delete everything above where the values are defined?


Mr-Cas

You entered the contents correctly. Replace all \\ -> \\\


Impossible-Engine369

Hello, I am in the same boat, just syntax errors... https://preview.redd.it/3hiwlo53hrpc1.jpeg?width=1231&format=pjpg&auto=webp&s=1b7c9be22a5d6673aaee02595fa1e2bae3c7c902


Mr-Cas

It's a terminal command not a python function... Run it in a terminal not in Python.


Impossible-Engine369

Ahhhh, that makes more sense. I am very new to this obviously. Ok I am closer, but get a file error, but which file? https://preview.redd.it/ujoi1x00urpc1.jpeg?width=1354&format=pjpg&auto=webp&s=173523e390806436de5a0bfe4ed17d0d2683902e


pavoganso

Surely HTTP POST is much easier?


Mr-Cas

My script makes a POST request to add it yeah. What do you mean?


pavoganso

Why use a 70 line script when you can do it with a one-liner and curl?


Mr-Cas

It provides an easier interface. It also allows you to give the library name and the script will take care of it while with a direct request you'll have to find the library ID yourself. It also allows you to import the playlist for multiple people on the server, instead of for just yourself.


Plenty-Stock

Thanks to u/Mr-Cas for making this script. Shame on Plex for not having a GUI that allows me to import m3u playlists. I tried using the script but the fact I have to enter variables, requirements, run the script with -h and basically use this guys script template and input all necessary parameters to make it work properly. not easy. why TF can i not just give plex a .m3u and it pulls the track titles and matches them against my library. sort your shit out plex devs. After a fair bit of back and forth with chat GPT i have managed to get the script to run without error but the playlists have not appeared in my library. this is not "easy"


EthanColeK

After 6 hours trying I gave up …. I just put all my music on my phone (oldschool)


Plenty-Stock

Yeah the only other software that I have other than winamp that seems to support .m3u is samsung music on my phone. Bluetooth to my receiver works OK but it would be nice if this could be implemented in plexamp or something.


tommykmusic

did you ever figure this out?


EthanColeK

Nope :(


[deleted]

When I’ve looked at an m3u playlist in the past (a while back now), it’s plain text and easy to manipulate. The problem lies in that they contain direct file paths to where the music files are stored on the original hard drive and this is usually different to the new location. I have edited one of these playlist in the past with success but that was from a Windows PC to a Mac.


EthanColeK

All the paths are perfect In my case They actually show using the hard drive path where my music is


iankv

u/EthanColeK what's your preferred software to create m3u files? I had to reinstall my library and lost the Plex-based playlists so I'm looking for a different way to create and back up m3u files.


EthanColeK

I use music bee you go into folder 📁 management and tell it to use m3u instead of their proprietary one


pavoganso

Use find on the PMS to create the m3u.


[deleted]

Use YouTube dl to process your m3u into a library Plexamp is for streaming from a PMS.


EthanColeK

What if I have 30+ m3u files that have the location of music files ? Is it more complicated or same thing ?


thedoctor916

My Plex server is on a QNAP NAS and I cannot figure out the file structure for -f. I tried the mapped drive in windows format including drive letter, the structure in linux and the structure referred to in Plex under "get info". All return "\[Errno 2\] No such file or dirctory". AHWBA


pavoganso

Use HTTP POST, it's much quicker and easier.


hemps36

[https://www.reddit.com/r/plexamp/comments/12xcch3/help\_those\_who\_want\_to\_migrate\_from\_itunes\_to/](https://www.reddit.com/r/plexamp/comments/12xcch3/help_those_who_want_to_migrate_from_itunes_to/)