Skip to content

Instantly share code, notes, and snippets.

@mcrosson
Created July 11, 2024 13:43
Show Gist options
  • Save mcrosson/95af9956a794f70de1bbc73528873a44 to your computer and use it in GitHub Desktop.
Save mcrosson/95af9956a794f70de1bbc73528873a44 to your computer and use it in GitHub Desktop.
##########
# import
##########
# figure out what import number this is
beets-library describe import
# import tracks (watch out for ~seed~)
beets-library import -l /opt/music/beets/import.log --set import=[n] /opt/music/to_import
##########
# initial processing / data move
##########
# move 'featured by' to track title prior to move so move is run only once
beets-library ftintitle import:[n]
# move files to library directory
beets-library move import:[n]
##########
# cleanup jpg files & empty folders
##########
find /opt/music/to_import -type f -iname \*.jpg -delete
find /opt/music/to_import -depth -empty -type d -delete
##########
# misc cleanup / bad file check
##########
# pre-flight 'junk' move prior to delete
mkdir /opt/music/to_import/_delete_me
mv /opt/music/to_import/* /opt/music/to_import/_delete_me/
# bad/missing files check
beets-library bad import:[n]
# delete 'junk' files from import zone
rm -r /opt/music/to_import/_delete_me
##########
# litmus tests (optional)
##########
# check for dupes
beets-library duplicates | uniq -d
# remove dupes from lib and move dupes for verification / follow up as appropriate
beets-library duplicates --move /opt/music/dupes
# ensure no dangling files in library prior to missing track cleanup
beets-library unimported
beets-library unimported | xargs -I{} mv {} /opt/music/unimported/
# check for missing tracks
beets-library missing
# list all ablums with one or more missing tracks
beets-library ls -f '$albumartist - $album - $path' -a missing:1..
# does not change filesystem ; removes albums with missing tracks from library
beets-library remove -a missing:1..
# verify this looks appropriate and matches the output from missing
beets-library unimported
# move missing out of library for future follow up
beets-library unimported | xargs -I{} mv {} /opt/music/missing/
##########
# main processing
##########
# pull down last.fm genre stuff
beets-library lastgenre import:[n]
# fetch cover art
beets-library fetchart import:[n]
# chromaprint analysis
beets-library fingerprint import:[n]
# essentia data extraction -- music analysis (long runtime)
beets-library xtractor import:[n]
# replay gain for albums (long runtime)
beets-library ls -a -f '$id' import:[n] | \
xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain -a -f id:{}
# replay gain for tracks (longe runtime)
beets-library ls -f '$id' import:[n] | \
xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain -f id:{}
##########
# cleanup files & generate files for music server
##########
# scrub file tags & write only beets tracked metadata to files
beets-library scrub import:[n]
# run conversion for airsonic alternatives profile -- manage the 'compressed audio library' automagically
beets-library alt update airsonic
# check for dupes in 'alternatives' area
duplicate_alternatives
##########
# litmus test
##########
# check library data is ok or at least 'looks reasonable plus or minus dupes or bad tracks'
beets-library stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment