File [scripts/check_music_covers.sh]
| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Check that there is an album cover in every album directory |
| 4 |
base_dir=$HOME/Music |
| 5 |
if [ $1 ]; then |
| 6 |
music_dir=$1 |
| 7 |
else |
| 8 |
echo "" |
| 9 |
echo "Please specify a music directory inside ${base_dir}" |
| 10 |
echo "" |
| 11 |
exit 1 |
| 12 |
fi |
| 13 |
tmpy=/tmp/check_music_covers |
| 14 |
# Create a tmp directory for dumps |
| 15 |
if [ ! -d "${tmpy}" ]; then |
| 16 |
mkdir ${tmpy} |
| 17 |
fi |
| 18 |
# Scan through all of the directories |
| 19 |
for this_music_dir in ${music_dir} |
| 20 |
do |
| 21 |
# Scan for artists |
| 22 |
echo "Scanning ${this_music_dir} directory ..." |
| 23 |
ls -1 "${base_dir}/${this_music_dir}" > ${tmpy}/${this_music_dir} |
| 24 |
# Scan for albums |
| 25 |
while read artist |
| 26 |
do |
| 27 |
ls -1 "${base_dir}/${this_music_dir}/${artist}" > ${tmpy}/${this_music_dir}-${artist} |
| 28 |
while read album |
| 29 |
do |
| 30 |
if [ -f "${base_dir}/${this_music_dir}/${artist}/${album}/folder.jpg" ]; then |
| 31 |
if [ "$2" = "-v" ]; then |
| 32 |
echo " ${artist} - ${album} - \"folder.jpg\" found" |
| 33 |
fi |
| 34 |
else |
| 35 |
echo " ${artist} - ${album} - \"folder.jpg\" NOT FOUND" |
| 36 |
fi |
| 37 |
done <${tmpy}/${this_music_dir}-${artist} |
| 38 |
done <${tmpy}/${this_music_dir} |
| 39 |
done |
| 40 |
# Now clean up the tmp area |
| 41 |
""rm -f -R ${tmpy} |



![Validate my Atom 1.0 feed [Valid Atom 1.0]](./images/valids/valid-atom10-yellow.gif)
![Validate my RSS 2.0 feed [Valid RSS 2.0]](./images/valids/valid-rss20-yellow.gif)