LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-04-2012, 07:56 PM   #1
O(V)eGA_l2el)
Member
 
Registered: May 2005
Distribution: Fedora & Debian
Posts: 56

Rep: Reputation: 15
Bash Auto Download Script for Podcasts available (wget used)


I created a bash script that automatically downloads podcasts via the wget command. The "Power Scripting Podcast" is used as an example in the script below. Everything in bold, that has a reference to the right, should be changed based on the podcast you plan to download. If anyone is interested, by all means use it; don't forget to add execute permission, chmod +x, to the file.

Code:
#! /bin/bash
#SYNOPSIS: Download Get-Scripting Podcast
#--------  Create podcast directory in current directory and
#--------  store all podcast episodes in said directory.
#--------  Remove unnecessary characters from file name.
#NOTES: 
#---Author: omegared
#---Location:
#EXAMPLES:
#LINKS: http://powerscripting.wordpress.com/

# Create $PS if does not exists
PS="./PowerScripting/"  #<----CHANGE THIS TO NAME OF PODCAST
if [ -d $PS ]; then
	echo "$PS exists"; cd $PS
else 
	mkdir $PS; cd $PS
fi 

OUTPUTFILE=Get-PSPodcast-URLS  #<----NAME OF FILE WITH LIST OF URLS (location of individual episodes)
#Remove content of $OUTPUTFILE
echo > $OUTPUTFILE

#Add URLs to $OUTPUTFILE for download; change "150" to the first episode; change 170 to last episode you want to download
for (( c=150; c<=170; c++ ))
do 
echo "http://traffic.libsyn.com/powerscripting/PSPodcast-$c.mp3" >> $OUTPUTFILE  #<---URL OF FIRST EPISODE
done

#Download new files listed in $OUTPUTFILE; skip existing files
wget -nc -i $OUTPUTFILE

#Remove characters after *.mp3 (ex: filename.mp3?sid=367fe...)
for i in *.mp3'?'sid*; do mv -v "$i" "${i%'?'sid*}"; done

Last edited by O(V)eGA_l2el); 01-04-2012 at 08:09 PM.
 
Old 01-04-2012, 08:15 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Good work on the script! Replying to take off the zero reply list.

Cheers,

Josh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between wget and php script in download speed linuxsavar Linux - Server 1 07-29-2011 08:27 AM
[SOLVED] shell script using wget to download files from ftp, sub directories bayaraa_u Linux - General 1 04-28-2010 02:50 AM
Bash Download Manager (using wget) and progress bar rastacre Programming 1 08-29-2008 01:33 PM
Script to download file using wget linuxnewbie82 Programming 6 02-14-2007 04:48 AM
need help with bash script to manage podcasts Benanzo Linux - Software 6 11-18-2006 07:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration