transfer_podcasts.sh (1206B)
1 #!/usr/bin/env bash
2
3 # download all podcasts
4 echo "Downloading Podcast Episodes in the Queue..."
5 podboat -a
6
7 # Adjust ID3 Tags from all downloaded files;
8 # add the "Podcast" Pseudo-Artist
9 # add the Podcast Name as Pseudo-Album
10 # add the file / episode name as track title
11 echo "Adjust ID3 tags..."
12 find ~/Podcasts/ -type f -print | while read file; do
13 podcast=$(basename "`dirname "${file}"`")
14 episode=$(basename "${file}")
15 eyeD3 --quiet --preserve-file-times \
16 --artist "Podcast" \
17 --album "$podcast" \
18 --title "$episode" \
19 "${file}" > /dev/null
20 done
21
22 # transfer all files to MP3 player
23 target="/media/$USER/M10"
24 if [[ ! -d $target ]]; then
25
26 # change to podcast directory
27 cd ~/Podcasts/
28
29 # cycle through each media file one-by-one
30 echo "Send Downloaded Episodes to ${target}/PODCASTS/ ..."
31 find ./ -type f -print | while read file; do
32
33 # clean up the filename for allowed characters
34 file_clean=$(echo ${file} | sed -e 's/[^a-zA-Z0-9\_\-\.\ \/]/_/g');
35
36 mkdir -p "${target}/PODCASTS/$(dirname "${file_clean}")" && \
37 cp --verbose --update=none --no-clobber \
38 "${file}" "${target}/PODCASTS/${file_clean}"
39
40 done
41
42 fi
43
44 echo "Done! Enjoy listening!"
45
46 # EOF