coastie wrote:
# datadir is the directory you want podcasts saved to:
basedir="/home/$guest/podcasts"
datadir="${basedir }/$(date +%Y-%m-%d)"
# Check for and create datadir if necessary:
if test ! -d "${basedir}"
then
mkdir "${basedir }"
fi
the above is incorrect...
we don't have a value for $guest
i used $USER because that is a variable that is assigned to the shell, and will evaluate to the actual users' name
like, if you were logged in as coastie when you ran this script, $USER would evaluate to coastie.
also, the spaces after the word basedir and before the closing }...
those have to go

the above should be:
Code:
# datadir is the directory you want podcasts saved to:
basedir="/home/${USER}/podcasts"
datadir="${basedir}/$(date +%Y-%m-%d)"
# Check for and create datadir if necessary:
if test ! -d "${basedir}"
then
mkdir "${basedir}"
fi
coastie wrote:
if test ! -d "${datadir}"
then
mkdir "${datadir}"
right there is the "unexpected end of file"
no fi
we forgot to close the if statement...
but it gets better... i realized after finding this if statement error that we had a larger error... my dumb self made a redundant variable call
everywhere that i have ${basedir]/${datadir}is incorrect... they should just read ${datadir}

you can read the rest of this post (since i work from the back to the front of a script to error check it

) and see the little things i found when looking real close... or you can just copy and paste the code block at the bottom of this post... either way

coastie wrote:
# Delete any temp file:
rm -f "${datadir}/temp.log"
read -p "Please enter the url you want to add to the podcast list: " url
# 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 - | xsltproc parse_enclosure.xsl - 2> /dev/null) || file=$(wget -q $podcast -O - | tr '\r' '\n' | tr \' " | sed -n 's/.*url="\([^"]*\)".*/\1/p')
the above looks fine... but this next part needs to be fixed since we have a new variable called url
coastie wrote:
for url in $file
do
if ! grep "$url" "${datadir}/podcast.log" > /dev/null
then
wget -q -P ${datadir} "${url}" && echo "${url}" >> "${datadir}/temp.log"
fi
done
done < bp.conf
change that to:
Code:
for furl in $file
do
if ! grep "${furl}" "${datadir}/podcast.log" > /dev/null
then
wget -q -P ${datadir} "${url}" && echo "${url}" >> "${datadir}/temp.log"
fi
done
done < bp.conf
and then this part:
coastie wrote:
# Move dynamically created log file to permanent log file:
cat podcast.log >> "${datadir}/temp.log"
change that line to:
Code:
# Move dynamically created log file to permanent log file:
cat "${datadir}/podcast.log" >> "${datadir}/temp.log"
sort "${datadir}/temp.log" | uniq > "${datadir}/podcast.log"
rm "${datadir}/temp.log"
# Create an m3u playlist:
ls "${datadir}" | grep -v m3u > "${datadir}/podcast.m3u"
[/code]
i think the problem is here
Code:
# Move dynamically created log file to permanent log file:
cat podcast.log >> "${basedir}/${datadir}/temp.log"
sort "${basedir}/${datadir}/temp.log" | uniq > "${basedir}/${datadir}/podcast.log"
rm "${basedir}/${datadir}/temp.log"
# Create an m3u playlist:
ls "${basedir}/${datadir}" | grep -v m3u > "${basedir}/${datadir}/podcast.m3u"
whatcha think.[/quote]
like i said above... i could just kick myself

here's what i have that works so far as i know (i don't have a bp.conf file)
Code:
#!/bin/bash
# By Linc 10/1/2004
# Find the latest script at http://linc.homeunix.org:8080/scripts/bashpodder
# Last revision 07/01/2005 - 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!
# edited by jbsnake and coastie (had to tweak some things)
# Make script crontab friendly:
cd $(dirname $0)
# datadir is the directory you want podcasts saved to:
basedir="/home/${USER}/podcasts"
datadir="${basedir}/$(date +%Y-%m-%d)"
# Check for and create datadir if necessary:
if test ! -d "${basedir}"
then
mkdir "${basedir}"
fi
if test ! -d "${datadir}"
then
mkdir "${datadir}"
fi
# Delete any temp file:
rm -f "${datadir}/temp.log"
read -p "Please enter the url you want to add to the podcast list: " url
# 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 - | xsltproc parse_enclosure.xsl - 2> /dev/null) || file=$(wget -q $podcast -O - | tr '\r' '\n' | tr \' " | sed -n 's/.*url="\([^"]*\)".*/\1/p')
for furl in "${file}"
do
if ! grep "${furl}" "${datadir}/podcast.log" > /dev/null
then
wget -q -P ${datadir} "${url}" && echo "${url}" >> "${datadir}/temp.log"
fi
done
done < bp.conf
# Move dynamically created log file to permanent log file:
cat "${datadir}/podcast.log" >> "${datadir}/temp.log"
sort "${datadir}/temp.log" | uniq > "${datadir}/podcast.log"
rm "${datadir}/temp.log"
# Create an m3u playlist:
ls ${datadir} | grep -v m3u > "${datadir}/podcast.m3u"