Skip to content

Bash and Powershell scripts to check for episodes named "Episode ##" or "TBA"

License

Notifications You must be signed in to change notification settings

tronyx/sonarr-episode-name-checker

Repository files navigation

Sonarr Episode Name Checker

CodeFactor GitHub Shell Script PowerShell

Script to check for TV Show and Anime episodes that may be named with "Episode ##" or "TBA" that should not be, IE: episode name data was missing or incorrect within Sonarr when the episode was imported. Output can be displayed right in the CLI once the script completes:

Shell Output

Shell Output - None

And/or a Discord notification can be sent to a custom webhook:

Discord Webhook

Setting it up

Bash

  1. Clone or download the repo.
  2. Properly set your media storage path in the script.
  3. Modify the two exclude list text files to meet your needs.
    • If you do not have anything to exclude make sure you blank out the file because they are both required to be there.
  4. Determine and set your corresponding column value.
    • Mine is like this: /mnt/data/media/Videos/TV Shows/Show Name/Season 1/Episode Name
    • It ends up as column 7 with / as the delimiter because /mnt is actually the SECOND one and not the first.
    • For a more visual representation: (1)/(2)mnt/(3)data/(4)media/(5)Videos/(6)TV Shows/(7)Show Name/
  5. Set any other variables you would like to set.
    • If notify is set to true, but you did not set the webhook variable the script will prompt you to enter it the first time you run it.

Warning Depending on your directory structure this might not work for you. It is possible that you might need to put a path, run the script, adjust the path, run the script, etc. to get all your results. It can take some trial and error for you to get all of the shows you need/want to exclude as you will want to run the script and then check the shows that are listed for whether or not their episodes are actually named Episode ## or not.

Powershell

Note This Powershell script directly interacts with Sonarr's API. It does not support a Discord webhook like the bash script does. Instead we recommend you setup a webhook under Settings > Connect and select Rename to get Discord notifications when this script runs.

  1. Clone or download the repo.
  2. Fill in the appropriate variables in Powershell\SonarrEpisodeNameChecker.ps1
  3. Modify the two exclude list text files to meet your needs.
    • ⚠️ If you do not have anything to exclude make sure you blank out the files because they are both required to be there.
  4. Variables
    1. ⚠️ Required $sonarrApiKey: Your Sonarr API Key.
    2. ⚠️ Required $sonarrUrl: Your Sonarr URL.
    3. ☑️ Not required $sonarrSeriesStatus: Accepts any values listed here.

Note It is highly recommended that you do a dry run to see which series might need to be added to your exclusion list!

🐳 Docker image (hopefully) coming soon!

Scheduling

Now that you have it configured so that everything is working properly, you can use a cronjob to schedule the script to run automatically.

Here's an example of running the script every day at 4am:

Bash Scheduling

# Run the Sonarr Episode Name Checker script
0 4 * * * /home/tronyx/scripts/SonarrEpisodeNameChecker.sh

Powershell Scheduling

# Run the Sonarr Episode Name Checker script
0 4 * * * /home/tronyx/scripts/Powershell/SonarrEpisodeNameChecker.ps1 -renameSeries $true

Questions

If you have any questions, you can find me on the Organizr Discord.

About

Bash and Powershell scripts to check for episodes named "Episode ##" or "TBA"

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project