Page 1 of 1

[BASH]General bash question - variables in post processing

Posted: August 26th, 2011, 5:07 pm
by dashy
Hi all,

Not sure this is the best place to ask, but I'm guessing somebody knows. Anyways to introduce, I have a NAS with ARM based debian squeeze. I have a fairly good script in place but would like to improve it just slightly. It's really a question of how variables are passed and stored within a bash script.

I am running Transmission torrent client which executes a posttorrent.sh script that has the following overall functions:
(1) On completion of the torrent, it automatically extracts the torrent into a specified directory
(2) Once the extraction is complete, it calls a function "tvnamer" (https://github.com/dbr/tvnamer) which analyzes the file name and renames and organizes it into the Series/Season folder.
(3) Sends me an SMS once it is done organizing and has refreshed the media library :D

The question I have pertains to item (2). The line of code is as follows:

Code: Select all

/ffp/bin/tvnamer -b -f -m -d "/mnt/HD/HD_a2/TV/%(seriesname)s/Season %(seasonnumber)d/" /mnt/HD/HD_a2/TV/
Basically this executes tvnamer on any video files within /mnt/HD/HD_a2/TV/ directory, and renames and moves (i.e. organizes) each file into a Series/Season #/ directory.

The relevant arguments for tvnamer are -f = force it without prompt, -m -d <folder> to make it move into the specified directory. WITHIN THIS EXECUTABLE line the variables %(seriesname)s and %(seasonnumber)d are used. I would like to use these later on within my script, but they're not defined anywhere else. Is there a way to store them and use them within the script?

Re: [BASH]General bash question - variables in post processi

Posted: August 28th, 2011, 1:59 am
by Mar2zz
Is it logging? maybe you could grep the log for those variables, or use some dirname functions to get these names.