Page 1 of 1

Saving renamed filename as a bash variable

Posted: 30 Nov 2013, 09:34
by soddengecko
Hi All

I need some help. I am trying to create some bash variables that will store the renamed filename (after filebot has run), the show name and the path it was moved/copied to.

Transmission will give me the filename (TR_TORRENT_NAME) before it has been renamed by filebot which is a bit useless for my needs.

I am trying to create a notification system using curl. I have the notifications working fine but I have had to hard code the values rather than using variables. Obviously this does not give me the specific file details that was downloaded.

Do any of you geniuses have any idea how I could capture those values?

Here is what I am using to fun filebot

Code: Select all

sudo filebot -script fn:amc --output "/media/video" --log-file amc.log --action copy --conflict override -non-strict --def xbmc=localhost "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME" "seriesFormat=TV/{n}/{episode.special ? 'Special' : 'Season '+s}/{n} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {t}" "movieFormat=Film/{n} ({y}){\" CD$pi\"}" 
And this is my notification

Code: Select all

curl https://www.notifymyandroid.com/publicapi/notify 
--silent 
--data-ascii "apikey=my key here" 
--data-ascii "application=Transmission" 
--data-ascii "event=Download Complete" 
--data-asci "description=$TR_TORRENT_NAME
Successful download.
$TR_TIME_LOCALTIME
XBMC has been Updated." --data-asci "priority=0"
As you can see above, I am using the pre-rename file name in my notification, but I would rather have the nice name.

Re: Saving renamed filename as a bash variable

Posted: 30 Nov 2013, 15:33
by rednoah
1. Set --log info and then just sent the whole output to curl? Just sending the stdout to curl would be the easiest solution.

2. Though I'd just do all that as filebot script. If you call the rename function you'll get a list files, so you have all the data you need to easily call that android notify api either via exec curl or groovy calls.

Re: Saving renamed filename as a bash variable

Posted: 02 Dec 2013, 18:55
by soddengecko
Hi, Thanks for the info. I will look into both those options.