xxwhirlpool
·
2026-04-12
covers.py
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: cover.py [TOKEN]
10#
11# download all CURRENTLY SELECTED playlist posters/covers
12# posters are named after the playlists
13
14from plexapi.server import PlexServer
15from plexapi.utils import download
16from plexapi.mixins import PlaylistMixins
17import sys
18
19SERVER_URL = "http://192.168.1.219:32400"
20TOKEN = sys.argv[1]
21
22plex = PlexServer(SERVER_URL, TOKEN)
23
24for plist in plex.playlists(playlistType="audio"):
25 list_title = plist.title
26 posters = PlaylistMixins.posters(plist)
27 filtered_posters = list(filter(lambda x: x.selected == True, posters))
28 for po in filtered_posters:
29 po_img = po.thumb
30 po_img_todl = SERVER_URL + po_img
31 download(po_img_todl, TOKEN, list_title + ".png", "posters/") # img to download, token so it can dl, filename, folder to dl to