Overview
The amc script will automatically organize your media. It's a simple command-line tool that can be called manually or by other tools on one or many files. It'll fully automatically organize your TV shows and movies and is smart enough to detect what is what. The script will only touch video / subtitle files and will leave everything else as is.- Unrar archives
- Group movies and episodes and then process them accordingly
- Fetch subtitles and transcode them to SubRip / UTF-8
- Organize movies, episodes and music files into a new file and folder structure according to the {plex.id} format naming scheme:
- Movies will be sorted into {output}/Movies/Name (Year) {tmdb-id}/Name (Year).ext
- Episodes will be sorted into {output}/TV Shows/Name {tmdb-id}/Season N/Name - S00E00 - Title.ext
- Music will be sorted into {output}/Music/Artist/Album/Artist - Title.ext
- Fetch artwork and generate .nfo files
- Notify Plex, Kodi or Emby to refresh the video library
- Send a report about newly added files via Email or PushBullet
Setup Instructions
1. Set Location of Downloaded Files and make sure to move complete downloads into a separate folder.2. Set Run Program to make your download program call filebot on newly completed downloads. Please follow the setup instructions for your specific download program.
e.g. qBT ➔ Options ➔ Downloads ➔ Run an external program on torrent completion:
Shell: Select all
filebot -script fn:amc --output "X:/Media" --action duplicate --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes --def unsorted=y music=y artwork=y "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F"
Shell: Select all
filebot -script fn:amc --output "X:/Media" --action duplicate --conflict skip -non-strict --log-file amc.log --def unsorted=y music=y artwork=y "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"
4. Done! This took take less than a minute. Now wait and enjoy how things will be organized fully automatically.
Run from the command-line
Want to try it out first? Running directly from command-line is even easier and if you set --action test you can do a dry-run and see if everything gets matched up correctly:Shell: Select all
filebot -script fn:amc "/path/to/input" --output "/path/to/output" --action duplicate -non-strict --log-file amc.log --def excludeList=amc.txt
- If you run this script manually, you can set --mode interactive to enable console-interactive mode.
- If you run this script automatically in intervals every hour or every day, then you must set --def excludeList or you will get banned.
Options
--def music=y Process music files--conflict skip Never overwrite existing files
--conflict auto Do overwrite existing files if new files are better
--def subtitles=en,de,fr Download subtitles
--def artwork=y Fetch artwork and generate nfo files
--def plex=host:token Rescan Plex library (see authentication token)
--def kodi=host:port Rescan Kodi library
--def emby=host:apikey Rescan Emby library
--def jellyfin=host:apikey Rescan Jellyfin library
--def pushbullet=apikey Send report via PushBullet
--def pushover=userkey Send notification via Pushover
--def discord=webhook Send notification via Discord (NOTE: Linux and macOS users may prefer the send-discord-log shell script to capture and send console output)
--def gmail=username:password Send report via Gmail (see App Password)
--def mail=host:port:from:username:password Send report via SMTP (NOTE: Linux and macOS users may prefer the send-email-log shell script to capture and send console output)
--def mailto=email Send Email report to this address
--def reportError=y Send Email report on error
--def storeReport=/path/to/folder Save reports
--def extractFolder=/path/to/folder Extract archives to this folder
--def skipExtract=y Skip archives
--def deleteAfterExtract=y Delete archives after extraction
--def clean=y Delete left behind empty folders and clutter files
--def exec="echo {quote f}" Run program on newly processed files (NOTE: use {quote f} to correctly escape file paths that contain spaces, parentheses, apostrophes, etc)
--def unsorted=y Process unidentifiable files (as opposed to skipping them) and move them to the Unsorted folder
--def ignore=regex Ignore file paths
--def minLengthMS=0 Skip short videos (in milliseconds; 10 minutes by default)
--def minFileSize=0 Skip small files (in bytes; 50 MB by default)
--def minFileAge=3 Skip recently created files (in days; 0 by default)
--def excludeLink=y Skip symlinks and hardlinks where the link count is more than 1
--def excludeList=amc.txt Keep a list of already processed file paths to be skipped in future runs (NOTE: enable this if you process the same folder repeatedly)
Change how files will be organized and renamed
This script uses multiple format expressions, one for each content type. You can override the default naming schemes via the --def movieFormat, seriesFormat, animeFormat and musicFormat options. Relative paths will be resolved against --output and you can use absolute paths if you want to use multiple drives.Shell: Select all
--def movieFormat="M:/Movies/{ ~plex }" seriesFormat="S:/Series/{ ~plex }" animeFormat="J:/Anime/{ ~plex }" musicFormat="T:/Audio/{ ~plex }" unsortedFormat="U:/Unsorted/{ fn }"
- Start with the {plex} format and then modify your custom format bit by bit to fit your needs. Make sure to prototype your custom format with the Format Editor and not on the command-line.
- Use @file syntax to read complex arguments from a text file.
Change database for each content type
This script uses multiple databases, so the simple --db option is not supported. You can override the default database via --def movieDB, seriesDB, animeDB and musicDB options for each content type.Shell: Select all
--def movieDB=TheMovieDB seriesDB=TheMovieDB::TV animeDB=TheMovieDB::TV musicDB=ID3
Common Problems
- Location of Downloaded Files (input and --output folder) must not end with backslash \ the final backslash \ will escape the subsequent double-quote " and mess up everything. Please use / as separator and not \ because the latter is also used to escape characters. (see Cmdline and Argument Passing)
- You can (and should) force Movie / Series / Anime mode or force ignore files via labels, e.g. label as Movie to force Movie mode, Series to force TV Series mode, Anime to force Anime mode, or other to ignore all files. Alternatively, standard folder names such as Movies / TV Shows / Anime may also be used to force a specific mode.
- Anime are inherently TV Shows, so Anime will be detected as Anime and processed in Anime mode if and only if the files have Anime-like characteristics.
- You must not use your input folder %D as --output folder.
- You must not use the filesystem root (e.g. X:\ or /) as input or --output folder.
- You must restart your computer after installing FileBot to propagate the %PATH% environment variable to all running processes. (e.g. uT won't be able to find the filebot command if FileBot was not yet installed and added to the %PATH% at the time when uT was launched)
Advanced Fine-Tuning
You can (and should) force Movie / Series / Anime mode by setting --def ut_label, and you can further define your own --filter rules to fine-tune matching to your exact needs, and avoid mismatches. For example, if one show is confused with another due to bad naming or missing data you can simply exclude the bad one, or if you only process recently aired episodes, then you could exclude episodes that have not aired recently from matching.e.g. if you only ever process recently aired episodes (i.e. not movies, not episodes from previous seasons, etc) then you can virtually guarantee 100% auto-detection accuracy by adding simple filter rules such as these:
Shell: Select all
--filter "age < 5" --def "ut_label=TV"
Shell: Select all
--filter "age < 5 || 5 <= model.age.min()" --def "ut_label=TV"
Troubleshooting
If something is not working, please read the Notes above, then run the command manually in a new console window to see what is happening. You CANNOT run the command without replacing the VARIABLES. The variables have to be replaced with actual values first.e.g.
Shell: Select all
filebot -script fn:amc --output "D:/Organized Media" --log-file amc.log --action duplicate --conflict override -non-strict --def "ut_dir=D:\Media\Avatar" "ut_file=" "ut_kind=multi" "ut_title=Avatar" "ut_label=" "ut_state=5"
Use @file syntax to refactor command-line arguments (not including variables or substitution patterns) into external text files:
Shell: Select all
filebot @X:/args.txt --def "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"
Configure filebot to dump command-line arguments to the log file before processing so you can see how filebot is called by 3rd party programs:
Shell: Select all
filebot -script fn:properties --def net.filebot.logging.debug=INFO
Logs
Please check the log once in a while:Shell: Select all
filebot -script fn:logs