Need help with "command" function.

Vangelis forthnet northmedia1 at the.forthnet.gr
Wed Nov 11 22:06:48 PST 2015


On Fri Nov 6 21:03:16 GMT 2015, batguano999 wrote:

> My operating system is Ubuntu-12.04
> Please can somebody show me a working example
> of the "command" function.
> I'm trying...
> get_iplayer --force --type=radio --modes=flashaaclow --command="ffmpeg -i 
> XfileprefixX.m4a -vn -c:a libmp3lame -b:a 96k XfileprefixX.mp3; rm 
> XfileprefixX.m4a" --get "Bells on Sunday"
> But it ignores the "command" to leave only
> the downloaded m4a file and an error message...
> XfileprefixX.m4a: No such file or directory
> It can't seem to find the m4a file
> to let it re-encode and delete.
> Should I be using something else
> instead of "XfileprefixX.mp3" and "XfileprefixX.m4a"?

Well batguano, you haven't come back here
to let us know of your progress with that...
 I, as is known already here in the list,
am not running Ubuntu but Windows 32bit,
so can't be of real help to you...
But I took it as an exercise to find a working
solution for your query in Windowsland.

Your attempt shows that what you want done is:
1) Download the flashaaclow radiomode of a programme;
2) Transcode it post download (file is extant inside
GiP's download directory) with FFmpeg to MP3
@96kbpsCBR (rather than use the --mp3 switch
which transcodes it to 128kbps).
3) After the conversion, delete the original .m4a file,
to be left with only the MP3 encode...

--command (-c) is executed after GiP has finished
the fetch; the download part of the GiP command
would be:

get_iplayer --type=radio "Bells on 
Sunday" -g --force --modes=flashaaclow --no-art

I added "--no-art" as in the ffmpeg conversion step
any embedded thumbnail would've been lost (due to -vn).

 On Win32, when we start the GiP shortcut,
the working directory is the installation folder,
"C:\Program Files\get_iplayer"
The windows installer of 2.94 does not set
the ffmpeg binary in the PATH, however if one runs
get_iplayer --show-options
one can see the path of ffmpeg.exe relative to the
working directory; I have slightly modified mine to be:
ffmpeg = .\ffmpeg\bin\ffmpeg.exe

I'll also use the following substitution parameters
(https://github.com/get-iplayer/get_iplayer/wiki/documentation#substitution-parameters)

"<dir>" = full path to GiP's download directory -
in my case contains whitespace(s) and should be double-quoted

"<filename>" = though not stated clearly, this is
the full path to the downloaded file, which also
contains whitespace(s) and should be double-quoted.

<fileprefix> = filename prefix of file;
if -w was not used for download, it does not
need to be double-quoted.

"<filename>" = "<dir>\<fileprefix>.<ext>"

On Windows there is an added difficulty in that Perl
expects embedded double-quotes to be properly
escaped by \", so composing the right --command
is not easy for the less savvy like meself  :-(
I did struggle alone at first, but then I remembered
this post by dinkypumpkin:
https://squarepenguin.co.uk/forums/thread-115-post-891.html#pid891
which made things easier...

In the end, this is what I came up with:

get_iplayer --type=radio "Bells on 
Sunday" -g --force --modes=flashaaclow --no-art -c=".\ffmpeg\bin\ffmpeg -i 
\""<filename>"\" -vn -c:a libmp3lame -b:a 96k \""<dir>\<fileprefix>.mp3"\" 
&& del \""<filename>"\""

My mailer (and possibly the list software) has a
tendency to insert unneeded whitespaces and
line breaks, so I've also attached it as an
extensionless text file...

Tested to work as expected on WinVista SP2 x86;
due to the difficult (at least to me) syntax, I avoid
complex "--commands " as much as possible and do,
say, my transcodings outside of GiP...
Hope someone finds the above somewhat useful...

Regards,
V. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: --command_example_win32
Type: application/octet-stream
Size: 209 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/get_iplayer/attachments/20151112/d9bfe62d/attachment.obj>


More information about the get_iplayer mailing list