- commit
- 4bf5d9a
- parent
- 73a5ff1
- author
- xxwhirlpool
- date
- 2026-04-12 19:56:04 -0400 EDT
add `plex_playlist_m3u.py`
3 files changed,
+43,
-0
+1,
-0
1@@ -36,6 +36,7 @@ config/.local/bin/quote
2 config/.local/bin/quoterandom
3 config/.local/bin/discord_timest
4 scripts/Scripts/plex/playlists/*
5+scripts/Scripts/plex/playlists_m3u/*
6 scripts/Scripts/plex/posters/*
7 config/.config/mpd.conf
8 config/.config/rmpc/config.ron
+12,
-0
1@@ -27,3 +27,15 @@ plex_playlist.py [TOKEN]
2 ```bash
3 plex_playlist_cover.py [TOKEN]
4 ```
5+
6+## plex_playlist_m3u.py
7+
8+- exports to `~/Scripts/plex/playlists_m3u`
9+- each filename is the name of the playlist + `.m3u`
10+- song file paths are absolute paths from the server they're hosted on
11+
12+### usage
13+
14+```bash
15+plex_playlist_m3u.py [TOKEN]
16+```
1@@ -0,0 +1,30 @@
2+#!/usr/bin/env -S uv run --script
3+# /// script
4+# requires-python = ">=3.14"
5+# dependencies = [
6+# "plexapi>=4.18.1",
7+# ]
8+# ///
9+
10+# USAGE: plex_playlist_m3u.py [TOKEN]
11+#
12+# download all playlists as M3U files
13+
14+from plexapi.server import PlexServer
15+import sys
16+
17+SERVER_URL = "http://192.168.1.219:32400"
18+TOKEN = sys.argv[1]
19+
20+plex = PlexServer(SERVER_URL, TOKEN)
21+
22+for plist in plex.playlists(playlistType="audio"):
23+ list_title = plist.title
24+ list_items = plist.items()
25+ m3u = open("playlists_m3u/" + list_title + ".m3u", "w")
26+ m3u.write("#EXTM3U\n")
27+ for i in list_items:
28+ loc = i.locations
29+ for l in loc:
30+ m3u.write(l + "\n")
31+ m3u.close()