Results 1 to 3 of 3

Thread: Using Script File to Download MP3 URLs

  1. #1
    Join Date
    Sep 2007
    Beans
    18

    Using Script File to Download MP3 URLs

    I want to download podcast mp3s at night when my broadband connection is not otherwise being used. I wanted to save the links for the mp3s in a text file, one line for each link, on my Raspberry Pi home file server & use a script file to launch at a set time during the night, to begin downloading (wget) the mp3s on each line.


    With this method I would need the text file with my links, a script file & an 'at' command to launch the script file. Is this a good way to go about this? How would I write the script file commands too. Ive tried a few examples of script files through searches on the web but havent been able to get anything to run successfully.

    Thanks

  2. #2

  3. #3
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    Re: Using Script File to Download MP3 URLs

    I suggest using a simple Bash script called from cron at whatever time you want, passing the full path to the URL list and the desired save location as arguments. The following might get you started:

    Code:
    #!/bin/bash
    
    # Pass the path to the list of URLs as the first argument
    # and the save location as the second argument
    
    list=$1
    loc=$2
    
    cd $loc
    
    for line in $(cat $list); do
        wget $line
    done
    exit
    This can be improved on to check for arguments and if there is no second argument to use a default location etc.

    This should give you a start anyway, if you need more help to expand this, just shout.
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •