Board index Scripting and Automation [GUIDE] Fully Automated Media Center with Transmission (Mac)

[GUIDE] Fully Automated Media Center with Transmission (Mac)

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc

buck3y3 Donor

Posts: 37
Here's how to set up the Fully Automated Media Center script with Transmission.

1. Create transmission-postprocess shell script

Open terminal
Type cd desktop (this will create the file on your desktop, if you want to leave it in your home file skip this step)
Type nano transmission-postprocess
Image

This will bring up nano, a text editor, then copy & paste:
#!/bin/bash
/Applications/Filebot.app/Contents/MacOS/filebot.sh -script fn:amc --output "path/to/folder" --log-file amc.log --action copy --conflict override -non-strict --def artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"

Image

Set where processed files should be organized to:
Fully Automated Media Center wrote:
2. Change --output to where you want to copy/organize your files. Input is provided by µTorrent variables.


Control + X
Enter Yes to save file
Hit enter to save file as named

This will create a file on your desktop that looks like this:
Image

In terminal type chmod +rx transmission-postprocess and hit enter, it will look like nothing happened
Image

but it will change the file on your desktop to:
Image


2. Setup Transmission to call our shell script on download complete

Now open transmission preferences and set it to call your newly created script at download complete
Image

3. Done


Posts: 24
Hi there,

I've been trying get get this automatic script working on my media center setup without much luck... I've tried, sort of reverse engineering it to match my setup, and without much luck ...

Basically this is my setup and the process i want it to follow...

on a mac mini 2011 model with external Pegasus Raid storage (for media storage)

Current flow:
I add torrents to Transmission
Transmission places unfinished download in an "Active Downloads" folder on the Pegasus
When completed it moves them to the path "/Volumes/PROMISE PEGASUS/Completed Downloads"
There are two folders i then manually sort the downloads into depending on what they are
/Volumes/PROMISE PEGASUS/Movies
/Volumes/PROMISE PEGASUS/Series

I'm looking to automate this process, and so far after much googling not much like... FileBot with this script from what i can tell will do it... but i'm, due to lack of scripting experience, unable to get it working... I was wondering if there was some kind soul out there that can put me out of my misery lol...

basically i want to add torrents to Transmission, then it to put them in Active Downloads, then when finished move them to Completed Download and run a script.
The script will then run FileBot and organise the TV shows into the Series folder in the format
/Volumes/PROMISE PEGASUS/Series/"ShowName" (YearStart)/Season "0"/"Showname" S00E00 - "EpisodeTitle".ext
and movies into the Movies folder in the format of
/Volumes/PROMISE PEGASUS/Movies/"MovieName" ("YearRelease")/"MovieName" ("YearRelease").ext
then after that's complete it'll tell Plex, hey new stuff to add...

Help me ObiWan Kenobi you're my only hope :(

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

Did you try setting it up exactly has this tutorial shows? It takes 5 minutes and works as it is. Your paths will be a bit different that's all.

Once that's working you can worry about whatever doesn't work with your specific setup.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
yep... got that working now... its just modifying it to fit my setup is making my head hurt lol... doesn't help either i've only just ported to mac from windows, so finding my way around is alittle hard :P...

I feel lazy for asking, but i was wondering if someone could mod the script for me... me trying seems to just make things not work again... scripting in this manner and on mac is really alien to me :S

the original process is half there
1 Unrar archives
2 Group movies and episodes and then handle them seperately (auto-detect episode-vs-movie file)
3 Fetch subtitles and transcode to SubRip/UTF-8 (i take it that if it detects them already downloaded it will use them)
4 Copy and Organize episodes, movies and music files into folders and rename files properly
Movies will be sorted into {output}/Movies/Name (Year)/Name (Year) 720p [CD123].ext
TV Shows will be sorted into {output}/Series/Name (Year First Aired)/Season Number/Name - S00E00 - Title 720p.ext
No need for music with my setup
no need to Fetch artwork or generate .nfo files as i'm happy with just plex doing that its end for wife proofing
Notify Plex (via HTTP on port 32400) to rescan it's video library
no need to Log into MyEpisodes
no need for Send a report about newly added files per email

i'd be beyond grateful for the help :) seriously would owe you one...

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

That's a perfectly normal use-case. You'll not need to touch the script. Just set some cmdline options.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
Lol don't I feel silly... Thought I had to rewrite it in the script... Got it working...
There's a not stupid question though... I want to take advantage of utorrents (on mac) ability to set a monthly total download limit... Would I follow the same steps above for transmission but just go into utorrent and tell it to start the script just made...

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

Yep, there's a setup instructions for transmission. Works pretty much the same. Just that you need a shell script in between that calls filebot and passes on the transmission parameters. Check the amc thread.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
Sorry I meant I want to set this up for utorrent on the mac

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

As far as I know utorrent for mac doesn't support the "run program on download complete" feature. Maybe check in their forums.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
yeah had a look there... doesn't seem too... whats so special about windows that they get the features first :(...
hey to your knowledge is there a way to maybe get Transmission to stop at a specified monthly limit... i did some googling without much luck and figure you might have heard of something...

hey thanks for the help too... i got that script working perfectly with transmission now... after i realised how to do it right lol


Posts: 24
I'm having trouble with the email function... It's freezing the script at my password as there's a ! in it... The line says -bash !************ event not found...


Posts: 24
i'm also having issues with my subtitles labels... basically want the subtitles language on the sub files so plex can determine the language instead of saying unknown... heres my code I've been passing in terminal manually to test the functions...

#!/bin/bash
/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc "/Volumes/PROMISE PEGASUS/Completed Downloads" --output "/Volumes/PROMISE PEGASUS" --action copy --conflict override -non-strict --def artwork=n subtitles=en,de,fr "seriesFormat=Series/{n} [{y}]/Season {s}/{n} - {s00e00} - {t} [{vf}]{\".$lang\"}" "animeFormat=Anime/{n} [{y}]/{n} [{y}] [{vf}]{\".$lang\"}" "movieFormat=Movies/{n} [{y}]/{n} [{y}] [{vf}]{\".$lang\"}" "musicFormat=Music/{n}/{fn}" plex=te5s3rakt clean=y


i notice it leaves all the original files and folders in the completed downloads folder... how can i get it to clean out the folder from everything it sorted into the movies and series folders... --action move maybe?

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

--action copy obviously copies files. You can always test things with --action test and the finally move things with --action move.

I don't know what your issues are with language tags, but since you're already adding {lang} I guess you'll be fine.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
Still having an issue with the email log support...

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

Change your password. Or read the docs on bash on how to escape !
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
Using just {lang} it displays on the end of my subtitle only files... But how would I format it to create subtitle files in the format (example) "Iron Man [2008].eng.srt" currently it displays only "Iron Man [2008]eng.srt"

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

Everything you're asking has been answered multiple times before and you can easily find the solution by looking and understanding the examples:
viewtopic.php?f=5&t=2
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 24
got it now... the expression {".$lang"} on the forum I've been trying overrides the moving of the files to the new directory... using / in it like this {\".\$lang\"} fixed the issue and allowed the script to run as designed...

with plex=hostname... how would you define the hostname... using just the friendly name from the plex media server settings, being te5s3rakt in my case returns UnknownHostException: te5s3rakt testing in terminal

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

Yeah, just the hostname should work ideally. If you have network issues you can try setting the IP.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 2
Hello,
First of all, you are a f*** genius, I discovered this program and it's totally amazing!

I've seen this topic and it seems to be what I really need, but I think I need a mix of the two examples explained here:

[color=#FF0000]#!/bin/bash
/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc --output "path/to/folder" --log-file amc.log --action copy --conflict override -non-strict --def artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"[/color]


and

[color=#0000FF]#!/bin/bash
/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc "/Volumes/PROMISE PEGASUS/Completed Downloads" --output "/Volumes/PROMISE PEGASUS" --action copy --conflict override -non-strict --def artwork=n subtitles=en,de,fr  "musicFormat=Music/{n}/{fn}" plex=te5s3rakt clean=y[/color]



Because what I want is to copy the movies/Tvshows to my NAS, but downloading them from Transmission (so using transmission variables, not the "Completed downloads, as the second example.
So could I use a mixture of both? SOmething like this?


[color=#FF0000]#!/bin/bash
/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc --output "path/to/folder" --log-file amc.log --action copy --conflict override -non-strict --def artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"[/color] [color=#0000FF]"seriesFormat=Series/{n} [{y}]/Season {s}/{n} - {s00e00} - {t} [{vf}]{\".$lang\"}" "animeFormat=Anime/{n} [{y}]/{n} [{y}] [{vf}]{\".$lang\"}" "movieFormat=Movies/{n} [{y}]/{n} [{y}] [{vf}]{\".$lang\"}"[/color]



And I have another question, how can I set filebot to organize movies in Spanish and Tv shows and anime in english?

Thank you very much!!

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

1. I see no issues with that. Input is either passed in via arguments or via ut_dir/ut_file options. Here's all the docs on my amc script: viewtopic.php?f=4&t=215

2. Can't use different languages for different rename calls by default. You'd have to modify the script for that.
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 2
Thank you,

I finally got it working by doing this:

/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc --output "/Users/mama/Torrent/Series" --log-file amc.log --action copy --conflict override -non-strict --def artwork=y "seriesFormat=Series/{n}/Season {s}/{n} ({y}) - {sxe} - {t}" "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"



You told me that to change the default language I would have to modify the script, ¿where is it? Any idea on what do I have to modify?

Thank you.

sleepybear Power User

Posts: 6
First you would need to download the script:

http://filebot.net/scripts/amc.groovy

Then change your CL option from -script fn:amc to -script /path/to/script/amc.groovy

Now you can modify your custom version of the script to do whatever your please. Keep in mind the script will now NOT automatically update, which it does with the fn:amc option.


Posts: 1
Hi!

How do I modify this script to NOT pass/manage ISO files? It tries to match/rename/move my game downloads into my movie/TV folders every time, which is, of course, unacceptable.

Thanks!

rednoah User avatar
The Source

Posts: 4663
Location: Taipei

Add an ignore rule for iso files.

eg:
--def "ignore=iso"
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image

Next

Return to Scripting and Automation