Skip to content

About

No description, website, or topics provided.

Resources

Stars

160 stars

Watchers

8 watching

Forks

Repository files navigation

Media-Scripts

Misc scripts and tools. Undocumented scripts probably do what I need them to but aren't finished yet.

Requirements

  1. A system that can run Python 3.12 or newer

  2. uv installed

    uv installs the Python from .python-version and the packages in uv.lock.

  3. A basic knowledge of how to run Python scripts.

Setup

if you use direnv:

  1. clone the repo
  2. cd into the repo dir
  3. run direnv allow as the prompt will tell you to
  4. direnv runs uv sync and activates .venv

without direnv:

  1. clone repo
    git clone https://github.com/chazlarson/Media-Scripts.git
    
  2. cd to repo directory
    cd Media-Scripts
    
  3. Install the locked dependencies
    uv sync
    
  4. Run a script with the environment uv created
    uv run python orchestrator.py list
    

After you've done one of the above:

Once the environment is installed, you are ready to set up the script-specific stuff.

  1. Copy config.template.yaml to config.yaml

    Linux or Mac:

    cp config.template.yaml config.yaml
    

    Windows:

    copy config.template.yaml config.yaml
    
  2. Edit config.yaml to 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.

  3. cd to script directory [Plex, Kometa, etc] for example:

    cd Plex
    
  4. Run the desired script.

All these scripts use the same config.yaml and the root uv environment.

Plex scripts:

  1. adjust-added-dates.py - fix broken added and perhaps originally available dates in your library
  2. user-emails.py - extract user emails from your shares
  3. reset-posters-tmdb.py - reset all artwork in a library to TMDB default
  4. reset-posters-plex.py - reset all artwork in a library to Plex default
  5. grab-all-IDs.py - grab [into a sqlite DB] ratingKey, IMDB ID, TMDB ID, TVDB ID for everything in a library from plex
  6. grab-all-posters.py - grab some or all of the artwork for a library from plex
  7. grab-all-status.py - grab watch status for all users all libraries from plex
  8. apply-all-status.py - apply watch status for all users all libraries to plex from the file emitted by the previous script
  9. show-all-playlists.py - Show contents of all user playlists
  10. delete-collections.py - delete most or all collections from one or more libraries
  11. refresh-metadata.py - Refresh metadata individually on items in a library
  12. list-item-ids.py - Generate a list of IDs in libraries and/or collections
  13. actor-count.py - Generate a list of actor credit counts
  14. crew-count.py - Generate a list of crew credit counts
  15. list-low-poster-counts.py - Generate a list of items that have fewer than some number of posters in Plex
  16. check-square-art.py - Report whether target libraries have Plex square art

See the Plex Scripts README for details.

Kometa scripts

  1. extract-collections.py - extract collections from a library
  2. kometa-trakt-auth.py - generate trakt auth block for Kometa config.yml
  3. kometa-mal-auth.py - generate mal auth block for Kometa config.yml
  4. original-to-assets.py - Copy image files from an "Original Posters" directory to an asset directory
  5. metadata-extractor.py - Back up all metadata into a Kometa-compatible metadata file

See the Kometa Scripts README for details.

TMDB scripts

  1. tmdb-people.py - retrieve TMDB images for a list of people
  2. tmdb_logos.py - download TMDB logos for items in the configured Plex libraries

See the TMDB Scripts README for details.

Plex Image Picker

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.

Entry point

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

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.

Other script repos of interest

  1. bullmoose
  2. Casvt
  3. maximuskowalski 1

About

No description, website, or topics provided.

Resources

Stars

160 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages