Skip to content

Using the Fixer

Collin Heist edited this page Jul 26, 2023 · 30 revisions

Background

The "fixer" (shorthand for the fixer.py file) is a command-line tool for doing manual fixes and interactions with the Maker.

Runtime Options

This file's -h or --help (help) menu is shown below:

Click to Expand
pipenv run python3 fixer.py --help
usage: fixer.py [-h] [-p FILE] [-ms SERVER] [--delete-cards DIRECTORY [DIRECTORY ...]]                
                [--delete-extension EXTENSION] [--print-log] [--import-cards ARCHIVE_DIRECTORY LIBRARY]
                [--import-series NAME [YEAR ...]] [--import-extension .EXT] [--forget-cards LIBRARY NAME YEAR]
                [--revert-series LIBRARY NAME YEAR] [--id ID_TYPE ID] [--sonarr-list-ids]
                [--tmdb-download-images TITLE YEAR SEASON EPISODE_RANGE DIRECTORY] [--unblacklist TITLE YEAR]
                [--delete-blacklist]

Manual fixes for the TitleCardMaker

optional arguments:
  -h, --help            show this help message and exit
  -p FILE, --preferences FILE, --preference-file FILE
                        File to read global preferences from. Environment variable TCM_PREFERENCES. Defaults to
                        "/mnt/user/Media/TitleCardMaker/preferences.yml"
  -ms SERVER, --media-server SERVER
                        Which media server to perform Media Server arguments on

Miscellaneous:
  --delete-cards DIRECTORY [DIRECTORY ...]
                        Delete all images with the specified directory(ies)
  --delete-extension EXTENSION
                        Extension of images to delete with --delete-cards
  --print-log           Print the last log file

Media Server:
  --import-cards ARCHIVE_DIRECTORY LIBRARY, --import-archive ARCHIVE_DIRECTORY LIBRARY, --load-archive ARCHIVE_DIRECTORY LIBRARY
                        Import an archive of Title Cards into Emby/Jellyfin/Plex
  --import-series NAME [YEAR ...], --load-series NAME [YEAR ...]
                        Override/set the name of the series imported with --import-archive
  --import-extension .EXT, --import-ext .EXT
                        Extension of images to look for alongside --import-cards
  --forget-cards LIBRARY NAME YEAR, --forget-loaded-cards LIBRARY NAME YEAR
                        Remove records of the loaded cards for the given series/library
  --revert-series LIBRARY NAME YEAR
                        Remove the cards for the given series within Emby/Jellyfin/Plex
  --id ID_TYPE ID, --series-id ID_TYPE ID
                        Specify database IDs of a series for importing/reloading cards

Sonarr:
  --sonarr-list-ids     List all the ID's for all shows within Sonarr

TheMovieDatabase:
  Fixes for how the Maker interacts with TheMovieDatabase

  --tmdb-download-images TITLE YEAR SEASON EPISODE_RANGE DIRECTORY
                        Download the title card source images for the given season of the given series
  --unblacklist TITLE YEAR
                        Unblacklist all requests for the given series
  --delete-blacklist    Delete the existing TMDb blacklist file

--preference-file, -p

Specify the preference file to read for any related fix commands.

--media-server, -ms

Which media server to perform operations on. This is only required if not using Plex (or Plex and another server) This is specified like --media-server plex, or --media-server emby, or --media-server jellyfin.

Miscellaneous Arguments

--delete-cards

Delete all cards (images) within any specified directories. This argument takes any number of directories, and will ask for confirmation before any cards are deleted. Files are looked for recursively, so any images in any sub-folders of the specified directories will be identified.

An example of using this argument to delete all images in multiple folders is shown below:

# pipenv run python fixer.py --delete-cards ./images/folder_1/ ./images/folder_2/ "./images/folder with spaces/"

NOTE: This argument is used in conjunction with --delete-extension argument.

--delete-extension

Extension of image files to delete with --delete-cards. If unspecified, .jpg is used.

--print-log

Print the most recent log file to the console. This can be useful for Docker users who did not mount /maker/logs/ to a directory outside their container.

Emby/Jellyfin/Plex Arguments

--import-cards, --import-archive, --load-archive

Import an archive of title cards directly into Emby/Jellyfin/Plex. This argument takes two arguments, the folder to the archive to import, and the library within Emby/Jellyfin/Plex the series exists under.

For example, rather than recreate all 1,000 cards of One Piece (which can take hours), the following command will import my cards directly to the series within the "Anime" library:

pipenv run python fixer.py --import-archive "./cards/One Piece (1999)/Custom Season Titles, Custom Font - Anime Style/" "Anime"

This argument is very useful to import entire sets of title cards without having to recreate them yourself. The exact season and episode indices of the cards is determined from the filename (i.e. variations of S{season}E{episode}). If the series name isn't interpret-able from the folder name, then the --import-series argument can be used to manually specify this.

--import-series, --load-series

Manually specify the name and year of the series being imported with the --import-archive argument. This argument takes two values, the name of the series and the year.

For example, to import cards specifically for One Piece, the following would be used:

--import-series "One Piece" 1999

NOTE: It's important to use quotes ("") around titles with spaces in them.

--import-extension, --import-ext

By default, the fixer will only import images with --import-archive whose extensions .jpg. If importing cards of a different extension, this argument must be provided.

This extension must be given with the leading dot. Currently this must be one of: .jpg, .jpeg, .png, .tiff, or .gif.

--forget-cards, --forget-loaded-cards

Remove the cards associated with the given library + series from the Maker's "loaded" database. This effectively forces the cards to be reloaded by TCM on the next run.

This can be useful if you changed the cards manually or with Plex Meta Manager and need to revert to Maker-made cards.

Example

The following example deletes all the loaded card details for Breaking Bad within the library TV Shows on Emby/Plex. This means the next time the Maker is run, these cards will be reloaded into Emby/Plex.

pipenv run python fixer.py --forget-cards "TV Shows" "Breaking Bad" 2008

--revert-series

"Remove" the cards from the given library and series from Emby/Plex directly. This effectively removes any loaded titles cards from the series.

However, because neither Emby nor Plex allow uploaded Metadata to be deleted via the API, this doesn't actually delete the cards, it only uploads the textless source images from the provided series' source directory.

--id, --series-id

Specify a database ID for the series being imported/reloaded. This is required for Emby and Jellyfin servers, as those servers match content by series ID (not library + name, like in Plex).

This command is structured as ID_TYPE ID. The recognized ID types are emby, jellyfin, imdb, tmdb, tvdb, and tvrage. This command can be specified any number of times, for example:

--id imdb tt1234 --id tmdb 09876 --id emby abcdef

The above specifies the IMDb, TMDb, and Emby ID's for whatever series is being imported.

Sonarr Functionality

--sonarr-list-ids

Prints an output of all ID's and associated series used by Sonarr. Currently the only use for these ID's is to manually specify a series' Sonarr ID in YAML.

Example Printout
pipenv run python fixer.py --sonarr-list-ids
2 : Attack on Titan                                                                                                     
    Shingeki no Kyojin                                                                                                  
    Shingeki no Kyojin S2                                                                                               
    Shingeki no Kyojin Season 2                                                                                         
    Shingeki no Kyojin S3                                                                                               
    Shingeki no Kyojin Season 3                                                                                         
    Attack on Titan S3                                                                                                  
    Shingeki no Kyojin S4                                                                                               
    Shingeki no Kyojin: The Final Season                                                                                
    Attack on Titan - S4                                                                                                
    Attack on Titan S2                                                                                                  
    Attack on Titan: The Final Season                                                                                   
    Shingeki no Kyojin (The Final Season Part 2)                                                                        
    Ataque a los Titanes                                                                                                
    L'attacco dei giganti                                   
3 : Beastars                                                                                                            
    Beastars 2                                                                                                          
    Beastars S2
...
702 : Don't Trust the B---- in Apartment 23
      Dont Trust the Bitch in Apartment 23
703 : Ghosts (US)
      Ghosts 2021
      Ghosts (2021)
...

NOTE: Notice how some series ID's (all in this example) have more than one listed name. This is because Sonarr stores a main title, as well as a series of alternate titles for identifying a given series. These all share the same ID.

TMDb Functionality

--tmdb-download-images

Download the source images for the given season of the given series into the specified directory. For example:

pipenv run python fixer.py --tmdb-download-images "Breaking Bad" 2008 1 2-10 ./breaking_bad/

Would download images source images for Season 1 episodes 2 through 10 of Breaking Bad into ./breaking_bad/; named like s1e2.jpg, s1e3.jpg, etc.

--unblacklist

Remove all blacklist entries for the given series. The first argument is the series title, the second is the year. For example:

pipenv run python fixer.py --unblacklist "Breaking Bad" 2008

This removes all blacklisted queries for Breaking Bad.

--delete-blacklist

Delete the current blacklist used by the Maker. This can be useful if a set of requests was blacklisted a while ago, but you'd like to check if those requests would still fail - i.e. if there was no source image for some title cards, but perhaps they've since been uploaded.

This is rarely necessary for 99% of users. The specifics of blacklisting are detailed here.

Clone this wiki locally