diff --git a/.import_music.sh.swp b/.import_music.sh.swp new file mode 100644 index 0000000..c237ff7 Binary files /dev/null and b/.import_music.sh.swp differ diff --git a/add_replay_gain.sh b/add_replay_gain.sh index e587d2a..78dd171 100755 --- a/add_replay_gain.sh +++ b/add_replay_gain.sh @@ -1,9 +1,14 @@ #!/bin/bash +# Adds replay gain tags to the entire music library +# Run this at the root of the music library + +# Directory of your music library (change this if needed) +MUSIC_DIR="." + # Find all directories two levels deep (Artist/Album) containing FLAC files -find . -type f -iname "*.flac" | \ - awk -F/ 'NF>=3 {print $(NF-2) "/" $(NF-1)}' | sort -u | while read -r album_path; do - full_album_path="./$album_path" +find "$MUSIC_DIR" -type f -iname "*.flac" -exec dirname {} \; | sort -u | while read -r album_path; do + full_album_path="$MUSIC_DIR/$album_path" echo "Processing album: $full_album_path" # Run metaflac on all FLAC files in the album directory diff --git a/attach_font_to_all.sh b/attach_font_to_all.sh new file mode 100755 index 0000000..080d72b --- /dev/null +++ b/attach_font_to_all.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Check if correct number of arguments is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 /path/to/font.ttf" + exit 1 +fi + +FONT_FILE="$1" + +# Check if the font file exists +if [ ! -f "$FONT_FILE" ]; then + echo "Error: Font file not found!" + exit 1 +fi + +# Find and process all .mkv files +find . -type f -name "*.mkv" | while read -r mkv_file; do + echo "Processing: $mkv_file" + + mkvpropedit "$mkv_file" \ + --attachment-name "$(basename "$FONT_FILE")" \ + --attachment-mime-type application/x-truetype-font \ + --add-attachment "$FONT_FILE" + + if [ $? -eq 0 ]; then + echo "Successfully added font to: $mkv_file" + else + echo "Failed to add font to: $mkv_file" + fi +done + diff --git a/backup_music.sh b/backup_music.sh new file mode 100755 index 0000000..eb6791e --- /dev/null +++ b/backup_music.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rclone sync --bwlimit=8.5M /mnt/media/Music gabrielhfarrell-drive:MediaLibrary/Music diff --git a/batch_mux_subs.sh b/batch_mux_subs.sh new file mode 100755 index 0000000..9e08703 --- /dev/null +++ b/batch_mux_subs.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for i in *.mkv; do + if [ -f "${i%.*}".eng.srt ] && [ ! -e "${i%.*}"-sub.mkv ]; then + mkvmerge -o "${i%.*}"-sub.mkv "$i" --default-track 0 --language 0:eng "${i%.*}".eng.srt + fi +done diff --git a/import_music.sh b/import_music.sh new file mode 100755 index 0000000..0e017a2 --- /dev/null +++ b/import_music.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# usage: import_music.sh [opts] + +# This script will: +# - find unimported music in $IMPORT_DIR +# - use metaflac to add replay gain to all files +# - (optional w/ --musicbrainz) use MusicBrainz data to tag the files +# - match the artist with a known list of romanized japanese artists, and +# replace the artist tag with the native japanese artist name +# note: the album will still be placed under the romanized name folder +# - copy (or move with --move) the music to $MUSIC_DIR/Artist/Album + + diff --git a/set_artist_and_albumartist.sh b/set_artist_and_albumartist.sh new file mode 100755 index 0000000..f831b81 --- /dev/null +++ b/set_artist_and_albumartist.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Sets Artist and AlbumArtist tags to arg for all .flac in . recursively. + +artist=$1 + +# Ensure metaflac is installed +if ! command -v metaflac &> /dev/null; then + echo "metaflac is required but not installed. Exiting." + exit 1 +fi + +# Find and update all .flac files recursively +find . -type f -iname "*.flac" | while IFS= read -r flac; do + echo "Updating tags in '$flac'..." + metaflac --remove-tag=ALBUMARTIST --remove-tag="ALBUM ARTIST" --remove-tag="ALBUM_ARTIST" "$flac" + metaflac --set-tag="ALBUMARTIST=$artist" "$flac" + metaflac --remove-tag=ARTIST "$flac" + metaflac --set-tag="ARTIST=$artist" "$flac" +done + +echo "All matching FLAC files updated."