These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

More than one commandtv to run?

user-1906

Following on from my attempts at writing something to shorten a variable - in this instance it was firstbcastdate - I made it into a preset. Except it didn't run. I got an error :-
INFO: Running user command
sh: 1: Bad substitution
INFO: Command exit code 2 (raw code = 512)
ERROR: Command Exit Code: 2

GiP is running on an Ubuntu box but not as me. Instead it runs as a user called xbox. I had problems persuading anything to run under that user so added these lines to my gip script for cron :-

# ensure environment variables are set: cron jobs do not have these set
if [ -z "$HOME" ]; then
       export HOME=/home/xbox

So, in an effort to make my preset work, I turned it into a fully-fledged bash script and used the preset to call it. But .... it stops the commandtv line in my options from working.

The question is, should it? Running GiP in verbose mode, I can see this in the logs (removed the stuff that didn't relate to this) :-
INFO: PVR Run: 'ONCE_b0bbc6q5'
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
Current options:
commandtv = /home/xbox/GiP_Scripts/click_folder_rename.sh
fileprefix = <nameshort>_<firstbcastdate>
outputtv = /mnt/raid2/Media_Share/GiP_Downloads/tv/
pid = b0bbc6q5
preset = click_folder_rename
INFO: Running user command
INFO: Running command '/home/xbox/GiP_Scripts/click_folder_rename.sh'
INFO: Command: /home/xbox/GiP_Scripts/click_folder_rename.sh
++ ls /mnt/raid2/Media_Share/GiP_Downloads/tv/Click/
+ subdir=2018-07-14
+ short=2018
+ mv /mnt/raid2/Media_Share/GiP_Downloads/tv/Click/2018-07-14 /mnt/raid2/Media_Share/GiP_Downloads/tv/Click/2018
INFO: Command exit code 0 (raw code = 0)
INFO: Command succeeded
New tv programme: 'Click - Grand Tech Auto', 'Click goes behind the scenes at the Austrian Grand Prix.'
INFO: Deleted PVR search 'ONCE_b0bbc6q5'
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-

Is it because I've asked the preset to call a bash script that this happens and I can only run one bash script command, or do I have to queue them in the commandtv option instead. Or can I not do that either?

This is the relevant line from the options :-
get_iplayer --prefs-show
Options in '/home/xbox/.get_iplayer/options'
       commandtv = /home/xbox/Old_Scripts/find_mp4.sh

user-2

You can string together multiple commands in --command-tv, so long as your shell understands whatever you put in there. Your preset no doubt had a syntax error, but did you read the output you posted? Your script ran without reporting an error. That's what exit code 0 means (ask Google if you don't know why that is). The "Command succeeded" should also give you a clue. Whether the script does what you want is up to you.

user-1906

Quote:You can string together multiple commands in --command-tv

But obviously I don't want the 'click_folder_rename' to run on every tv file so I can't string them together or am I misunderstanding what you mean?

Also you said
Quote:Your preset no doubt had a syntax error
I didn't think it did as I could run it quite happily as a command in a shell - without the commandtv prefix of course - by simply cutting and pasting the line from what was a simple text file in the preset. I could also run it on this machine (running a different distro to the machine running the GiP pvr stuff and running as me and not as the xbox user) and it runs to completion.

It's only when running on the Ubuntu box as the xbox user that it all goes nipple north.

Thinking some more about this and the 'sh: 1' error leads me to this :-
a quick google tells me -
https://stackoverflow.com/questions/2061...n/20616103
-  that Ubuntu is one of those annoying distros, as sh is dash.

So is the real problem Ubuntu and not the coding of the preset? If so, I'll have to rethink how I go about this.

user-2

(18-07-2018, 11:28 AM)But obviously I don't want the 'click_folder_rename' to run on every tv file so I can't string them together or am I misunderstanding what you mean?
If you don't want to use the preset for a particular programme, then don't specify it as part of the command.
(18-07-2018, 11:28 AM)So is the real problem Ubuntu and not the coding of the preset? If so, I'll have to rethink how I go about this.
If you're using bash syntax that sh doesn't understand, what else would you expect? If you need to use bash, use bash.

user-1906

Quote:If you don't want to use the preset for a particular programme, then don't specify it as part of the command.

But my point is that one of the commands isn't a preset. It's the standard command for *all* of the tv programmes. It's simply that the standard command won't run if I also specify a preset.

user-2

Presets override saved preferences. That is how they are supposed to work. You can see it in the output you posted. As the documentation tells you, you can only specify one --command{-tv,-radio} option at a time. It also tells you that you can use it to run multiple commands, as I already told you earlier. If you have a global script and a preset-only script, either invoke the former from the latter, or include them both in the preset --command-tv option.

user-1906

Quote:Presets override saved preferences. That is how they are supposed to work. You can see it in the output you posted.

While I might be able to see it, I'm afraid it wasn't clear to this bear of little brain that they worked that way. No matter, I know now and with the knowledge I've gained from the various questions and responses I've had in this and other threads, I am making much more use of GiP.

Thanks for the help. As I said, I've gained knowledge and that surely must be of benefit ;-)

These forums are archived

See this post for further info