From ae6e57e2d11df3bcc9a6ef3f2664edd5dbe245c6 Mon Sep 17 00:00:00 2001 From: Gabe Farrell Date: Thu, 8 May 2025 11:41:09 +0000 Subject: [PATCH] fkjdioajfd --- .import_music.sh.swp | Bin 0 -> 12288 bytes add_replay_gain.sh | 11 ++++++++--- attach_font_to_all.sh | 32 ++++++++++++++++++++++++++++++++ backup_music.sh | 3 +++ batch_mux_subs.sh | 7 +++++++ import_music.sh | 14 ++++++++++++++ set_artist_and_albumartist.sh | 22 ++++++++++++++++++++++ 7 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 .import_music.sh.swp create mode 100755 attach_font_to_all.sh create mode 100755 backup_music.sh create mode 100755 batch_mux_subs.sh create mode 100755 import_music.sh create mode 100755 set_artist_and_albumartist.sh diff --git a/.import_music.sh.swp b/.import_music.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..c237ff73a94c0570102b1a483ada86773acfbe6a GIT binary patch literal 12288 zcmeI&F>ljA6ae5W3+>QS!N!1INrzSeDX*yhu)e#OgG_RL<96HX`E_(aP>VdC;uHQpskH@5YsdhArbE;S?5Nfg1{} ziYJeE2VryX;Rf8hdve1%yp07|fCX591z3OuSbzmsU=am;vm`!JAg4=8?6;sr%Yu|ly-5o;`<0k_NoEWiRRzyd750xZA+EWiT)l|T>rklSVoTebyl zKS-D;UqQbgK5v7sB*ZCg@D?`Hlh?!Nr-#F%G+`Q)I^##;1X#aJ)*Vm5{)DpJ?r ze0a|!G&Sb3fUzlL8S1DctJdV1aLN5lrq8{I4gGM?D z*yV&Ow7m}+eO~>$JKhb#nXwZCHT4X(gv-m%6>^UNO%W??*~Tktu!czzIKrrU)}k`! z+c2gpr(xk)Tz~>S2B6St=(1F`bg@dv)Y4-~0wDv70^&VRVMMj!5*b}?D3u9N-GDs# zboi9HIZR)@JUR~gRQb444!UXjXuU_Hz0?+t=vSB=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."