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

Running FileBot from the console, Groovy scripting, shell scripts, etc
Heather
Posts: 4
Joined: 19 Dec 2014, 22:19

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by Heather »

I have been working on getting this script to work for me for at least 2 days now, and just when I thought I had it, I'm still getting nowhere :?

I'm running OSX Yosemite, 64-bit Java 8, and the latest stable release of FileBot GUI installed with brew. I'm very much a beginner and all of my experience using coding and terminal has previously been just copying and pasting things that worked (ex. installing Homebrew and then FileBot using brew).

My script (which I built following the directions shown in this thread and in http://www.filebot.net/forums/viewtopic ... =215#p3380 is this:

Code: Select all

#!/bin/bash
/Applications/FileBot.app/Contents/MacOS/filebot.sh -script fn:amc \
--output “/Volumes/Data-1” \
--log-file "/Users/hpadaetz/Documents/Scripts/amc.log" \
--action copy \
--conflict override -non-strict \
--def artwork=y cleaner=y “ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
I have verified that Transmission is calling the script upon download completion, but that FileBot is saying that no file is selected for processing.

Code: Select all

Parameter: artwork = y
Parameter: cleaner = y
Parameter: ut_dir = /Users/hpadaetz/Downloads/John Legend - All of Me.mp3
Parameter: ut_kind = multi
Parameter: ut_title = John Legend - All of Me.mp3
Exclude: /Users/hpadaetz/Downloads/John Legend - All of Me.mp3
No files selected for processing
Failure (°_°)
I tried running a modified version of the code, changing the input to an exisiting file, from the command line and I get a similar, if not identical, result.

Code: Select all

Parameter: artwork = y
Parameter: cleaner = y
Argument: /Users/hpadaetz/“Users/hpadaetz/Downloads/At.Midnight.2014.12.18.EXTENDED.UNCENSORED.WEBRip.x264.AAC.mp4“
File not found: /Users/hpadaetz/“Users/hpadaetz/Downloads/At.Midnight.2014.12.18.EXTENDED.UNCENSORED.WEBRip.x264.AAC.mp4“
Failure (°_°)
I have used the actual FileBot application to rename files (actually, the one shown above that failed the code) and had no problems. I ran fn:sysinfo and this is what I get:

Code: Select all

Heathers-MacBook-Pro-2:~ hpadaetz$ /Applications/FileBot.app/Contents/MacOS/filebot.sh -script fn:sysinfo
FileBot 4.5.3 (r2729)
JNA Native: 4.0.0
MediaInfo: MediaInfoLib - v0.7.69
7-Zip-JBinding: OK
chromaprint-tools: fpcalc version 1.1.0 (/Applications/FileBot.app/Contents/MacOS/fpcalc)
Extended Attributes: OK
Groovy Engine: 2.3.7
JRE: Java(TM) SE Runtime Environment 1.8.0_25
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 1 GB Max Memory / 188 MB Used Memory
OS: Mac OS X (x86_64)
uname: Darwin Heathers-MacBook-Pro-2.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Done ヾ(@⌒ー⌒@)ノ
Heathers-MacBook-Pro-2:~ hpadaetz$ 
Not sure where the problem is, as I can't really see anything wrong compared to the working scripts others have submitted, but, as I said, I am definitely a newbie. I apologize for the length, but I wanted to make sure I provided all the necessary information. Thanks in advance :D
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1.
FileBot should be called using the "filebot" command.

2.
The amc script does not process audio files by default. You must explicitly activate that feature. See manual.

3.
““ are surely not valid file path characters, and it's surely not the same as "".

Learn some basic console skills:
viewtopic.php?f=4&t=1899
:idea: Please read the FAQ and How to Request Help.
Heather
Posts: 4
Joined: 19 Dec 2014, 22:19

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by Heather »

Thank you for your reply, though the information isn't really helping.

1. I know I'm not the first to point this out, but calling filebot as just filebot does not work in OS X.
peanutismint wrote:p.s.
rednoah wrote:I don't know when /Applications/Filebot.app/Contents/filebot.sh got a thing, but that's a pretty stupid way to call a cmdline tool. It's just filebot in all the examples because it literally is just filebot. You call filebot by calling filebot. Like exactly any single one of my examples, and it works the same on all platforms. That's how cmdline tools work. :D
It 'got [to be] a thing' because 'just Filebot' doesn't work under OS X :) Although you'll probably say it DOES work, we're just not doing it right because we're all obviously dumb....!! ;)
Calling it as you suggest results in this:

Code: Select all

Heathers-MacBook-Pro-2:~ hpadaetz$ filebot -script fn:sysinfo
-bash: filebot: command not found
Heathers-MacBook-Pro-2:~ hpadaetz$ 
2. Please link the manual that you are referencing, as I can't find any information that states that the script does not process audio. The amc manual here:viewtopic.php?f=4&t=215#p1561 doesn't note this and actually lists music as an existing function in #4 of the description. I can't find anything in this manual http://www.filebot.net/forums/viewtopic.php?f=3&t=7 either. Also, this doesn't explain the difficulties in the other example provided that used a video file. EDIT: I found the option for music under options in the manual. It might be a good idea to note this separately or earlier on, as I'm sure it's a popular option and kind of buried there with everything else. The way it's written now, the guide makes it seem like it does music without telling it specifically to and that the options are just for processing and naming preferences.

3. Thank you for pointing out the issues withe quotes, something happened to the font between various cutting and pastings. After rewriting the script from scratch (and without copy/pasting to avoid font changes) with this change, transmission now isn't calling the script at all :cry:

Overnight, after an automatic download of a file, the original script was activated with a slightly different outcome than before, though still not working.

Code: Select all

Parameter: artwork = y
Parameter: cleaner = y
Parameter: ut_dir = /Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]
Parameter: ut_kind = multi
Parameter: ut_title = Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]
Input: /Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV.mkv
Exclude: /Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]/BookmarkAndRead.txt
Exclude: /Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]/Sample/sample-saturday.night.live.s40e10.amy.adams-one.direction.720p.hdtv.x264-batv_s.jpg
Exclude: /Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]/saturday.night.live.s40e10.amy.adams-one.direction.720p.hdtv.x264-batv.nfo
Group: [tvs:saturday night live] => [Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Saturday Night Live]
Fetching episode data for [Saturday Night Live]
Fetching episode data for [Saturday Night Live (JP)]
Fetching episode data for [Saturday Night Live (Korea)]
[COPY] Rename [/Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV.mkv] to [/“/Volumes/Data-1”/TV Shows/Saturday Night Live/Season 40/Saturday Night Live - S40E10 - Amy Adams One Direction.mkv]
[COPY] Failed to rename [/Users/hpadaetz/Downloads/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV[brassetv]/Saturday.Night.Live.S40E10.Amy.Adams-One.Direction.720p.HDTV.x264-BATV.mkv]
IOException: Failed to create folder: /“/Volumes/Data-1”/TV Shows/Saturday Night Live/Season 40
Finished without processing any files
Failure (°_°)
 
I see that it failed at creating the new folder. Is that because of the issue with the italicized quote, or does that part of the code need to be changed from "/Volumes... to just Volumes... since it seems the script is adding in a / before it anyway. /Volumes/Data-1 is an Apple Time Capsule that is always connected and is also used as the network router. As it is 2TB, barely half full, and the internet was working, it wasn't the disk that failed.

EDIT:

Transmission wasn't calling the new script because I forgot to capitalize the B in FileBot when calling the command when I rewrote the script :roll: I fixed that and now it calls the new script:

Code: Select all

#!/bin/bash
/Applications/FileBot.app/Contents/MacOS/filebot.sh -script fn:amc \
--output "/Volumes/Data-1" \
--log-file "/Users/hpadaetz/Documents/Scripts/amc.log" \
--action move \
--conflict override -non-strict \
--def artwork=y music=y cleaner=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME" 
But it still wouldn't work. I altered the output to a directory on my hard drive instead of an external one, and that worked, so the issue isn't with the script itself, but with FileBot creating the new folder on the external drive. I tried creating an alias for the external drive in my user folder and sending the file to that instead, but that results in the same error.

Code: Select all

Parameter: artwork = y
Parameter: cleaner = y
Parameter: ut_dir = /Users/hpadaetz/Downloads/Family.Guy.S13E01.HDTV.x264-2HD.mp4
Parameter: ut_kind = multi
Parameter: ut_title = Family.Guy.S13E01.HDTV.x264-2HD.mp4
Input: /Users/hpadaetz/Downloads/Family.Guy.S13E01.HDTV.x264-2HD.mp4
Group: [tvs:family guy] => [Family.Guy.S13E01.HDTV.x264-2HD.mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [Family Guy]
Fetching episode data for [Family Guy]
Fetching episode data for [Family Guns]
[MOVE] Rename [/Users/hpadaetz/Downloads/Family.Guy.S13E01.HDTV.x264-2HD.mp4] to [/Users/hpadaetz/Data/TV Shows/Family Guy/Season 13/Family Guy - S13E01 - The Simpsons Guy.mp4]
[MOVE] Failed to rename [/Users/hpadaetz/Downloads/Family.Guy.S13E01.HDTV.x264-2HD.mp4]
IOException: Failed to create folder: /Users/hpadaetz/Data/TV Shows/Family Guy/Season 13
Finished without processing any files
Failure (°_°)
.

I need the files to be moved to my external drive, because that's where all the files for my media server are, and to avoid taking up too much space on my hard drive. How do I fix this issue? I tried creating a workflow in automator to move files from my hard drive after the script puts them there, but I can't seem to figure out how to have it watch the folder and move them as they are added. Is there another program or script for this? Or a way to make FileBot write to the external drive?
[/color]

Thanks again for your help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1.
You did not install filebot using brew. If you "install" it manually you need to create the necessary symlinks.

2.
Music mode has been deactivated by default by popular request, also it doesn't really work that well, depending on what you're throwing at it.

3.
Google is a good place to start when dealing with permission issues. ;)
:idea: Please read the FAQ and How to Request Help.
Heather
Posts: 4
Joined: 19 Dec 2014, 22:19

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by Heather »

1. I'm not sure how you determined that I didn't install using brew, as I'm pretty sure I did, as I said in the original post.

Code: Select all

Heathers-MacBook-Pro-2:~ hpadaetz$ brew update && brew cask install filebot
Checking out files: 100% (1547/1547), done.
Updated Homebrew from a73ec7bd to 70589599.
==> New Formulae
abi-compliance-checker	   carthage		      game-music-emu
asciinema		   distribution		      gauge
==> Updated Formulae
abcm2ps			   gnutls		      nginx
apache-spark		   golo			      node
arangodb		   gpg-agent		      nrpe
autojump		   graphicsmagick	      open-mpi
bfg			   gwyddion		      open-scene-graph
boot2docker		   haproxy		      openexr
bup			   id3lib		      openssl
capnp			   inkscape		      optipng
cardpeek		   jansson		      orientdb
clhep			   jemalloc		      osquery
clib			   jigdo		      pandoc
couchdb-lucene		   ksh			      passenger
cyassl			   l-smash		      pidgin
dirmngr			   libbpg		      plantuml
disktype		   libcouchbase		      postgresql
dnsmasq			   libgit2		      pulse
docker			   libimobiledevice	      pure
dub			   libmagic		      pypy
ejabberd		   libmemcached		      pypy3
elasticsearch		   libowfat		      python
emscripten		   librsvg		      re2
entr			   libspatialite	      redis
epubcheck		   llvm			      saltstack
f3			   log4c		      sdl
fakeroot		   luajit		      shadowsocks-libev
fastbit			   mat			      skinny
fossil			   maven		      sslmate
freeswitch		   memcached		      storm
geographiclib		   mercurial		      sync_gateway
geoipupdate		   mitmproxy		      syncthing
git			   mkvdts2ac3		      tcpreplay
git-tf			   mozjpeg		      upnp-router-control
glm			   mpd			      vcprompt
global			   nagios-plugins	      wget
gmtl			   ncp			      x3270
gnuplot			   netpbm		      youtube-dl
Warning: A Cask for filebot is already installed. Add the "--force" option to force re-install.
Heathers-MacBook-Pro-2:~ hpadaetz$ 
2. It probably would be a good idea to note somewhere that music mode is deactivated, instead of listing it in the features, then.

3. Considering I know that I as a user have read & write permissions to this disk and have no problem with renaming items that are on this disk using the filebot app, I'm not sure how this is a permissions issue.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1.
The brew install should create a symlink "/usr/local/bin/filebot" to somewhere in brew managed folders which is most certainly NOT in /Applications

e.g.

Code: Select all

$ filebot -script fn:sysinfo
FileBot 4.5.3 (r2729)
JNA Native: 4.0.0
MediaInfo: MediaInfoLib - v0.7.69
7-Zip-JBinding: OK
chromaprint-tools: fpcalc version 1.1.0 (/opt/homebrew-cask/Caskroom/filebot/4.5.3/FileBot.app/Contents/MacOS/fpcalc)
Extended Attributes: OK
Groovy Engine: 2.3.7
JRE: Java(TM) SE Runtime Environment 1.8.0_25
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 1 GB Max Memory / 171 MB Used Memory
OS: Mac OS X (x86_64)
2.
It's still a feature that many many people have figured out how to use. :D Plus main command-line template has --def music=y set by default. So you could have easily picked it up from there, or the options reference. I've added it to all the other command-line templates as well now though.

3.
Transmission may run as a different user, thus filebot runs as a different users, thus filebot does not have the same permissions you have. If Transmission is running sandboxed permissions will be more restrictive all together. FileBot can't create folders, that's how it is a permission issue.

Have you tried the Ignore ownership on this volume setting?
http://support.apple.com/kb/PH10670

Permission issues are tricky and never make sense. Google is you friend. ;)
:idea: Please read the FAQ and How to Request Help.
Heather
Posts: 4
Joined: 19 Dec 2014, 22:19

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by Heather »

I have it working now :D I had to change the output to a different partition of the external drive. Dragging and dropping the drive into the nano process created /Volumes/Data-1, but it should have been /Volumes/Data

Thanks for your help ;)
shamwich
Posts: 3
Joined: 23 Aug 2014, 05:47

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by shamwich »

Hi Heather, I had this issue too! You can fix the Disk Naming issue by checking your /Volumes directory (CMD+SHIFT+G then put in '/Volumes') for any folders with the same disk name. Delete that folder and eject/re-mount your disk and the name/path should be back to normal. (You will need to modify your AMC script again to remove the '-1' on your path.

Hope this helps!
peanutismint
Posts: 7
Joined: 29 Nov 2014, 22:14

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by peanutismint »

I'm now getting a new error (on a new install of Yosemite) - Every time the script is called and it tries to run FileBot, I get the standard annoying Java popup that says 'To view this web content, you need to install the Java Runtime Environment.', even though it IS installed and I can launch FileBot fine via clicking the icon....

Any ideas??
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

Like others here, I found that after installing the paid Mac App Store version of Filebot, the automation between Filebot and Transmission stopped working (I'm on Yosemite). My original workaround was to put back the older (non-app-store) version of Filebot. I went with that for a while, but today decided to give the app store version another shot -- once again it broke the transmission post-processing. Trying out some of the various suggestions in this thread and some of the other threads, here's what finally worked for me:

1) I left the newest Mac App Store version of Filebot in place in Applications -- even though it doesn't work with the transmission post-processing script due to the lack of the filebot.sh file commands. Still, at least this way I can have easy access to the app from Applications for the GUI, and the Mac App Store will keep the app conveniently up to date.

2) I followed all of the steps on this forum for installing the Homebrew version of Filebot. Thanks for the great directions -- normally I'm a bit scared of using Terminal, but this turned out to be pretty easy thanks to the clear and simple directions. (RE: http://www.filebot.net/forums/viewtopic.php?f=4&t=2049)

3) After this, the transmission post-processing still wasn't working, so I modified the #!/bin/bash filebot -script ... line to:

#!/bin/bash /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/MacOS/filebot.sh -script ...

And that worked!

The problem I'm anticipating, though, is that every time Filebot is updated from now on, I'm going to have to remember to update the path in the post-processing file. e.g., When Filebot is updated beyond version 4.5.6, presumably the path in Homebrew will change to /4.5.7/filebot.sh and will thus break the current transmission post-processing call?

Anyway, at last it's working again for the time-being!

(Also, what I haven't tried, but I'm wondering if it might work: Could we just manually drop a copy of the filebot.sh file into the Mac App Store version of Filebot.app/Contents/MacOS where it used to be ? That might be a lot easier, if it worked, compared to sending everyone off to Homebrew, which has additional dependencies.)

Sonarr + Transmission + Filebot + Plex = Greatest Media System Ever. Thanks all :)
peanutismint
Posts: 7
Joined: 29 Nov 2014, 22:14

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by peanutismint »

This is interesting... After going to Yosemite I'm back to not being able to get this to work and have yet to be bothered enough to try and fix it....!!

I'd assume you would end up changing your script to match your version folder, but this may not be an issue if you never update...Although FileBot may come with a pesky 'a new version is available...' popups.....!!

I'd be interested to know whether copying the 'filebot.sh' file into the paid version app package would work....

It's really annoying that there's not some much easier application for doing this kind of stuff on the fly!!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1)
brew will link filebot to /usr/local/bin/filebot so this will always be a link to the latest version. And since it's in /usr/local/bin it'll be in the $PATH by default you so can just call filebot.

2)
Apple does not allow CLI programs in the App Store. If you tamper with app bundles installed via the App Store you will break code signing so OSX won't allow you to run the app anymore.
:idea: Please read the FAQ and How to Request Help.
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

Regrettably, after a recent computer crash, this has stopped working for me again.

So I tried deleting the script and starting back over with the original instructions all over again. Then I reinstalled Filebot (homebrew) and checked that (it's working great), double checked java (all good), reinstalled Transmission (seems fine), and also tried dropping the absolute path from the script (my previous workaround that made everything work perfectly for a month):

#!/bin/bash /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/MacOS/filebot.sh -script

And instead I went back to:

#!/bin/bash
filebot -script fn:amc --output "/Users/path/example/etc" --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"

Didn't help though.

So then I checked the Transmission logs, and it shows that the script is called upon the completion of every torrent download.

And I tried running the script manually using direct paths. e.g.:

#!/bin/bash
filebot -script fn:amc --output "/Users/path/example/etc" --log-file amc.log --action copy --conflict override -non-strict --def artwork=y "ut_dir=example-folder/example-video-name" "ut_kind=multi" "ut_title=example-video-name"

And that works great too -- when I fill in the variables manually, Filebot quickly identifies the files, un-packs RARs, copies the files to the new folder, names it appropriately, downloads the art, etc., etc.....

So, it seems like something is going wrong in-between Transmission and Filebot -- maybe Transmission isn't sending the correct variables? Permission problems? I've spent a couple of long days trying to figure it out, repeated tips from other forums, etc., but I'm stumped. It's the same version numbers of Transmission and Filebot as I was using before when it was all working. OS X Yosemite, just like before. The apps seemingly work fine on their own. But when it comes time for them to work together via this previously brilliant script -- sadly nothing happens anymore.

Any help appreciated. Thank you.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1)
Make absolutely sure your transmission-postprocess script is in fact called (by adding lots of echo and IO redirection).

2)
What's the output say? You ALWAYS want the output, especially the error output that your shell is giving you if it can't execute filebot or java.

--> google IO redirection
:idea: Please read the FAQ and How to Request Help.
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

Okay, I added > out.txt 2> err.txt to the end of the script and then downloaded some TV shows via Transmission; didn't get anything interesting from that. And .filebot/logs/amc.log doesn't record anything in these instances (only when I manually run the script). But then I tried adding the following to the top of the script:

Code: Select all

#!/bin/bash -x
#
# DEBUG
LOG=/tmp/$$.log
exec > $LOG 2>&1
Here's what I've got:

1) I've confirmed that the transmission-postprocess script is in fact called -- the logs show that the variables for ut_dir and ut_title are getting filled in with the correct directory path and file name, respectively, for each download.

2) out.txt always = Permission denied

So - I guess my permissions are messed up. But I've been looking into it for the past 24 hours straight and can't figure it out. My skills are weak. Any tips? OS X Yosemite. I went into recovery and ran permission repairs and permission and ACL reset, etc. Checked activity monitor to make sure both Transmission and Filebot run under my user name that's also used for the permissions on the output folder. Reinstalled Homebrew, Transmission, Java, and Filebot all over again. Confirmed java version. Etc.... I even created an entirely new admin user on the computer, and recreated the script within the new account, step by step -- same problem. Is Transmission getting blocked from passing the data on to Filebot? I know I'm missing a step but I can't figure it out.

I did notice though that after the Filebot reinstall, the first time I tried to use the app from the GUI again, Apple popped up a Sandbox warning, denying Filebot from changing a video's filename. I dropped my entire user directory onto the Sandbox prompt to grant permission to all folders, and after that Filebot has run great via the GUI again. And if I manually run the script from Terminal with absolute paths to files, everything processes fine -- Filebot can rename, copy, create. But whenever Transmission calls the script... out.txt: Permission denied.

thank you greatly for any ideas you have.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1)
The App Store version of FileBot and the brew cask version of FileBot are completely separate and only the brew cask version includes the command-line tools.

2)
So have confirmed that your script is called by redirecting output to a known location. So you're saying /tmp is writable and that you get output?

So if you do this:

Code: Select all

#!/bin/bash
filebot -script fn:sysenv > /tmp/out.txt 2>&1
What is the output of cat /tmp/out.txt then?
:idea: Please read the FAQ and How to Request Help.
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

Here's the result:

Code: Select all

# Environment Variables #
Apple_PubSub_Socket_Render: /private/tmp/com.apple.launchd.ad4AY4XOBZ/Render
_: /usr/local/bin/java
JAVA_ARCH: x86_64
com.apple.java.jvmTask: CommandLine
XPC_SERVICE_NAME: 0
TERM_PROGRAM_VERSION: 343.7
LOGNAME: lukecro
SSH_AUTH_SOCK: /private/tmp/com.apple.launchd.9KLvj1GBkI/Listeners
SHLVL: 2
TERM_SESSION_ID: 645A05C0-E6A4-4A13-AFD8-CF95D85B66F4
HOME: /Users/lukecro
JAVA_MAIN_CLASS_38435: net.filebot.Main
TMPDIR: /var/folders/y4/nm0mdcgs2gz1j_fl1x6pn2_00000gn/T/
PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
SHELL: /bin/bash
TERM: xterm-256color
XPC_FLAGS: 0x0
TERM_PROGRAM: Apple_Terminal
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x0
OLDPWD: /Users/lukecro
LANG: en_US.UTF-8
PWD: /Users/lukecro
USER: lukecro


# Java System Properties #
path.separator: :
jna.library.path: /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/MacOS
java.vm.name: Java HotSpot(TM) 64-Bit Server VM
java.io.tmpdir: /var/folders/y4/nm0mdcgs2gz1j_fl1x6pn2_00000gn/T/
user.country: US
user.home: /Users/lukecro
useExtendedFileAttributes: true
java.vm.vendor: Oracle Corporation
user.language: en
java.vendor: Oracle Corporation
java.vendor.url.bug: http://bugreport.sun.com/bugreport/
swing.crossplatformlaf: javax.swing.plaf.nimbus.NimbusLookAndFeel
sun.net.client.defaultReadTimeout: 60000
http.nonProxyHosts: local|*.local|169.254/16|*.169.254/16
java.specification.name: Java Platform API Specification
os.name: Mac OS X
java.runtime.name: Java(TM) SE Runtime Environment
application.deployment: app
gopherProxySet: false
file.separator: /
sun.net.client.defaultConnectTimeout: 10000
java.vm.specification.version: 1.8
sun.boot.class.path: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/classes
java.version: 1.8.0_45
http.agent: FileBot 4.5.6
java.library.path: /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/MacOS
unixfs: false
ftp.nonProxyHosts: local|*.local|169.254/16|*.169.254/16
awt.toolkit: sun.lwawt.macosx.LWCToolkit
java.vm.specification.name: Java Virtual Machine Specification
os.version: 10.10.3
useCreationDate: false
file.encoding: UTF-8
socksNonProxyHosts: local|*.local|169.254/16|*.169.254/16
java.awt.printerjob: sun.lwawt.macosx.CPrinterJob
grape.root: /Users/lukecro/.filebot/grape
java.class.version: 52.0
java.ext.dirs: /Users/lukecro/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
java.specification.version: 1.8
net.filebot.AcoustID.fpcalc: /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/MacOS/fpcalc
java.vendor.url: http://java.oracle.com/
ehcache.disk.store.dir: /Users/lukecro/.filebot/cache/0
sun.os.patch.level: unknown
sun.java.launcher: SUN_STANDARD
os.arch: x86_64
user.dir: /Users/lukecro
line.separator: 

user.timezone: America/New_York
sun.cpu.endian: little
java.vm.specification.vendor: Oracle Corporation
java.home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
apple.awt.UIElement: true
java.net.useSystemProxies: true
sun.management.compiler: HotSpot 64-Bit Tiered Compilers
sun.arch.data.model: 64
java.endorsed.dirs: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/endorsed
file.encoding.pkg: sun.io
java.specification.vendor: Oracle Corporation
sun.boot.library.path: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib
sun.jnu.encoding: UTF-8
java.runtime.version: 1.8.0_45-b14
java.vm.info: mixed mode
java.vm.version: 25.45-b02
sun.io.unicode.encoding: UnicodeBig
java.awt.graphicsenv: sun.awt.CGraphicsEnvironment
java.class.path: /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/Java/FileBot_4.5.6.jar
sun.java.command: /opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/Java/FileBot_4.5.6.jar -script fn:sysenv
jna.nounpack: true
sun.cpu.isalist: 
user.name: lukecro


# Arguments #
args[0] = -script
args[1] = fn:sysenv


Done ヾ(@⌒ー⌒@)ノ

thank you for having a look.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1)
We have confirmed that you can read and write /tmp/out.txt so why have you never sent me the output of the amc script?

2)
According to the sysenv output the TR_* environment variables are not set. Either you've manually called the script, or if the script was indeed called by Transmission somehow the required environment variables are missing. Both TR_TORRENT_DIR and TR_TORRENT_NAME are required. And if they're not set the amc script won't know which files to process.

3)
Make transmission call your transmission-postprocess script. Make sure that any and all output of that script is piped to a file that you know to be accessible. And then send me the output.
:idea: Please read the FAQ and How to Request Help.
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

1) Using this code for the AMC script:

Code: Select all


#!/bin/bash -x
#
# DEBUG
LOG=/tmp/$$.log
exec > $LOG 2>&1

#!/bin/bash
filebot -script fn:amc --output "/Users/lukecro/Downloads/All New Torrents/Processed by Filebot" --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" > out.txt 2> err.txt 

Here's an example of the resulting log (generated each time a show completes downloading, with the directory and file name correctly filling in via Transmission):

Code: Select all

+ filebot -script fn:amc --output '/Users/lukecro/Downloads/All New Torrents/Processed by Filebot' --log-file amc.log --action copy --conflict override -non-strict --def artwork=y 'ut_dir=/Users/lukecro/Downloads/All New Torrents/TV Shows/Arrow.S03E23.HDTV.x264-LOL[ettv]' ut_kind=multi 'ut_title=Arrow.S03E23.HDTV.x264-LOL[ettv]'
/Users/lukecro/Downloads/All New Torrents/transmission-postprocess-error-log2: line 8: out.txt: Permission denied
 
Note: When I used to have Filebot's AMC script working, activity was recorded in /Users/lukecro/.filebot/logs/amc.log -- but after it stopped working, amc.log stopped recording any info after Transmission downloads a file. However, amc.log does record the details when I manually run the script via Terminal. Which had me thinking at one point that Transmission wasn't calling the script -- until I added the Debgug Log code, which indicates that Transmission is running the script, since it generates a unique /tmp/$$.log for every file upon download completion (although a record of it is still not getting into amc.log any more).

2) Sorry, I manually ran

Code: Select all

#!/bin/bash
filebot -script fn:sysenv > /tmp/out.txt 2>&1
in terminal -- that's why the variables weren't set. I misunderstood and thought you just wanted me to run it manually. I'll try again with Transmission calling the script.

So, having Transmission run this instead of the usual AMC script:

Code: Select all

#!/bin/bash
filebot -script fn:sysenv > /tmp/out.txt 2>&1
The entire out.txt =

Code: Select all

/Users/lukecro/Downloads/All New Torrents/transmission-postprocess: line 2: filebot: command not found
3) I think I've gathered everything in the items above, but let me know if I'm missing something. Thanks again.
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

Holy moley I've got it working again!

That "command not found" got me thinking -- I know the command is there and working because it runs fine when I put it in Terminal. But if it isn't getting found when Transmission runs it, maybe I should start back over and start messing around with what worked for me the last time I had problems with the Filebot script -- putting in the full path to the filebot.sh file.

Code: Select all

#!/bin/bash
/opt/homebrew-cask/Caskroom/filebot/4.5.6/FileBot.app/Contents/MacOS/filebot.sh -script fn:amc --output "/Users/lukecro/Downloads/All New Torrents/Processed by Filebot" --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"
And I'll be damned but even though this little trick had stopped working for me a few days ago, it's working again great now. Maybe the permission fixes or the reinstallations of all the programs I did over the last couple of days helped. I dunno. Still not sure why calling filebot works in Terminal but the absolute path is needed when called by Transmission. Or why both methods weren't working for me a few days ago, but now the absolute path version is. I'm just happy it's working again at all. :D
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by rednoah »

1)
When Transmissions calls the script, the ENVIRONMENT is different. You can't expect anything other than /usr/bin to be in the PATH by default.

2)
The Transmission user doesn't necessarily have a $HOME folder. You can't redirect to relative "out.txt" because you have no idea WHERE that is and what WORKING_DIR Transmission is calling the script with.

3)
/usr/local/bin/filebot should be a link to the latest brew cask filebot binary and will continue to work after the next version update.
:idea: Please read the FAQ and How to Request Help.
lukecro
Donor
Posts: 9
Joined: 08 Jun 2014, 19:46

Re: [GUIDE] Fully Automated Media Center with Transmission (

Post by lukecro »

Good call, thanks. I've updated the script to use /usr/local/bin/filebot, like you recommended, and it's working perfectly as well:

Code: Select all

#!/bin/bash
/usr/local/bin/filebot -script fn:amc --output "/Users/lukecro/Downloads/All New Torrents/Processed by Filebot" --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"
thank you!
Post Reply