Unattended iPlayer downloads

ThatGuy wrote in a comment that he’s using iplayer-dl on a Linux machine that he connects to via ssh, and wondered,

Though is it possible to get the ruby script to continue to be processed on the server, even if i disconnect form SSH?

It is. In fact, it’s exactly what I do. To achieve it, you’ll need to install GNU Screen (apt-get install screen on Debian/Ubuntu; your distro may vary).

The first time you connect to the downloading machine (or after a reboot), type:

screen

You’ll get a console prompt, from which you can start downloads as usual. When you disconnect from the session, the download will continue to run in the background.

Next time you connect to the machine via ssh, type:

screen -rd

You’ll get back to the console prompt that you were using earlier, which might still be downloading, or might have finished.

It’s as simple as that!

Comments

Skip to the comment form

  1. Irregular Shed

    Wrote at 2008-07-30 09:45 UTC using Firefox 3.0 on Windows XP:

    Screen rocks. I’m currently without an always-on box under my direct control (electricity economy drive at home) so I can’t remember all the key combinations, but it’s worth reading up on them. There’s key combinations to attach extra screens, “tab” between them and detach without closing your terminal. Back when I was seeding Ubuntu ISO torrents it meant I could just spread the love without worrying about it.

    However, if you’re not looking for that level of interactivity and just want to start something off before closing your terminal you could just append an ampersand at the end of the command to get it to run as a new process. Something like:

    ruby iplayer-dl.rb blah/blah/blah &

    Although I’ve not tried it with this script I use it when I have to restart Redmine by hand on our office server, and that’s a Rails app. Works fine.
  2. Paul Battley

    Wrote at 2008-07-30 12:30 UTC using Firefox 3.0.1 on Mac OS X:

    Using an ampersand won’t always work: the process will still die eventually. You can get around this by prefixing the command with nohup, but then you might as well just use screen!
  3. ThatGuy

    Wrote at 2008-07-30 12:35 UTC using Internet Explorer 6.0 on Windows XP:

    Cheers for that,

    I shall install screen tonight, and hopefully it will work perfectly!

    This script has come on leaps and bounds since the first version I had, I look forward to any further features or updates.
  4. Strawp

    Wrote at 2008-07-30 15:08 UTC using Firefox 3.0.1 on Windows XP:

    Indeed, screen changes everything. I also use it to remain permanently logged in to our IRC channel so that I don’t miss anything :P
  5. Irregular Shed

    Wrote at 2008-07-30 16:43 UTC using Firefox 3.0 on Windows XP:

    Well, I never knew that. And now I do, thanks Paul! I guess the way the box I’m talking to is configured allows me some slack to get away with it!

    For safety’s sake then, always use screen, because it’s considerably more skill =)
  6. ThatGuy

    Wrote at 2008-07-30 17:34 UTC using Safari 525.22 on Mac OS X:

    The good:
    Screen is great

    The Bad:
    NAS:/PATH# iplayer-dl -s b00csjl9
    Summer Heights High – Episode 8.mov (Default)
    There is no page for this programme.
    This probably means that the programme does not exist.

    Metadata: http://www.bbc.co.uk/iplayer/playlist/b00csjl9/
    Programme Page: http://www.bbc.co.uk/iplayer/episode/b00csjl9/

    From browsing on my mobile device, it seems to be taking a bit longer for the quicktime play link to appear on the device, maybe that is the issue.

    Either that, or my connection is not working, anyone else getting similar errors, occurring on quite a few popular/hot programs that I know have mobile versions.
  7. Terence Eden

    Wrote at 2008-07-31 12:18 UTC using Firefox 3.0.1 on Windows XP:

    You can also start the process by typing
    screen iplayer-dl -s b00csjl9

    That will kick the download off in a separate screen.

    To detach and go back to your console, CTRL+A+D.

    To go back to that screen
    screen -r

    So, you can open a terminal, run screen, detatch and close the terminal. When you’re ready, open a new terminal and screen -r to check on it.

    T

Leave a comment

Please read the comment guidelines before posting. Comments are Gravatar-enabled. Your email address will not be published.

To prove that you’re human, type human in the Bot check field.

Trying to post some program output or a long code sample? Please use a paste service and link to it instead.