FileBot

From Indie IT Wiki
Jump to: navigation, search

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.

HOWTO: INSTALL:

Ubuntu Linux

Latest 4.7.8

Changelog

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

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

Test...

filebot -version
FileBot 4.7.2 (r4178) / Java(TM) SE Runtime Environment 1.8.0_91 (headless)
filebot -script fn:sysinfo
FileBot 4.7.2 (r4178)
JNA Native: 4.0.1
MediaInfo: MediaInfoLib - v0.7.69
7-Zip-JBinding: 9.20
Chromaprint: fpcalc version 1.1.0 (/usr/share/filebot/fpcalc)
Extended Attributes: OK
GVFS: OK
Groovy Engine: 2.4.7
JRE: Java(TM) SE Runtime Environment 1.8.0_91 (headless)
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 3 GB Max Memory / 22 MB Used Memory
OS: Linux (amd64)
Package: DEB
Data: /home/paully/.filebot
uname: Linux mythbuntu-server3 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Done ヾ(@⌒ー⌒@)ノ

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

HOWTO: SUBTITLES:

Downloading

Register

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

Login

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

Configure

filebot -script fn:configure

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

Date

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

If you have an error, try...

filebot -get-missing-subtitles ~/Videos/TV/The\ Expanse/ --q "The Expanse" --lang en --output srt --encoding utf8 -non-strict

Renaming

When you download subtitles in the manor above the will download in the format: show-name.language.srt i.e. Falling Skies S05E01.eng.srt

To rename them to match the the show name, i.e. show-name.srt undertake the following:

Download the replace.groovy file to your ~/Bin/lib directory.

Then run the following command (which goes on the internet and gets a current version):

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

If you have already downloaded the subtitle file you will need to run it locally using the replace.groovy file:

filebot -script /home/path_to/Bin/lib/replace.groovy --def "e=.eng.srt

Thanks to Filebot Forums.

Video File Renaming

Test before renaming...

filebot --action test -rename ... etc

With underscores for space...

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

With spaces... (optimised for Kodi and Plex)

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

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

https://github.com/filebot/scripts

Create the directories and download the scripts...

sudo mkdir -p /usr/local/bin/lib
cd /usr/local/bin/lib
sudo wget https://raw.githubusercontent.com/filebot/scripts/master/lib/htpc.groovy
cd /usr/local/bin
sudo wget https://raw.githubusercontent.com/filebot/scripts/master/amc.groovy
sudo wget https://raw.githubusercontent.com/filebot/scripts/master/replace.groovy

Test...

/usr/bin/filebot -script "/usr/local/bin/amc.groovy" --output "/path/to/Videos" --log-file "/tmp/amc.log" --action copy --conflict override -non-strict --def "seriesFormat=TV/{n}/{n} {s00e00}" "movieFormat=Movies/{n} ({y})/{n} ({y})" subtitles=en artwork=y clean=y "ut_dir=/path/to/Downloads/transmission/tv/TV.Show.S01E06.720p.HDTV" "ut_kind=multi" "ut_title=TV.Show.S01E06.720p.HDTV"

Create the following script called /usr/local/bin/transmission_filebot.sh to run filebot using the amc.groovy file...

#!/bin/bash
HOME=/zfs/zpool1/
/usr/bin/filebot -script "/usr/local/bin/amc.groovy" --output "/zfs/zpool1/Videos" --log-file "/tmp/amc.log" --action copy --conflict override -non-strict --def "seriesFormat=TV/{n}/{n} {s00e00}" "movieFormat=Movies/{n} ({y})/{n} ({y})" artwork=y clean=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"

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": "/usr/local/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

Troubleshooting

ERROR: ClassCastException: Cannot cast java.lang.String to

filebot -clear-cache

Thanks - https://www.filebot.net/forums/viewtopic.php?f=13&t=3815

Environment Variables

filebot -script "g:println System.getProperty('user.name')"