Commit 062790b

xxwhirlpool  ·  2026-04-05 20:56:36 -0400 EDT
parent 4231e5e
plex playlist export, misc
3 files changed,  +43, -0
+7, -0
......@@ -238,6 +238,13 @@ boop() {
238238 eval "$(exit "$last")"
239239 }
240240
241+# man by default, fall back to `help`
242+# for shell functions
243+# https://lobste.rs/s/fkr3ha/some_terminal_frustrations#c_70wike
244+man() {
245+ /usr/bin/man "$@" || help "$@" | less
246+}
247+
241248 ######################################
242249 # misc
243250 ######################################
+34, -0
......@@ -0,0 +1,34 @@
1+#!/usr/bin/env -S uv run --script
2+# /// script
3+# requires-python = ">=3.14"
4+# dependencies = [
5+# "plexapi>=4.18.1",
6+# ]
7+# ///
8+
9+# USAGE: plex_playlist.py [TOKEN IN QUOTES]
10+# this is such script kiddie shit idk python
11+
12+from plexapi.server import PlexServer
13+from plexapi.playlist import Playlist
14+from os import sys
15+
16+SERVER_URL = "http://192.168.1.219:32400"
17+TOKEN = sys.argv[1]
18+
19+plex = PlexServer(SERVER_URL, TOKEN)
20+
21+print("title, album, artist" + "\n")
22+
23+for list in plex.playlists(playlistType="audio"):
24+ listTitle = list.title
25+ items = list.items()
26+ pl_file = open(listTitle, "w")
27+ for i in items:
28+ title = i.title
29+ artist = i.originalTitle
30+ albumArtist = i.grandparentTitle
31+ if artist == None:
32+ artist = albumArtist + " - "
33+ pl_file.write(artist + title + "\n")
34+ pl_file.close()
+2, -0
......@@ -26,6 +26,8 @@ vidhash() {
2626 ext="${f##*.}"
2727 newname="${f%.*} [$hash]".$ext
2828
29+ [[ "$hash" -eq 0 ]]; echo "couldn't generate CRC32 hash" && exit 1
30+
2931 gum confirm "are you sure you want to rename?" --default=yes --timeout=2s && mv "$f" "$newname" && echo -e "new name: $newname" || echo -e "no files renamed: $newname"
3032 done
3133 }