Last active
August 3, 2023 21:29
-
-
Save ahhmino/78bc0fd7318ad69a0a20f22da9be26a2 to your computer and use it in GitHub Desktop.
Create m3u8 playlists to export from spotify_sync downloads to jellyfin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import ffmpeg | |
# These paths will be found under the profile directory for your spotify_sync profile | |
playlist_mapping_path = "/home/<user>/.local/share/spotify_sync/<your-profile>/playlist-mapping-<profile-uid>.json" | |
processed_songs_path = "/home/<user>/.local/share/spotify_sync/<your-profile>/processed-<profile-uid>.json" | |
playlists = json.load(open(playlist_mapping_path)) | |
songs = json.load(open(processed_songs_path)) | |
def create_m3u8_playlists(playlists, songs): | |
for playlist in playlists: | |
filename = f"playlists/{playlists[playlist]['playlist_name'].replace('/', '-')}.m3u8" | |
os.makedirs(os.path.dirname(filename), exist_ok=True) | |
playlist_file = open(filename, "w") | |
playlist_file.write("#EXTM3U\n") | |
for song in playlists[playlist]["tracks"]: | |
if songs[song]["download_path"] is not None and songs[song]["download_path"] != "": | |
playlist_file.write(f"#EXTINF:{ffmpeg.probe(songs[song]['download_path'])['format']['duration']},\n") | |
playlist_file.write(f"{songs[song]['download_path']}\n") | |
playlist_file.close() |
Hmm I was able to see them using `spotify_sync config list-paths`, under
the persistent_data column. If that doesn't work for you, assuming you
installed using pip, you can try checking the path template provided in the
file. Just replace <user> and <your-profile> as needed. So
`~/.local/share/spotify_sync` should exist and have folders for each profile
…On Thu, Aug 3, 2023, 12:17 PM Alex ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
'These paths will be found under the profile directory for your
spotify_sync profile'
Where are these links? I do not see them in my config.json or by using
'spotify_sync config list-paths' - Thanks!
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/ahhmino/78bc0fd7318ad69a0a20f22da9be26a2#gistcomment-4650675>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJISBIJ4OEG6I7FYLPIJOPDXTPFJDBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMRSGUZDENZXU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
'These paths will be found under the profile directory for your spotify_sync profile'
Where are these links? I do not see them in my config.json or by using 'spotify_sync config list-paths' - Thanks!