Saturday, January 29, 2005

 

Automaticaly Get Podcast Files on Your Nomad

Here is a moded version of bashpodder that works with your Creative Labs Nomad device to both grab the podcasts and put them on your mp3 player without you having to lift a finger. You will need to have libnjb and njbtools installed.


------------------------------------------------

#!/bin/bash
# By Linc 10/1/2004
# Find the latest script at http://linc.homeunix.org:8080/scripts/bashpodder
# Last revision 12/14/2004 - Many Contributers!
# If you use this and have made improvements or have comments
# drop me an email at linc dot fessenden at gmail dot com
# I'd appreciate it!
# Modified by Tom Higgins 01/28/05 - added auto moving of new files onto a Creative Labs Nomad mp3 device
# you will need libnjb and njbtools installed
# Make script crontab friendly:
cd $(dirname $0)
# datadir is the directory you want podcasts saved to:
datadir=$(date +%Y-%m-%d)
njbtemp="njb"
# Check for and create datadir if necessary:
if test ! -d $datadir
then
mkdir $datadir
fi
# Check for and create the nomad temp dir if necessary:
if test ! -d $njbtemp
then
mkdir $njbtemp
fi
# Delete any temp file:
rm -f temp.log
# Read the bp.conf file and wget any url not already in the podcast.log file:
while read podcast
do
file=$(wget -q $podcast -O - | tr '\r' '\n' | tr \' \" | sed -n 's/.*url="\([^"]*\)".*/\1/p')
for url in $file
do
echo $url >> temp.log
if ! grep "$url" podcast.log > /dev/null
then
wget -q -P $njbtemp "$url"
fi
done
done < bp.conf
# Move dynamically created log file to permanent log file:
cat podcast.log >> temp.log
sort temp.log | uniq > podcast.log
rm temp.log
# Move new files to the Nomad device and then move them to the datadir:
newfiles=$(ls $njbtemp)
for items in $newfiles
do
njbputtrack -t $items -g podcast -l $datadir $njbtemp/$items
done
mv $njbtemp/* $datadir
# Create an m3u playlist:
ls $datadir | grep -v m3u > $datadir/podcast.m3u



<< Home

This page is powered by Blogger. Isn't yours?