diff --git a/scripts/flac.sh b/scripts/flac.sh deleted file mode 100644 index cf65d45..0000000 --- a/scripts/flac.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Variables for color print. -GREEN="\e[32m" -CYAN="\e[36m" -END="\e[0m" - -# Get filename and extension. -name="${snakemake_input[0]##*/}" -ext="${name##*.}" - -printf "%b: %s\r" "${CYAN}[ i ]${END} Encoding file" "${name}" - -if [[ "${ext}" != ".flac" ]] -then - ffmpeg \ - -i "${snakemake_input[0]}" \ - -vn \ - -c:a flac \ - -hide_banner \ - -loglevel error \ - "${snakemake_output[0]}" -else - cp "${snakemake_input[0]}" "${snakemake_output[0]}" -fi - -printf "%b: %s\r" "${GREEN}[ ✓ ]${END} Finished encoding file" "${name}" diff --git a/src/01__metadata.sh b/src/01__metadata.sh deleted file mode 100755 index 9dbbe9d..0000000 --- a/src/01__metadata.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Variables for color print. -GREEN="\e[32m" -RED="\e[31m" -CYAN="\e[36m" -END="\e[0m" - -# Get command line arguments. -while getopts i:o: flag -do - case "${flag}" in - i) input_metadata=${OPTARG};; - o) output_dir=${OPTARG};; - *) printf "%b\n" "${RED}[ ! ]${END} Invalid Argument" - exit 1;; - esac -done - -{ - # Skip header line of .tsv. - read -r - - while IFS=$'\t' read -r code extension track title artist album year disc artwork - do - file_path="${output_dir}/${code}.txt" - - printf "%b: %s\r" "${CYAN}[ i ]${END} Processing file" "${code}${extension}" - - # Create metadata file. - touch "${file_path}" - - # Write metadata to file. - { - printf "%s\t" "${extension}" - printf "%s\t" "${track}" - printf "%s\t" "${title}" - printf "%s\t" "${artist}" - printf "%s\t" "${album}" - printf "%s\t" "${year}" - printf "%s\t" "${disc}" - printf "%s" "${artwork}" - } >> "${file_path}" - - printf "%b: %s\n" "${GREEN}[ ✓ ]${END} Generated metadata file for" "${code}${extension}" - done -} < "${input_metadata}" diff --git a/src/02__encode.sh b/src/02__encode.sh deleted file mode 100755 index 0c99b96..0000000 --- a/src/02__encode.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -# Variables for color print. -GREEN="\e[32m" -RED="\e[31m" -CYAN="\e[36m" -END="\e[0m" - -# Get command line arguments. -while getopts i:m:a:o: flag -do - case "${flag}" in - i) input_file=${OPTARG};; - m) input_metadata=${OPTARG};; - a) artwork_dir=${OPTARG};; - o) output_file=${OPTARG};; - *) printf "%b\n" "${RED}[ ! ]${END} Invalid Argument" - exit 1;; - esac -done - -printf "%b: %s\r" "${CYAN}[ i ]${END} Encoding file" "${input_file}" - -# Read file metadata. -IFS=$'\t' read -r extension track title artist album year disc artwork < "${input_metadata}" - -if [[ "${extension}" != ".flac" ]] -then - ffmpeg \ - -i "${input_file}" \ - -vn\ - -c:a flac \ - -hide_banner \ - -loglevel error \ - "${output_file}" -else - cp "${input_file}" "${output_file}" -fi - -# Remove any exsiting metadata. -metaflac \ - --remove-all-tags \ - "${output_file}" - -# Remove any album artwork. -metaflac \ - --remove \ - --block-type=PICTURE,PADDING \ - --dont-use-padding \ - "${output_file}" - -metaflac \ - --remove-tag=COVERART \ - --dont-use-padding \ - "${output_file}" - -# Write new metadata. -metaflac \ - --set-tag=ALBUM="${album}" \ - --set-tag=ARTIST="${artist}" \ - --set-tag=TITLE="${title}" \ - --set-tag=TRACKNUMBER="${track}" \ - --set-tag=DATE="${year}" \ - --set-tag=DISCNUMBER="${disc}" \ - --import-picture-from="${artwork_dir}/${artwork}" \ - "${output_file}" - -printf "%b: %s\n" "${GREEN}[ ✓ ]${END} Succesfully encoded file" "${input_file}" diff --git a/src/install.sh b/src/install.sh deleted file mode 100755 index 21c96dc..0000000 --- a/src/install.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# Variables for color print. -GREEN="\e[32m" -RED="\e[31m" -CYAN="\e[36m" -END="\e[0m" - -# Get command line arguments. -while getopts r:m:i: flag -do - case "${flag}" in - r) encode_dir=${OPTARG};; - m) metadata_dir=${OPTARG};; - i) install_dir=${OPTARG};; - *) printf "%b\n" "${RED}[ ! ]${END} Invalid Argument" - exit 1;; - esac -done - -# Create install directory (if it does not exist). -mkdir -p "${install_dir}" - -for file in "${metadata_dir}"/*.txt -do - # Read file metadata. - IFS=$'\t' read -r extension track title artist album year disc artwork < "${file}" - - # Get filename without extension. - filename=$(basename "${file}" ".txt") - - # Replace any '/' with '-' in the song title. - title="${title//\//-}" - - # Add leading zeroes to disc number. - disc_num=$(printf "%02d" "${disc}") - - # Add leading zeroes to track number. - track_num=$(printf "%02d" "${track}") - - # Create album directory (if it does not exist). - mkdir -p "${install_dir}/${album}" - - # Copy file to installation directory and rename. - cp "${encode_dir}/${filename}.flac" \ - "${install_dir}/${album}/${disc_num}-${track_num} - ${title}.flac" - - printf "%b: %s\n" "${GREEN}[ ✓ ]${END} Succesfully installed file" "${filename}" -done