Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- dirgpodder=YOUR_GPODDER_DOWNLOADS_DIRECTORY
- db=~/.config/gpodder/database.sqlite
- cd $dirgpodder
- for dir in *; do
- if [[ -d "$dir" ]];then
- echo "Processing $dir"
- query='select channels.title from channels where foldername="'$dir'"'
- channel=`sqlite3 "$db" "$query"`
- channel=${channel:-$dir}
- cd "$dir"
- for f in *.mp3; do
- [[ -f "$f" ]] || break
- id3v2 -l "$f" 2>&1 | grep 'No ID3 tag' #> /dev/null
- if [[ $? -eq 0 ]]; then
- query='select episodes.title from channels join episodes on channels.id=channel_id where foldername="'$dir'" and filename="'$f'"'
- title=`sqlite3 "$db" "$query"`
- title=${title:-$f}
- echo "Tagging $dir/$f as $channel, $title"
- id3v2 -2 -a "$channel" -t "$title" "$f"
- # else
- # query='select episodes.title from channels join episodes on channels.id=channel_id where foldername="'$dir'" and filename="'$f'"'
- # title=`sqlite3 "$db" "$query"`
- # title=${title:-$f}
- # echo "Tagging $dir/$f as $channel, $title"
- # id3v2 -2 -a "$channel" -t "$title" "$f"
- fi
- done
- cd ..
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement