diff options
Diffstat (limited to 'guix/kolwynia/home/bdunahu/files/.local/bin/fetch-album')
| -rwxr-xr-x | guix/kolwynia/home/bdunahu/files/.local/bin/fetch-album | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/guix/kolwynia/home/bdunahu/files/.local/bin/fetch-album b/guix/kolwynia/home/bdunahu/files/.local/bin/fetch-album deleted file mode 100755 index 3885f88..0000000 --- a/guix/kolwynia/home/bdunahu/files/.local/bin/fetch-album +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -err() { echo "Usage: - rename [OPTIONS] -Options: - -d: delimiter - -a: artist/author - -A: album/book title - -y: year of publication -You will be prompted for these fields if not given." && exit 1 ;} - -[ "$PWD" = "${HOME}/ik/tmp" ] || { echo "Unsafe directory!" && exit 1 ;} - -while getopts "d:a:A:y:" o; do case "${o}" in - d) delimiter="${OPTARG}" ;; - a) artist="${OPTARG}" ;; - A) album="${OPTARG}" ;; - y) year="${OPTARG}" ;; - *) printf "Invalid option: -%s\\n" "$OPTARG" && err ;; - esac done -files=(*) -echo "Reference: ${files[0]}" -[ -z "$delimiter" ] && echo "What are the delimiters for these files?" && read -r delimiter -echo "Which index contains the track title? (Starting from 1)" && read -r index - -[ -z "$artist" ] && echo 'Enter an artist.' && read -r artist -[ -z "$album" ] && echo 'Enter an album.' && read -r album -[ -z "$year" ] && echo 'Enter a year.' && read -r year - -for file in *; -do - extension=$(echo $file | awk -F "." '{print $NF}') - title=$(echo $file | awk -F "${delimiter}" "{print \$${index}}" | - sed -re 's/^[[:blank:]]+|[[:blank:]]+$//g' -e 's/[[:blank:]]+/ /g') - new_file="${title}_${artist}_${album}_${year}.${extension}" - mv "./$file" "./$new_file" - tag-media -a "${artist}" -t "${title}" -A "${album}" -d "${year}" "${new_file}" -done |
