1
0
Fork 0

remove empty section in notes

This commit is contained in:
kemonine 2024-06-02 14:46:05 +00:00
parent 5cf9db9589
commit 88c0c5cd3a

View file

@ -1,170 +1,164 @@
* beets * beets
** container build & run ** misc commands
#+begin_src sh - ~beets web # web ui~
- ~beets info --library | less # library data~
#+end_src - ~beets info | less # file data~
- ~beets replaygain # run replay gain checks on all tracks~
** misc commands - ~beets xtractor # run xtractor on all tracks~
- ~beets-flac xt 'mb_trackid::^.+$'~
- ~beets web # web ui~ - ~jq '.metadata.tags' /opt/music/beets/xtraction_data/[uid].json | less~
- ~beets info --library | less # library data~ - ~beets-flac ls -f '$artist - $title - $mb_trackid' 'mb_trackid::^.+$'~
- ~beets info | less # file data~
- ~beets replaygain # run replay gain checks on all tracks~ ** tagging and searches
- ~beets xtractor # run xtractor on all tracks~
- ~beets-flac xt 'mb_trackid::^.+$'~ https://beets.readthedocs.io/en/stable/reference/query.html
- ~jq '.metadata.tags' /opt/music/beets/xtraction_data/[uid].json | less~
- ~beets-flac ls -f '$artist - $title - $mb_trackid' 'mb_trackid::^.+$'~ - use carat (^) to negate queries
- ~beets fields~ to print database fields
** tagging and searches - ~beets describe~ to aggregate queries
- ~beets ls -f '$albumartist - $title - is_mail: $is_male'~
https://beets.readthedocs.io/en/stable/reference/query.html - ~-f~ is for format strings and can be used adjust output string
- can print any fields/tags from library database
- use carat (^) to negate queries - ~beets ls [-a] trust in trance~
- ~beets fields~ to print database fields - ~-a~ prints album info using passed query string ; no ~-a~ prints tracks
- ~beets describe~ to aggregate queries - ~beets ls -p trust in trance~
- ~beets ls -f '$albumartist - $title - is_mail: $is_male'~ - prints paths
- ~-f~ is for format strings and can be used adjust output string - can be used to print album folder path, not just track paths
- can print any fields/tags from library database - ~beets-library info -l -a albumartist:Shinedown sound madness~
- ~beets ls [-a] trust in trance~ - show library data for an album
- ~-a~ prints album info using passed query string ; no ~-a~ prints tracks - remove ~-a~ to operate at item level
- ~beets ls -p trust in trance~
- prints paths - ~beets ls -f '$id - $albumartist - $album - $path' path:/opt/music/beets/dupes/~
- can be used to print album folder path, not just track paths - finds items at a specific path
- ~beets-library info -l -a albumartist:Shinedown sound madness~ - use this to cleanup bad items (deleted dupes/similar)
- show library data for an album - follow up with the following to remove items at the path
- remove ~-a~ to operate at item level - ~beets rm path:/opt/music/beets/dupes/~
- ~beets ls -f '$id - $albumartist - $album - $path' path:/opt/music/beets/dupes/~ - ~beets-library ls -f '$albumartist - $album - $title - $mb_albumid' mb_albumid::^$~
- finds items at a specific path - find all tracks without music brains id
- use this to cleanup bad items (deleted dupes/similar) - add ~-a~ flag to get albums
- follow up with the following to remove items at the path
- ~beets rm path:/opt/music/beets/dupes/~ - ~beets ls -a 'added:2024-05-08'~
- show all albums added on a specific day
- ~beets-library ls -f '$albumartist - $album - $title - $mb_albumid' mb_albumid::^$~ - remove ~-a~ to search by item
- find all tracks without music brains id - ~beets ls -a 'added:-1w..'~
- add ~-a~ flag to get albums - show all albums added in the last week
- remove ~-a~ to search by item
- ~beets ls -a 'added:2024-05-08'~ - ~beets ls -f '$added - $albumartist - $album %ifdef{title, - $title}'~
- show all albums added on a specific day - list when all tracks were added to library
- remove ~-a~ to search by item - using ~-a~ will show for album (this can differ from tracks if 'missing' were filled in later)
- ~beets ls -a 'added:-1w..'~ - ~beets modify [-a] [query] [field=value] [field!]~
- show all albums added in the last week - ~-a~ operates at album level
- remove ~-a~ to search by item - ~field=value~ to set field values
- ~beets ls -f '$added - $albumartist - $album %ifdef{title, - $title}'~ - ~field!~ to remove field from items
- list when all tracks were added to library - ~beets ls my_seed:True~
- using ~-a~ will show for album (this can differ from tracks if 'missing' were filled in later) - show all items with custom tag set to true
- ~beets modify [-a] [query] [field=value] [field!]~ - ~beets ls ^my_seed:True~
- ~-a~ operates at album level - show all items missing custom tag or having it set to false
- ~field=value~ to set field values - ~beets ls my_import:..2~
- ~field!~ to remove field from items - show all items with int field less than or equal to 2
- ~beets ls my_seed:True~ - use ~n..~ for greater than
- show all items with custom tag set to true - omit ~..~ and just give ~n~ to match explicit value
- ~beets ls ^my_seed:True~
- show all items missing custom tag or having it set to false - commands related to replay gain
- ~beets ls my_import:..2~ - ~beets-library ls rg_album_gain::^$~
- show all items with int field less than or equal to 2 - ~beets-library ls rg_track_gain::^$~
- use ~n..~ for greater than #+begin_src sh
- omit ~..~ and just give ~n~ to match explicit value beets-library ls -a -f '$r128_album_gain - $rg_album_gain' \
my_import:[n] ^rg_album_gain::^$ , my_import:[n] ^r128_album_gain::^$
- commands related to replay gain beets-library ls -f '$r128_album_gain - $r128_track_gain - $rg_album_gain - $rg_track_gain' \
- ~beets-library ls rg_album_gain::^$~ my_import:[n] ^rg_track_gain::^$ , my_import:[n] ^r128_track_gain::^$
- ~beets-library ls rg_track_gain::^$~ #+end_src
#+begin_src sh - command to set music brains id and update Metadata accordingly
beets-library ls -a -f '$r128_album_gain - $rg_album_gain' \ - ~beets modify -a $id mb_albumid=blah && beets mbsync...~
my_import:[n] ^rg_album_gain::^$ , my_import:[n] ^r128_album_gain::^$ - ~beets modify $id mb_trackid=blah && beets mbsync...~
beets-library ls -f '$r128_album_gain - $r128_track_gain - $rg_album_gain - $rg_track_gain' \ ** importing new files/tracks/etc (full order of operations)
my_import:[n] ^rg_track_gain::^$ , my_import:[n] ^r128_track_gain::^$
#+end_src #+begin_src sh
- command to set music brains id and update Metadata accordingly # beets commands to run, in order for every import/addition to beets
- ~beets modify -a $id mb_albumid=blah && beets mbsync...~ beets-library unimported # list all the files in the library folder which are not in the beets database
- ~beets modify $id mb_trackid=blah && beets mbsync...~ beets-library describe my_import # check to figure out what the next serial number is for custom import tag
** importing new files/tracks/etc (full order of operations) #beets-library import --set my_import=[n] --set my_seed=[True|False] /opt/music/to_import # main import
beets-library import -l /opt/music/beets/import.log --set my_import=[n] --set my_seed=True /opt/music/to_import
#+begin_src sh #beets-library stats # check library data is ok or at least 'looks reasonable plus or minus dupes or bad tracks'
# beets commands to run, in order for every import/addition to beets #beets-library info --library | less # show file metadata (in bulk)
beets-library unimported # list all the files in the library folder which are not in the beets database beets-library duplicates | uniq -d # check for dupes
beets-library describe my_import # check to figure out what the next serial number is for custom import tag beets-library duplicates --move /opt/music/dupes # remove dupes from lib and move dupes for verification / follow up as appropriate
#beets-library import --set my_import=[n] --set my_seed=[True|False] /opt/music/to_import # main import beets-library unimported # ensure no dangling files in library prior to missing track cleanup
beets-library import -l /opt/music/beets/import.log --set my_import=[n] --set my_seed=True /opt/music/to_import beets-library unimported | xargs -I{} mv {} /opt/music/unimported/ # move unimported 'cruft' out of library for future follow up
#beets-library stats # check library data is ok or at least 'looks reasonable plus or minus dupes or bad tracks' beets-library missing # check for missing tracks
#beets-library info --library | less # show file metadata (in bulk) beets-library ls -f '$albumartist - $album - $path' -a missing:1.. # list all ablums with one or more missing tracks
beets-library duplicates | uniq -d # check for dupes beets-library remove -a missing:1.. # does not change filesystem ; removes albums with missing tracks from library
beets-library duplicates --move /opt/music/dupes # remove dupes from lib and move dupes for verification / follow up as appropriate beets-library unimported # verify this looks appropriate and matches the output from missing
beets-library unimported # ensure no dangling files in library prior to missing track cleanup beets-library unimported | xargs -I{} mv {} /opt/music/missing/ # move missing out of library for future follow up
beets-library unimported | xargs -I{} mv {} /opt/music/unimported/ # move unimported 'cruft' out of library for future follow up beets-library bad my_import:[n] # bad/missing files check
beets-library missing # check for missing tracks beets-library move # move files to library directory
beets-library ls -f '$albumartist - $album - $path' -a missing:1.. # list all ablums with one or more missing tracks beets-library describe my_import # figure out what imorts to process - use as query (filter) with remaining commands
beets-library remove -a missing:1.. # does not change filesystem ; removes albums with missing tracks from library # use my_import:[n].. to filter on import n and later, see query ranges for added options
beets-library unimported # verify this looks appropriate and matches the output from missing # best to add the import filter to below commands to save processing time
beets-library unimported | xargs -I{} mv {} /opt/music/missing/ # move missing out of library for future follow up #beets-library mbsync my_import:[n] # update music brainz data (not stricly required but smart if re-importing or re-exporting in bulk)
beets-library bad my_import:[n] # bad/missing files check beets-library ftintitle my_import:[n] # move 'featured by' to track title
beets-library move # move files to library directory beets-library modify -a my_import:[n] r128_album_gain! rg_album_gain! # wipe album replay gain info in full
beets-library describe my_import # figure out what imorts to process - use as query (filter) with remaining commands beets-library modify my_import:[n] r128_album_gain! r128_track_gain! rg_album_gain! rg_track_gain! # wipe track replay gain info in full
# use my_import:[n].. to filter on import n and later, see query ranges for added options beets-library lastgenre my_import:[n] # pull down last.fm genre stuff
# best to add the import filter to below commands to save processing time beets-library fetchart my_import:[n] # fetch cover art
#beets-library mbsync my_import:[n] # update music brainz data (not stricly required but smart if re-importing or re-exporting in bulk) beets-library fingerprint my_import:[n] # chromaprint analysis
beets-library ftintitle my_import:[n] # move 'featured by' to track title beets-library ls -f '$artist - $title - $acoustid_fingerprint' | less # verify chromaprint worked (optional)
beets-library modify -a my_import:[n] r128_album_gain! rg_album_gain! # wipe album replay gain info in full beets-library xtractor my_import:[n] # essentia data extraction -- music analysis (long runtime)
beets-library modify my_import:[n] r128_album_gain! r128_track_gain! rg_album_gain! rg_track_gain! # wipe track replay gain info in full beets-library ls -f '$artist - $title - $mood_aggressive - $mood_electronic' | less # verify xtractor worked (optional)
beets-library lastgenre my_import:[n] # pull down last.fm genre stuff #\beet --config /opt/music/beets/library.yaml ls -a -f '$albumartist' | uniq | sort > /opt/music/to_import/_artists_for_rg.txt
beets-library fetchart my_import:[n] # fetch cover art #cat /opt/music/to_import/_artists_for_rg.txt | xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain -w -f {}
beets-library fingerprint my_import:[n] # chromaprint analysis # replay gain with -a and non -a form of below for /full/ library replay gain analysis
beets-library ls -f '$artist - $title - $acoustid_fingerprint' | less # verify chromaprint worked (optional) #beets-library -v replaygain -f -a my_import:[n] # do replaygain analysis on albums
beets-library xtractor my_import:[n] # essentia data extraction -- music analysis (long runtime) #beets-library -v replaygain -f my_import:[n] # do replaygain analysis on tracks
beets-library ls -f '$artist - $title - $mood_aggressive - $mood_electronic' | less # verify xtractor worked (optional) # replay gain albums, can be resumed
#\beet --config /opt/music/beets/library.yaml ls -a -f '$albumartist' | uniq | sort > /opt/music/to_import/_artists_for_rg.txt beets-library ls -a -f '$id' my_import:[n] rg_album_gain::^$ | \
#cat /opt/music/to_import/_artists_for_rg.txt | xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain -w -f {} xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain -a id:{}
# replay gain with -a and non -a form of below for /full/ library replay gain analysis # replay gain tracks, can be resumed
#beets-library -v replaygain -f -a my_import:[n] # do replaygain analysis on albums beets-library ls -f '$id' my_import:[n] rg_track_gain::^$ | \
#beets-library -v replaygain -f my_import:[n] # do replaygain analysis on tracks xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain id:{}
# replay gain albums, can be resumed beets-library ls -f '$artist - $title - $rg_album_gain - $rg_track_gain' | less # verify replay gain worked (optional / limited test)
beets-library ls -a -f '$id' my_import:[n] rg_album_gain::^$ | \ beets-library scrub my_import:[n] # scrub file tags & write only beets tracked metadata to files
xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain -a id:{} #beets-library embedart # not needed if calling scrub -- embed cover art in files
# replay gain tracks, can be resumed #beets-library write # not needed if calling scrub -- write changes to files
beets-library ls -f '$id' my_import:[n] rg_track_gain::^$ | \ beets-library move my_import:[n] # re-organize files based on latest metadata
xargs -d "\n" -n1 -o -t -I{} beet --config /opt/music/beets/library.yaml -v replaygain id:{} beets-library alt update airsonic # run conversion for airsonic alternatives profile -- manage the 'compressed audio library' automagically
beets-library ls -f '$artist - $title - $rg_album_gain - $rg_track_gain' | less # verify replay gain worked (optional / limited test) duplicate_alternatives # check for dupes in 'alternatives' area
beets-library scrub my_import:[n] # scrub file tags & write only beets tracked metadata to files #+end_src
#beets-library embedart # not needed if calling scrub -- embed cover art in files
#beets-library write # not needed if calling scrub -- write changes to files ** xtractor json decode exception monkey patch
beets-library move my_import:[n] # re-organize files based on latest metadata
beets-library alt update airsonic # run conversion for airsonic alternatives profile -- manage the 'compressed audio library' automagically #+begin_src python
duplicate_alternatives # check for dupes in 'alternatives' area #~/.local/lib/python3.8/site-packages/beetsplug/xtractor/helper.py
#+end_src def extract_from_output(output_path, target_map: Subview):
"""extracts data from the json file as mapped out in the
** xtractor json decode exception monkey patch `low_level_targets` / `high_level_targets` configuration keys
"""
#+begin_src python data = {}
#~/.local/lib/python3.8/site-packages/beetsplug/xtractor/helper.py
def extract_from_output(output_path, target_map: Subview): if os.path.isfile(output_path):
"""extracts data from the json file as mapped out in the with open(output_path, "r") as json_file:
`low_level_targets` / `high_level_targets` configuration keys audiodata = None
""" try:
data = {} audiodata = json.load(json_file)
except json.decoder.JSONDecodeError:
if os.path.isfile(output_path): print('Error processing ', output_path)
with open(output_path, "r") as json_file: from pathlib import Path
audiodata = None Path(output_path).unlink(missing_ok=True)
try: for key in target_map.keys():
audiodata = json.load(json_file) data[key] = None
except json.decoder.JSONDecodeError: return data
print('Error processing ', output_path) for key in target_map.keys():
from pathlib import Path try:
Path(output_path).unlink(missing_ok=True) val = extract_value_from_audiodata(audiodata, target_map[key])
for key in target_map.keys(): except AttributeError:
data[key] = None val = None
return data
for key in target_map.keys(): data[key] = val
try: else:
val = extract_value_from_audiodata(audiodata, target_map[key]) raise FileNotFoundError("Output file({}) not found!".format(output_path))
except AttributeError:
val = None return data
#+end_src
data[key] = val
else:
raise FileNotFoundError("Output file({}) not found!".format(output_path))
return data
#+end_src