Misc scripts and tools. Undocumented scripts probably do what I need them to but aren't finished yet.
-
A system that can run Python 3.12 or newer
-
uv installed
uv installs the Python from
.python-versionand the packages inuv.lock. -
A basic knowledge of how to run Python scripts.
if you use direnv:
- clone the repo
- cd into the repo dir
- run
direnv allowas the prompt will tell you to - direnv runs
uv syncand activates.venv
- clone repo
git clone https://github.com/chazlarson/Media-Scripts.git - cd to repo directory
cd Media-Scripts - Install the locked dependencies
uv sync - Run a script with the environment uv created
uv run python orchestrator.py list
Once the environment is installed, you are ready to set up the script-specific stuff.
-
Copy
config.template.yamltoconfig.yamlLinux or Mac:
cp config.template.yaml config.yamlWindows:
copy config.template.yaml config.yaml -
Edit
config.yamlto suit your environment [plex url, token, libraries] and your requirements [what to do, where to download things, etc.]; the settings for each script are detailed in the readme within each folder as shown below.Edit the file with whatever text editor you wish, so long as you save it as plain text.
-
cd to script directory [
Plex,Kometa, etc] for example:cd Plex -
Run the desired script.
All these scripts use the same config.yaml and the root uv environment.
adjust-added-dates.py- fix broken added and perhaps originally available dates in your libraryuser-emails.py- extract user emails from your sharesreset-posters-tmdb.py- reset all artwork in a library to TMDB defaultreset-posters-plex.py- reset all artwork in a library to Plex defaultgrab-all-IDs.py- grab [into a sqlite DB] ratingKey, IMDB ID, TMDB ID, TVDB ID for everything in a library from plexgrab-all-posters.py- grab some or all of the artwork for a library from plexgrab-all-status.py- grab watch status for all users all libraries from plexapply-all-status.py- apply watch status for all users all libraries to plex from the file emitted by the previous scriptshow-all-playlists.py- Show contents of all user playlistsdelete-collections.py- delete most or all collections from one or more librariesrefresh-metadata.py- Refresh metadata individually on items in a librarylist-item-ids.py- Generate a list of IDs in libraries and/or collectionsactor-count.py- Generate a list of actor credit countscrew-count.py- Generate a list of crew credit countslist-low-poster-counts.py- Generate a list of items that have fewer than some number of posters in Plexcheck-square-art.py- Report whether target libraries have Plex square art
See the Plex Scripts README for details.
extract-collections.py- extract collections from a librarykometa-trakt-auth.py- generate trakt auth block for Kometa config.ymlkometa-mal-auth.py- generate mal auth block for Kometa config.ymloriginal-to-assets.py- Copy image files from an "Original Posters" directory to an asset directorymetadata-extractor.py- Back up all metadata into a Kometa-compatible metadata file
See the Kometa Scripts README for details.
tmdb-people.py- retrieve TMDB images for a list of peopletmdb_logos.py- download TMDB logos for items in the configured Plex libraries
See the TMDB Scripts README for details.
This presents a web UI that lets you scroll through the images that Plex provides for each item [movie, show, season, episode], selecting the one you want by clicking a button, which downloads it to an asset directory
See the Plex Image Picker README for details.
orchestrator.py is the single entry point for local runs and for a container:
python orchestrator.py list
python orchestrator.py grab-all-posters
python orchestrator.py plex/check-square-art --sample-size 1
python orchestrator.py menu
With no arguments on a terminal, it opens menu.py. Each script reads ../config.yaml from its working directory. The Plex Image Picker stays a separate app and is not included here.
docker build -t media-scripts .
docker run --rm -v /path/to/config:/config media-scripts list
docker run --rm -v /path/to/config:/config media-scripts grab-all-posters
/config is the only mount. The first run copies config.template.yaml to /config/config.yaml when that file is missing. Scripts then write logs, posters, and other output under /config/plex, /config/kometa, and /config/tmdb. Relative paths in config.yaml are relative to those folders. kometa.config_dir still needs to be a path the container can see if a script reads the Kometa config directory.