#!/bin/bash #Variables! db1="/media/Music/Downloaded/Torrents/.torrent-sorter-ignore" db2="/media/Music/Downloaded/Torrents/.torrent-sorter-tmp" db3="/media/Music/Downloaded/Torrents/.torrent-sorter-tmp2" datadir="/media/Music/Downloaded/Torrents/" linkdir="/media/Music" zenitycommand= rm "$db2" &>/dev/null touch "$db2" #test="initial value" #unsorted=$(find "$datadir" -maxdepth 1 -type d -print | sort) # sorted=$(find "$linkdir" -maxdepth 1 -lname "*" -printf "%l\n") #find "/media/Music" -maxdepth 1 -lname "*" -printf "%l\n" | while read file; do found=0 test="woot" # echo $test while read line; do if [[ "$line" == "$file" ]]; then found=1 fi done < <(find "$linkdir" -maxdepth 1 -lname "*" -printf "%l\n") if [[ $found != 1 ]]; then found2=0 while read line2; do test=$test3 if [[ "$line2" == "$file" ]]; then found2=1 fi done < "$db1" if [[ $found2 != 1 ]]; then length=${#datadir} writeit="${file: $length}" if [[ $writeit != "" ]]; then echo "" >> $db2 echo "$writeit" >> $db2 fi fi fi done < <(find "$datadir" -maxdepth 1 -type d -print | sort) output=$(cat $db2 | zenity --list --text "Select which directories to symlink" --checklist --column " " --column "Name") #echo $output OFS=IFS IFS=\| ; for line in $output; do x=(*.mp3) mp3=${x[0]} while read tag; do case "$tag" in artist:*) artist=${line#*: };; album:*) album=${line#*: } ;; year:*) year=${line#*: } ;; esac; echo "$tag" done < <(id3ed -i "$mp3" | tr -s '/' '-' | tr '[:upper:]' '[:lower:]') echo "$mp3" echo "$artist - $year - $album" done IFS=$OFS #echo "$zenitycommand" > $db2 #echo $zenitycommand #zenity --list --text "Select which directories to symlink" --checklist --column " " --column "Name" $zenitycommand #echo "lol $test" #echo $zenitycommand #output=$(zenity --list --text "Select which directories to symlink" --checklist --column " " --column "Name" $zenitycommand)