FileBot

FileBot is the ultimate tool for organizing and renaming your movies, tv shows or anime, and music well as downloading subtitles and artwork. It's smart and just works.

Installation in Ubuntu Linux
Latest 4.5.6

Grab the package from http://www.filebot.net/#download, then...

sudo aptitude install openjdk-7-jre-headless sudo dpkg -i /path/to/filebot_4.5.6_amd64.deb

Test...

filebot -help FileBot 4.5.6 (r2818) / Java(TM) SE Runtime Environment 1.8.0_40

Naming Files / Format Expressions
{n.space('_')}_{s00e00} = TV_Show_Title_S01E01

http://www.filebot.net/naming.html

Usage
This is the best order to do the operations shown below...


 * 1) Subtitles
 * 2) Renaming
 * 3) Artwork

Subtitles
Register

http://www.opensubtitles.org/en/

Login

http://www.opensubtitles.org/en/login/

Configure

filebot -script fn:osdb.login Enter OpenSubtitles username: Enter OpenSubtitles password: Testing OpenSubtitles... OK Done ヾ(＠⌒ー⌒＠)ノ

Test

filebot -get-subtitles /path/to/movie --q "Avatar" --lang en --output srt --encoding utf8 -non-strict

2. Renaming
With underscores for space...

filebot -rename --format "{n.space('_')}_{s00e00}" /path/to/videos

With spaces... (optimised for Kodi)

filebot -rename --format "{n} {s00e00}" /path/to/videos -non-strict

...and if you have a slightly differently named folder...

filebot -rename --format "{n.space('_')}_{s00e00}" --q "Stella 2012" --db thetvdb ~/Videos/TV/Stella/

http://www.filebot.net/cli.html

3. Artwork
This script will download all the necessary artwork and information for XBMC to make it index the database a LOT quicker...

banner.jpg fanart.jpg folder.jpg landscape.jpg logo.png poster.jpg tvshow.nfo

TV Show

filebot -script fn:artwork.tvdb /path/to/show/

Movie

filebot -script fn:artwork.tmdb /path/to/movie/

FlexGet + Transmission + Filebot Automation
Download the original amc.groovy file and tweak to your liking...

tvs:  tryQuietly{ seriesFormat } ?: TV/{n.space('_')}/{n.space('_')}_{s00e00},   // line 44

My tweaked lines...

def format = [ tvs:  tryQuietly{ seriesFormat } ?: TV/{n}/{n} {s00e00} , anime: tryQuietly{ animeFormat } ?: Anime/{n}/{n} - {sxe} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'").replacePart(', Part $1')} , mov:  tryQuietly{ movieFormat  } ?: Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"} , music: tryQuietly{ musicFormat } ?: '''Music/{n}/{album+'/'}{pi.pad(2)+'. '}{artist} - {t}''' ]

Test the script...

/usr/bin/filebot -script "/home/paully/Bin/amc_paully.groovy" --output "/home/paully/Videos" --log-file "/home/paully/.filebot/logs/amc_paully.log" --action copy --conflict override -non-strict --def subtitles=en artwork=y clean=y "ut_dir=/home/paully/Downloads/transmission/tv/Stalker.S01E06.720p.HDTV.X264-DIMENSION" "ut_kind=multi" "ut_title=Stalker.S01E06.720p.HDTV.X264-DIMENSION"

Create the following script called transmission_filebot.sh to run filebot using the amc.groovy file you just created...

# # { echo >>/home/paully/.filebot/logs/amc_paully.log /usr/bin/filebot -script "/home/paully/Bin/amc_paully.groovy" --output "/home/paully/Videos" --log-file "/home/paully/.filebot/logs/amc_paully.log" --action copy --conflict override -non-strict --def subtitles=en artwork=y clean=y xbmc=localhost "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
 * 1) !/bin/bash -x
 * 1) DEBUG
 * 2) HOME=/home/paully
 * 3) LOG=/tmp/$$.log
 * 4) exec > $LOG 2>&1
 * 1) LOG_FILE=/tmp/torrent_done.log
 * 2) echo "${TR_TORRENT_ID},${TR_TORRENT_DIR},${TR_TORRENT_NAME}" >>$LOG_FILE
 * 3) } &

Now stop transmission-daemon...

sudo service transmission-daemon stop

Edit the /etc/transmission-daemon/settings.json file...

sudo nano /etc/transmission-daemon/settings.json

Add or edit the lines...

"script-torrent-done-enabled": true, "script-torrent-done-filename": "/home/username/Bin/transmission_filebot.sh",

Now start transmission-daemon...

sudo service transmission-daemon start

http://www.filebot.net/forums/viewtopic.php?f=4&t=215#p3380

FileBot + XBMC

 * 1) You need to add the xbmc=localhost to the scripting command line.
 * 2) You need to download https://raw.githubusercontent.com/filebot/scripts/devel/lib/htpc.groovy and add it to a /lib/ folder.

e.g.

~/bin/lib/htpc.groovy

Rename Subtitle Filenames
Download the rename.groovy file to your ~/Bin/lib directory.

Then run the following command...

filebot -script fn:replace --def "e=.eng.srt" "r=.srt" /path/to/Videos/TV/show/

Thanks - https://www.filebot.net/forums/viewtopic.php?f=4&t=5#p2100