PVR process stops working

Jeremy Nicoll - ml gip jn.ml.gti.91 at wingsandbeaks.org.uk
Wed Dec 13 11:02:48 PST 2023


On 2023-12-13 11:16, MrBrunes wrote:

> I created the task similarly to previously suggested:
> schtasks /create /ru <username> /rp <password> /sc hourly /mo 4 /tn
> get_iplayer_pvr_task /tr "get_iplayer --pvr --quiet 2>> \"F:\iplayer
> recordings\get_iplayer_pvr_task.txt\""
> 
> Currently I just see a single line e.g. "New radio programme: 'etc.'"
> but no date or download details.
> I've tried removing "--quiet 2"


You'd find it simpler to put the command you want run by the scheduled
task into a .bat or .cmd file, so that you can change that command
without having to change the scheduled task itself.  That is, use eg

   schtasks /create /ru <username> /rp <password> /sc hourly /mo 4
    /tn get_iplayer_pvr_task /tr F:\getiplayer.cmd

- to run that commamd file every so often.  Simpler... the .cmd file's
name has no spaces in its path so no quotes are needed in this part of
the schtasks command.  It also enables you to put several commands into
the .cmd file (if you later need to do something more complicated).


Then inside the cmd file you can have the (simpler) command that has
to be run (& comments explaining what it does & why you coded it the
way you did) eg (using your example):

   get_iplayer --pvr --quiet 2>> "F:\iplayer 
recordings\get_iplayer_pvr_task.txt"

(or whatever) - which wouldn't need escaped double quotes because it's
not nested inside another string.



I'm a little surprised to see you using backslash to escape embedded
instances of double quotes.  It's a unix/linux convention; Windows
is different, mostly - backslash IS needed in some Windows commands
- ie FindStr, Reg and Runas.

The normal Windows CLI escape character is caret.  On the other hand
I suppose it's possible that it's perl that is seeing & processing the
backslash?  Anyway, see:

   https://ss64.com/nt/syntax-esc.html



In Windows command line stuff generally a "2>>" fragment means
redirect "output intended for standard handle 2", which is "STDERR",
ie whatever the program being run designates as error messages.

That suggests to me that the "2" is not part of the "--quiet" option.

By replacing "2>>" by ">>" you changed redirection of error messages
to redirection of (implicitly) standard handle 1 (STDOUT) which is to
say "normal output".  That is, just ">>" is equivalent to "1>>" which
explicity mentions handle 1 which is STDOUT.


Looking again at the command that was part of your schtasks line, you
might be better replacing

   2>> \"F:\iplayer recordings\get_iplayer_pvr_task.txt\""

by

   >> \"F:\iplayer recordings\get_iplayer_pvr_task.txt\" 2>&1"

which //I think// means first that STDOUT is appended to the named
file, and second (via the "2>&1" part) that handle 2's output is
sent to the same place as handle 1's output.

See: https://ss64.com/nt/syntax-redirection.html


Actually I'd suggest simplifying the target file name to one that
contains no spaces & therefore needs no enclosing quotes while you
solve the bigger problem of getting what you want into it, ie just
use eg

   >> F:\simpleoutputfile.txt 2>&1

or if you think explicitly mentioning handle 1 is clearer:

   1>> F:\simpleoutputfile.txt 2>&1

(note no double quote on the end if it's issued from inside a .cmd
file as suggested above, but one is probably needed if it's the end
of the string following /tr in schtasks.)


-- 
Jeremy Nicoll - my opinions are my own



More information about the get_iplayer mailing list