[@Deprecated] How about sharing your CLI scripts?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[@Deprecated] How about sharing your CLI scripts?

Post by rednoah »

@Deprecated Whatever it is you're trying to do, these scripts here are probably not a good solution, and the amc script (hourly with --def excludeList) is always the best option for any sort of automation task.

:idea: Almost all downloaded applications support calling a command-line tools on completed downloads, so you could just hook up that up with the amc script, and this way of doing things should always be preferred over the watcher script here.

Description:
  1. Hook into the OS and receive File modification events. Start organizing files once there are no changes for more than 5 seconds
  2. The script supports extracting archives, downloading subtitles and organizing video files. Each feature can be enabled or disabled by setting or not setting the -extract, -get-subtitles and -rename command-line flags.
Usage:

Code: Select all

filebot -script fn:watcher -extract -rename /path/to/completed/ --output /final/destination/ --db TheTVDB
:!: This script is console-interactive so you must not redirect I/O, otherwise the script will end it's run immediately.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Filename: Find & Replace

Post by rednoah »

Description:
Regular-expression based mass-rename utility, FileBot style! Find & Replace is applied to the absolute path and not just the filename so you can restructure your folder hierarchy as well.

Simple Usage:

Code: Select all

filebot -script fn:replace --def "e=.eng.srt" "r=.srt" /path/to/files
Advanced Usage:

Code: Select all

filebot -script fn:replace --action copy --filter "[.]srt$" --def "e=[.](eng|english)" "r=.en" /path/to/files
Options:
--action test only print files that would be moved/copied
--conflict override allow override destination file if it already exists, otherwise it'll be skipped
--filter pattern process only files matching the given pattern
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Rename All Media Folder by Folder

Post by rednoah »

@Deprecated Normal users should use filebot -rename -r calls (for simple tasks) or amc script calls (for complex tasks) instead of the renall script. The renall script only serves as an example for script developers.


Description:
This simple rename script will run through all folders and rename process everything folder by folder. It's pretty much like running filebot -rename <folder> for each folder. There is series/movie detection but it's very basic, so it's recommended to force a specific mode via setting --db <datasource>.

Rename episode or movie files:

Code: Select all

filebot -script fn:renall "path/to/media" -non-strict --format "{home}/Media/{plex}"
Rename movie folders:

Code: Select all

filebot -script fn:renall "path/to/movies" -non-strict --format "{home}/Movies/{ny}" --db TheMovieDB --def target=folder
It's highly recommended to first do a dry-run in TEST MODE and see what would happen. Here's the options for that:

Code: Select all

--action test --log info
Options:
--def target=folder rename movie folders as a single unit (i.e. treat movie folders as if they were movie files)
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Revert Renamed Files to their Original Names

Post by rednoah »

@Deprecated Normal users should use filebot -revert calls. The revert script only serves as an example for script developers.


Description:
FileBot keeps an internal history of all rename operations in case you want to revert files to their original names. Run this script on the specified file or folder and revert all files to their original names.

Copy files to their original paths:

Code: Select all

filebot -script fn:revert --action copy /path/to/files
Options:
--action revert operation (--action move will move files back to their original location, --action rename will only change the filename back to the original filename but keep the file in it's current folder. You may run the script in test mode via --action test)

Notes:
  • This script assumes that files have previously been processed with --action move/copy
  • This script does not support symlinks
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

MyEpisodes.com Integration

Post by rednoah »

Description:
Here's a script for automatically updating your MyEpisodes profile. On http://www.myepisodes.com you can keep track of your favorite shows, what episodes you have already aquired/watched and quickly check just how much time you've been wasting on watching TV. If your files are already reasonably well-named you can just run this script and it will add all your shows that are not on your list yet and tick each episode you have as 'acquired'.

Add shows and mark episodes as 'acquired':

Code: Select all

filebot -script fn:update-mes "X:/path/to/episodes" --def login=user:pwd addshows=y
Options:
--def addshows=y|n auto-add new shows to your list or just ignore any show that is not on your list
--def tick=acquired|seen define whether episodes should be ticked as 'acquired' or 'watched'
:idea: Please read the FAQ and How to Request Help.
Post Reply