How do I pass a filename to shell script in --commandtv from GiP command line?
#1
I'm running v3.22 on a Ubuntu 18 box with all the updates and trying to pass a filename to a bash script. This works, all day every day :-
commandtv = /home/xbox/Old_Scripts/find_mp4.sh "<filename>"

but I'm now trying to amend that to use a *slightly* different command for films and if I do a 'set -x' in the bash script, the problem is shown as :-
+ echo Filename being passed is ''

The parameters I'm using are almost the same, viz :-
get_iplayer --pvr-queue --pid=p07rq86b --commandtv=/home/xbox/Old_Scripts/films.sh "<filename>"

So where am I going wrong with this?

I should add that all I've done is copy the find_mp4.sh file and amend the filename and the storage locations, nothing else so I can't see why the command should fail to pass the filename.

Can somebody help this bear of little brain to spot the deliberate mistake please?
#2
You need to escape the space between films.sh and the filename.

This is what gip sees as the commandtv parameter:
--commandtv=/home/xbox/Old_Scripts/films.sh

And then “filename” is being passed to gip as a nameless parameter, which confuses it.

Jon
#3
(30-10-2019, 05:57 PM)jonhedgerows Wrote: You need to escape the space between films.sh and the filename.

This is what gip sees as the commandtv parameter:
--commandtv=/home/xbox/Old_Scripts/films.sh

And then “filename” is being passed to gip as a nameless parameter, which confuses it.

Jon
It's confused! Much like this user! I'm confused as to why one works and this one doesn't. I've RTFM'd the website and I notice that there are single quotes round the whole thing - https://github.com/get-iplayer/get_iplay...custcmd#tv

I've just added a single quote to a token film file and amended the cron job to start at 17:00 instead of 18:00 so I'll know in a couple of minutes whether or not it works. Nope. Ok. I'll have another try with what you suggest. Nope. That doesn't work either for me. Just to be clear, my command line now looks like this :-
--commandtv=/home/xbox/Old_Scripts/films.sh\ "<filename>"

Any other suggestions?
#4
I don't now see the message from dinky regarding my commandtv line.

Even though I've now spelt the command correctly as --command-tv it still doesn't work for me.

I'll persevere at another time though as my life is getting in the way of this computing lark!

So I'll put this on hold for the time being and report back if I ever manage to get it to work.

Thanks for the suggestions so far.
#5
So, are you saying that...

get_iplayer --pvr-queue --pid=p07rq86b --commandtv='/home/xbox/Old_Scripts/films.sh "<filename>"'

...doesn't work? Note the single quotes around /home/xbox/Old_Scripts/films.sh "<filename>"
#6
(01-11-2019, 05:46 PM)SquarePenguin Wrote: So, are you saying that...

get_iplayer --pvr-queue --pid=p07rq86b --commandtv='/home/xbox/Old_Scripts/films.sh "<filename>"'

...doesn't work? Note the single quotes around /home/xbox/Old_Scripts/films.sh "<filename>"

Yep. That's what I'm saying - even when I correctly spell --command-tv ;-)

I get a file called .mp4 and that's it. I've just cut and pasted your text, fixed the command rule and ran it.

To forestall any queries about the bash script, here are the first few lines :-
Code:
echo Filename being passed is "$1"
iplayer_downloads_folder=/mnt/raid2/Media_Share/GiP_Downloads/tv/
cd "$iplayer_downloads_folder"
find . -type f -name "*.mp4" -print0 | xargs -0 -n 1 "$(dirname $0)/film_move.sh"
It's my script that's declaring the error as can be seen here :-
Code:
echo Filename being passed is '/mnt/raid2/Media_Share/GiP_Downloads/tv/The Fall/.mp4'
#7
As I said in post #1, my script for the PVR runs successfully. I've had an occasion overnight though where another pvr-queue item has produced a .mp4 file so it's entirely possible that it's something I'm doing when adding something to the PVR.

I added it in the normal way :-
Code:
get_iplayer --pvr-queue --pid=m0009tqh --subdir --subdirformat="<nameshort>/<firstbcastyear>"
with the preferences set to this :-
Code:
commandtv = /home/xbox/Old_Scripts/find_mp4.sh "<filename>"

The PVR function ran successfully at 20:00 when it produced A Question of Sport and later to produce Click and Later with Jools Holland. The failure occurred at 21:00.

Can anybody spot where I'm going wrong with this, or could it possibly (and I'm very reluctant to suggest it) be an infelicity in the GiP code somewhere?
#8
Solved?

I've now re-run the PVR function having removed this option :-
Code:
fileprefix <episodenum. ><episodeshort>

So I was right to be reluctant to point a figure at GiP!

I haven't ended up with the correct filename for the film I've just tried but I guess that's hardly surprising but it does at least mean that I can see some sort of filename instead of nothing!

Thanks to all the contributors but the problem as usual is between the keyboard and the chair.


Possibly Related Threads…
Thread Author Replies Views Last Post
  PVR list created in Web PVR launched by cron is not visible from command line cathorn 2 3,463 22-08-2016, 04:26 PM
Last Post: cathorn
  Web_PVR working spot on, but command line PVR acting up? fechter 2 2,831 16-08-2014, 06:20 PM
Last Post: dinky