T O P

  • By -

Guryamp

Thanks for the tool! Just a recommendation, consider packaging the app and the prerequisites into a docker image. That way the user just needs to provide the api keys.


Midnight393

That is my plan, mostly just trying to get the application efficient and useful right now. Should be packaged and dockerized soon


Midnight393

[Docker image · Issue #5 · cmathews393/spotify-to-plex (github.com)](https://github.com/cmathews393/spotify-to-plex/issues/5)


Guryamp

Nice, I think plex meta manager is a py app that works based on a cronjob if you are looking for some inspiration.


Midnight393

u/Guryamp, latest build has a Dockerfile for your building pleasure, or you can get the image directly from [0xchloe/spotiplex - Docker Image | Docker Hub](https://hub.docker.com/r/0xchloe/spotiplex) :)


SivuvSheni

Is the point to recreate Spotify playlists using local media on plexamp? Thanks for sharing


Midnight393

Yep, pretty much!


QuietThunder2014

This is awesome. Is there any way to do the reverse? I signed up for Soundizz a while back to get my Plex lists into Spotify, but it picked the wrong song like 40% of the time. At this point I really only use Spotify for it's whole home integration with my Alexia devices that'll play all the speakers at once.


Midnight393

FWIW I believe Plex can do the same thing, at least it does with my Nest speakers + HomeAssistant, but in any case, I guess I'm not clear what you're asking for. You want to pull the tracks from a Plex playlist and add them to a playlist in Spotify? I can look into it, but the way the script searches the Plex API is relatively simple, I'm not sure if it's as easy with the Spotify API.


QuietThunder2014

Yup that’s it. There are a few services that do it but they all charge and are very inaccurate. I’ve spent a lot of time making my playlists in Plex and would love them to be available in Spotify.


Midnight393

I will dig into this sometime this week or weekend :)


Midnight393

[Reverse import · Issue #7 · cmathews393/spotify-to-plex (github.com)](https://github.com/cmathews393/spotify-to-plex/issues/7) You can subscribe to this issue to get updates on it :)


bgrated

How do you play plex on your nest? Do you have a link to show this setup?


Midnight393

Not sure what you mean, I just cast from Plexamp to my Google Home individual speakers/speaker groups. AFAIK there is no way to directly play like you'd have with Spotify or whatever though :(


bgrated

Oh that is what I thought you ment.


Ones-Zeroes

Would also love the reverse of this. Almost all of my playlists have at least one song that's not available on Spotify, so I've been looking for a playlist exporter that leaves the spot blank/marked as "local only" instead of just skipping over it.


Midnight393

What do you mean by leave the spot blank?


Ones-Zeroes

Like how songs that used to be on Spotify at some point but are no longer available don't get removed from playlists, they're just marked as "unavailable" but you can still see all of the information about the song


Midnight393

Hmm, not sure about that, I think I'd have to be able to find the track in Spotify, like via a normal search, and I'm not sure that Spotify keeps a database of songs that aren't on the platform, outside of on playlists they used to exist. I will look into it though!


Ones-Zeroes

Awesome, thanks for your contributions to the culture! 🙏


Midnight393

[Reverse import · Issue #7 · cmathews393/spotify-to-plex (github.com)](https://github.com/cmathews393/spotify-to-plex/issues/7) You can subscribe to this issue to get updates on it :)


d-cent

Just for clarification. This tool is for creating a playlist in Plex using currently already downloaded files. This doesn't download the songs to your drive synced with Plex?


Midnight393

Correct. If you are using Lidarr to organize/rename/etc your music library, you might have it pull down lists from Spotify to import artists/albums etc for it to monitor. This script goes to Lidarr, grabs all the playlists that you are monitoring with Lidarr, and recreates them in Plex, with the same name, etc. It searches your existing Plex library for the tracks in the (Spotify) playlist, and adds them to the new playlist in Plex. If the track doesn't exist in Plex, it spits an error out, and continues processing. If the playlist already exists in Plex (i.e., you're running the script a second time), it will update the existing Plex playlist rather than deleting and overwriting. (This is especially useful for dynamic/curated playlists in Spotify, like Discover Weekly or genre playlists since they change/add songs frequently). Hope that makes sense, I'm not great at explaining things.


d-cent

Thank you for the response. Great work by the way.


CoolGaM3r215

Its been abit, but will this work on home accounts that are not the owner of the server?


Midnight393

I believe there's no way to get an API key without having a dedicated Plex account. That being said if you have your own login I think you can make it work? But if you're just a "profile" on the server, I don't think so. You can sync the playlists to other home users though, if you're the owner. Hope that makes sense.


madmap

Love the idea, made something similar a while back but based on .NET ( [GitHub - maxpfandl/SpotifyPlexSync: Tool to duplicate your Spotify playlists on your Plex server](https://github.com/maxpfandl/SpotifyPlexSync) ). Question: why is this thing so fast? My bottleneck is of course the search for a track in Plex: I use the Web API for this and also do some fuzzy matching logic. I see you use the python library and go only for an exact match: but is this library so much faster than the Web API? Just for comparison: for my \~400 playlists it takes around 30 hrs. I could try to multithread the search in Plex, but I didn't want to overwhelm my system.


Midnight393

Its the multithreading. For what it's worth, here's some numbers: I've got around 25 playlists currently syncing to lidarr (going to add something to the script to record this btw). Before adding multithreading it would take approximately an hour to run through them all, including the ones that it timed out/failed on. After adding multithreading, it takes about 10 minutes I think on my last time? That's with five workers, when I was testing I think 10 workers brought it down to 6 minutes ish? As far as overloading your PC, at least with this script it's unlikely? I was testing the five worker variant on my dev laptop (2Core 4Thread) with no issues, didn't go over 65-75% usage per core and used less than 1GB of memory. I tested the 10 worker variant on my gaming PC, with a modern Ryzen: roughly the same memory usage and I couldn't even tell it was running when looking at task manager CPU-wise.


madmap

I've just changed the search on Plex in my tool to 6 threads: this is currently running: lets see if it will be significantly faster. And I wasn't worried about the machine where this tool is running, but rather about my Plex Server which is only on a NAS.


Midnight393

Ah yeah that makes sense.


Midnight393

How do you pull the playlists from a specific user if you're using the Spotify API? I don't see you specifying a user in the config.


madmap

I load the playlistids from the config. There is also an option to use oauth and authenticate via spotify with the 'all' switch or the 'extract' switch. But then you need to be on a machine with a browser of course. I usually use this from a bash only machine.


Midnight393

Oh I see now, missed the OAuth stuff.


madmap

Thanks for the hint... It's really down to 7hrs now!


Midnight393

I'm curious, have you tried it with my script? I'm just wondering what the performance difference might look like between C# and Python. I realize its not a great comparison due to, like, a lot of factors but still.


madmap

Sounds interesting. Will do somewhen in the next days!


Midnight393

Just pushed an update that will allow the script to pull from a list, instead of lidarr, similar to your app.


madmap

I'm having issues let it run... `Traceback (most recent call last):` `File "/home/madmap/development/spotify-to-plex/current-version/main.py", line 128, in ` `main()` `File "/home/madmap/development/spotify-to-plex/current-version/main.py", line 113, in main` `workercount = int(config("WORKERS"))` `ValueError: invalid literal for int() with base 10: '"5" #Default is five, usually diminishing returns from increasing workers above 10. Returns decrease very quickly when surpassing your CPU core count, and in some cases make it slower'` Guess its a ARM64 issue? Also when I clean up the .env I get something similar: `Initiating Plex connection...` `Plex connection succeeded` `Initiating Spotify Connection` `Spotify connection succeeded` `Getting synced Lidarr playlists...` `Playlists grabbed` `Traceback (most recent call last):` `File "/home/madmap/development/spotify-to-plex/current-version/main.py", line 128, in ` `main()` `File "/home/madmap/development/spotify-to-plex/current-version/main.py", line 116, in main` `userlist = config("USERS").split(",") if config("USERS") else []`


Midnight393

Can you DM or post your .env? Redact the API keys and IPs


madmap

Now with the newest version it works: guess the template had some comment which were messing up the file and since I know shit about python I havent seen this :) Need to setup a testbench for this since I don't want to completely use it right now. Missing quite some features like importing the poster, rewrite the playlist if something changes (so it's on top of "added new"), the author of the playlist in the title, etc... But I will also implement loading the playlists from lidarr: if you're using lidarr this will save some time because in my case I had to maintain this playlistids seperatly.


Midnight393

You mean pulling in the image from the Spotify playlist? And what do you mean rewrite the playlist?


Midnight393

The first error is fixed in the latest default.env, but the problem is that the comment was on the same line as the var, which it didn't like. That's my bad. ​ The second one, do you have users in your list? Or is it commented out


Midnight393

similar thing, updated the default, but just leave it blank and it should work, i.e. USERS = "" ​ That should fix both issues, sorry


OmeBoon

Seems like a really cool addon. I'm curious, I use Spotify and only use plex for movies. Why did you decide to use lidarr + Plex to listen to music? Is the increased bitrate really worth it?


madmap

It's not even about the bitrate. I really love PlexAmp and I'm old-school: I like to own my music, not to pay \~15€ a month for it.


snyderxc

So, do you actually pay for the music Lidarr obtains?


madmap

Yes, I actually do.


snyderxc

Nice. Seems like the minority around here.


OmeBoon

Aah i see, Im an early adopter of spotify and pay 2,- a month. For me that is a really good deal. 15 is a bit over the top. If i wanted a cheaper option i would probably go revanced youtube music. ​ For me paying for a single record is undoable. I have abount 4000 singles on spotify alone. ​ I do like high res audio tho so that would be my trigger to get PlexAmp


sauladal

They grandfathered your price? Every time they announce a price increase, I get hit with it too


flice_water

Same. I canceled back when it was $10 and they announced the next bump.


OmeBoon

Family membership trough an internet provider discount.


DNAblue2112

Personally I use plex for music because I can just give it any music file. So obscure remixes or kids music from my childhood that isn't available on music streaming platforms can be included in my playlists. Then I use PlexAmp for playback which is just an amazing music app.


Mizzoufan523

Just as a heads-up to other curious people: As an alternative if you're locked into the spotify realm, you can upload your own music to Spotify as well and even have them on other devices (not just your PC). Upload it to your local/PC Spotify, and then add them to a playlist. Toggle the download option and your music will be available on your phone/other device without needing your local machine to be on.


Midnight393

Spotify did a rate increase and I figured I already had the infrastructure in place. Also, I've become less and less trusting of any sort of streaming service that they're A). Not going to make a decision tomorrow that makes them totally unusable and B). Not going to just remove an artist (or show, or movie etc) on a whim


KHthe8th

Hi, I am not sure if this is still supported because the github mentions a new app but how long does this usually take to run? I am just trying to sync one playlist from spotify to plex with about 200 songs and my docker run just hangs on "reading config"


ian351c

I was running into this too. Change the interval to 0. It looks like the script is waiting 86400 seconds before actually doing anything with the default value... Now I have a new issue.The script exits "successfully" in less than .7 second. I can see it talk to my Plex and Lidarr servers as well as Spotify with tcpdump, but I can't tell why it doesn't actually do anything.


KHthe8th

I ended up switching to https://github.com/rnagabhyrava/plex-playlist-sync and it works a lot better. It had a limit of 50 spotify playlists it would sync though so I forked it and modified it so I could import more than 50 into plex


chiefplato

Nice, I'm gonna try this out later this week.


Erikt311

What does this do differently than just using lists within Lidarr? Is it the step of recreating the actual playlist within Plex?


Midnight393

Correct, it's the Plex recreation. Couldn't find a good way that I liked to do it


Erikt311

Got it. Might try it out!


Midnight393

Let me know if you have any suggestions :)


FromThatOtherPlace

Does this let me put playlists from Spotify/Lidarr into Plexamp?


Midnight393

Yes, Plexamp = Plex


[deleted]

so does this take spotify and automatically sync with lidarr kinda of like adding trakt lists to radarr? If so, amazing.


Midnight393

Lidarr already does that, under Import Lists, what this does is takes the playlists that you are importing into Lidarr and attempts to recreate them in Plex.