These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

Scheduled execution with both cache refresh and PVR run on Windows 10?

user-910

I'd be interested to see the batch files that people are using for routine timer downloading of stuff.

I have this set up on my machine, but since upgrading to Win10 I've had to split the file into two, as if I used one to both refresh and then PVR, it does the refresh and then closes without doing the PVR itself. For now I've had to split it into two bat files which are called sequentially using task scheduler. On Win7 the single combined file worked fine.

user-493

They say life is a "work in progress" which describes my use of batch files with Windows and GiP.

I split the download activity between two files, a batch file (loaded by freeware "System Scheduler") which executes the fetching of programmes listed in a text file.

The download text files are stored on Dropbox (in the folder "D:\Dropbox\Get_iPlayer\0-TVdl\") so they can be read across different PCs if necessary. For example, I spend part of the year in the Philippines - when I am there I can scan the BBC schedules, decide which programmes I wish to download and enter them into the text file. Once saved, my UK PC picks up those files to do the downloading! ;-) In my case, that text file is a combination of URLs/PIDs together with the programme name in quotes, one URL/PID/programme name per line: e.g.

TV.txt:

--refresh
tv-0801-mon
====
http://www.bbc.co.uk/programmes/b06n399s
http://www.bbc.co.uk/programmes/b044j57r
"have I got"
====
http://www.bbc.co.uk/programmes/b07n22gd
http://www.bbc.co.uk/programmes/b07n22gg
"david attenborough"
http://www.bbc.co.uk/programmes/b0084kpm
"michael palin's new europe"

http://www.bbc.co.uk/programmes/b06bgp0l
"blitz cities"
b07mh601
"new zealand"
====
http://www.bbc.co.uk/programmes/p030s5bx
"calculating ada"
====

I use URLs/PIDs to make sure I'm downloading the correct version in a series. Out of laziness I often don't bother to strip out the "http://www.bbc.co.uk/programmes/" bit in front of the PID. I put both PIDs and programme names in to give me a cross check on what I'm downloading.

I don't usually use "best" as the download option preferring to force the HD option so here is a typical batch file:

tv-pidhdf.bat:

set $textFile="D:\Dropbox\Get_iPlayer\0-TVdl\tv.txt"
for /f "delims=" %%a in ('type %$textFile%') do get_iplayer --modes=hlshd --force --pid %%a

You can replace --modes=hlshd with your mode of choice, eg --tvmode=flashbest or --tvmode=flashhd, etc.

I force the programme download (--force) for a specific reason - the programme may have previously been broadcast in the past and I downloaded an inferior version, e.g. standard rather than high definition. This gives me an opportunity to acquire a better version!

Since the documented problems with the HLS feeds, I pipe the output to a text file so the batch file would now look like this:

set $textFile="D:\Dropbox\Get_iPlayer\0-TVdl\tv.txt"
for /f "delims=" %%a in ('type %$textFile%') do get_iplayer --modes=hlshd --force --pid %%a >>F:\iPlayer\TV\log.txt

The output including details of any errors is piped into the file log.txt located in "F:\iPlayer\TV\". I can then decide which programmes need to be re-downloaded. Incidentally, I prefer to open that text file using freeware "Notepad++" as this enables easier reading than Microsoft's "Notepad".

If you're purely downloading based on searches of the programme name, you need to amend the above files  - in this case you would just remove the URLs/PIDs in the text file and replace the reference to "--pid"  with "--get" in the batch file.

I have a similar set-up for radio programmes I wish to download.

I find this a far more flexible route than the PVR, especially when you're adding or removing programmes. Also it removes the necessity of typing over and over the get_iplayer command with the appropriate strings needed using the CLI. Surely that's why batch files were invented, to remove tedious repetitive actions! I usually scan the schedules daily and enter up the text file for the programmes I wish to download on that day - if I'm away from home for a few days I can enter up the schedule in advance.

The above template can be modified to suit individual requirements, I have around a dozen batch files that have evolved over the last couple of years.

Hope this helps.



Alan

PS My main system is on Windows 7 but I don't see any reason why this wouldn't work on Windows 10.

user-910

Interesting - yes it does help somewhat (or is at least another option that could be built in).

My original batch file was just very simple, based on the PVR built into GI:

cd c:\program files (x86)\get_iplayer
get_iplayer --refresh
get_iplayer --pvr

The problem being it does the refresh and then stops (the terminal window closes). So I've had to split it into two batch files, which are run sequentially (the cd line is in both files). It works like that, but it's not exactly elegant hence I was wondering what else may work.

I'll have a look into your method as well, as I'm often travelling on business too and being able to load up a text file of stuff to download could be very useful. At the moment I just do it via remote access into my home laptop, but a text batch file would be good I think.

user-2

Remember that you are running one batch file from another batch file. You just need to preface each get_iplayer invocation with "call".

user-910

I think that may be the key here, although it used to work on Win7 and older versions of GI (although with a more explicit command line to run the perl scripts).

Will certainly test that out tonight, although the input above about batch-feeding GI is also useful so the thread has been worthwhile anyway :)

Editted to add - yup, adding the call commands works perfectly. Thanks Dinky :)

user-2

If you invoke perl directly, "call" wouldn't apply and multiple commands would run sequentially as expected, on any version of Windows.

user-910

Yes, it was when perl got removed from the path - I went from calling the scripts directly to batch files without realising it. It just happened to be coincident with when I went from Win7 to Win10, which confused things.

Anyway the call command addition has done the business, so all is fine now anyway :)

These forums are archived

See this post for further info