I download my podcasts that I listen to using gpodder, but really you could modify the script for whatever... it is all just basic bash after all...
what it does is simply converts the episodes to a format rockbox can read and syns them onto or off the the ipod nano... feel free to take and modify and post back if you add a cool stuff
#!/bin/bash
iPodMount="ipod mount point"; #change this to your ipod mount point
gPodderFolder="$HOME/gpodder-downloads"; #change this to your podcast directory
convertEp() {
if [ ! -d "$gPodderFolder/$1/$Rockbox" ]; then mkdir "$gPodderFolder/$1/$Rockbox"; fi
cd "$HOME/Music/gpodder-downloads/$1"
# lets convert all the video files into a format rockbox can play
for f1 in *.mp4; do
f2="${f1%.mp4}.mpeg"
if [ ! -f "Rockbox/$f2" ]; then
avconv -i "$f1" -r 20 -s 176x100 -vcodec mpeg1video -b 250k -ab 92k -ac 2 -ar 44100 -acodec libmp3lame "Rockbox/${f1%.mp4}.mpeg" 2> /dev/null
fi
done
# here we are just going to delete rockbox files that have been removed from gpodder
# I dont need to bother about ogg files since rockbox can read those as downloaded
cd "$HOME/Music/gpodder-downloads/$1/Rockbox"
for rockfile in *.mpeg; do
originalFileName="${rockfile%.mpeg}.mp4"
if [ ! -f "$HOME/Music/gpodder-downloads/$1/$originalFileName" ]; then
rm -v "$rockfile" 2> /dev/null;
fi
done
}
syncEp() {
if [ ! -d "$iPodMount/$1" ]; then mkdir "$iPodMount/$1"; fi
# Lets check both video and audio to see if there are any new files to transfer to ipod
# first the video
if [ $2 == 'video' ]; then
cd "$gPodderFolder/$1/Rockbox";
for rockfile in *.mpeg; do
if [ ! -f "$iPodMount/$1/$rockfile" ]; then
cp -v "$rockfile" "$iPodMount/$1/$rockfile" 2> /dev/null;
fi
done
fi
# now for the audio
if [ $2 == 'audio' ]; then
cd "$gPodderFolder/$1";
for rockfile in *.ogg; do
if [ ! -f "$iPodMount/$1/$rockfile" ]; then
if [ $rockfile != '*.ogg' ]; then cp -v "$rockfile" "$iPodMount/$1/$rockfile" 2> /dev/null; fi
fi
done
fi
# now that we've transferred over new files.... lets see if we can dump any from the ipod
# also we'll get rid of any unused folers, will make it easier to see where eps are on the ipod
# first the video
if [ $2 == 'video' ]; then
cd "$iPodMount/$1";
for rockfile in *.mpeg; do
if [ ! -f "$gPodderFolder/$1/Rockbox/$rockfile" ]; then rm -vvv $rockfile 2> /dev/null; fi
done
rmdir "$iPodMount/$1" 2> /dev/null
fi
# now the audio
if [ $2 == 'audio' ]; then
cd "$iPodMount/$1";
for rockfile in *.ogg; do
if [ ! -f "$gPodderFolder/$1/$rockfile" ]; then rm -vvv $rockfile 2> /dev/null; fi
done
rmdir "$iPodMount/$1" 2> /dev/null
fi
}
# if I just want to convert without touching the ipod (it might not be plugged in)
# so I'll type in at the terminal (without quotes) "scriptName both"
if [ $1 == convert ]; then
convertEp 'folder 1'
convertEp 'folder 2'
#and so on......
fi
# if I want to just sync files to the ipod that are currently
# in a format that the ipod can play without doing any converting
# since I might be in a rush and converting takes time
# so I'll type in at the terminal (without quotes) "scriptName both"
if [ $1 == sync ]; then
syncEp 'folder 1'
syncEp 'folder 2'
#and so on......
fi
# sometimes I might just want it to do both....
# so I'll type in at the terminal (without quotes) "scriptName both"
if [ $1 == both ]; then
convertEp 'folder 1'
convertEp 'folder 2'
#and so on......
syncEp 'folder 1'
syncEp 'folder 2'
#and so on......
fi