about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-07-05 10:04:23 -0700
committerFranck Cuny <franck@fcuny.net>2023-07-05 10:04:23 -0700
commitedacc191f365bd018de4bdafce4d89b689bba04b (patch)
treebb635a97e7a90312d704b302b7f3273fb19b9319
parentchange monospace font back to source code pro (diff)
downloadworld-edacc191f365bd018de4bdafce4d89b689bba04b.tar.gz
various updates related to music collection
Diffstat (limited to '')
-rw-r--r--docs/tools.org39
-rw-r--r--home/profiles/nas.nix58
-rw-r--r--home/profiles/workstation.nix5
3 files changed, 87 insertions, 15 deletions
diff --git a/docs/tools.org b/docs/tools.org
index 8dfebe1..e093f5c 100644
--- a/docs/tools.org
+++ b/docs/tools.org
@@ -126,3 +126,42 @@ json
 #+end_src
 
 and to run it: =exiftool -@ use_json.args <takeout_dir>=
+* beet
+=beet= is a media library management system for music. The main documentation is [[https://beets.readthedocs.io/en/latest/index.html][here]].
+** search
+By album
+#+begin_src shell
+tahoe:~ beet ls album:henry
+Nick Cave & the Bad Seeds - Henry’s Dream - Papa Won’t Leave You, Henry
+Nick Cave & the Bad Seeds - Henry’s Dream - I Had a Dream, Joe
+Nick Cave & the Bad Seeds - Henry’s Dream - Straight to You
+Nick Cave & the Bad Seeds - Henry’s Dream - Brother, My Cup Is Empty
+Nick Cave & the Bad Seeds - Henry’s Dream - Christina the Astonishing
+Nick Cave & the Bad Seeds - Henry’s Dream - When I First Came to Town
+Nick Cave & the Bad Seeds - Henry’s Dream - John Finn’s Wife
+Nick Cave & the Bad Seeds - Henry’s Dream - Loom of the Land
+Nick Cave & the Bad Seeds - Henry’s Dream - Jack the Ripper
+#+end_src
+
+All the albums from 2023
+#+begin_src shell
+tahoe:~ beet ls year:2023 -a
+ALL HANDS_MAKE LIGHT - "Darling the Dawn"
+Big ‡ Brave - Nature Morte
+boygenius - the record
+Ky - Power Is The Pharmacy
+OM - Gebel Barkal / Version
+Joni Void - Everyday Is The Song
+#+end_src
+** Update
+Modify the year for an album:
+#+begin_src shell
+tahoe:~ beet modify path:/data/fast/music/Nick\ Cave\ \&\ the\ Bad\ Seeds/B-Sides\ \&\ Rarities,\ Part\ I year=2005
+Modifying 56 items.
+Nick Cave & Dirty Three - B-Sides & Rarities, Part I - Time Jesum Transeuntum et Non Riverentum
+  year: 2021 -> 2005
+Nick Cave & Shane MacGowan - B-Sides & Rarities, Part I - What a Wonderful World
+  year: 2021 -> 2005
+...
+Really modify, move and write tags? (Yes/no/select) yes
+#+end_src
diff --git a/home/profiles/nas.nix b/home/profiles/nas.nix
index c1e5ca9..d23f60b 100644
--- a/home/profiles/nas.nix
+++ b/home/profiles/nas.nix
@@ -4,15 +4,11 @@ let
     name = "bc-to-beet";
     runtimeInputs = [ pkgs.beets ];
     text = ''
-      ALBUM_PATH="$1"
-      ALBUM_NAME=$(basename "$ALBUM_PATH")
-
-      mkdir -p ~/import
-      rm -rf ~/import/tmp-bc
-      unzip -d ~/import/tmp-bc ~/import/album.zip
-      beet import ~/import/tmp-bc
-      rm -rf ~/import/tmp-bc
-      rm -rf ~/import/album.zip
+      rm -rf ~/import/music/tmp-bc
+      unzip -d ~/import/music/tmp-bc ~/import/music/album.zip
+      beet import ~/import/music/tmp-bc
+      rm -rf ~/import/music/tmp-bc
+      rm -rf ~/import/music/album.zip
     '';
   };
 in
@@ -26,15 +22,51 @@ in
     flac
     abcde
     (pkgs.writers.writeDashBin "rip-flac" ''
-      cd ~/import
-      ${pkgs.abcde}/bin/abcde -Vx -G -a "cddb,read,encode,tag,move,clean" -o flac
+      ${pkgs.abcde}/bin/abcde -c ~/.config/abcde/config
     '')
   ];
 
+  # configuration file for abcde (see man 1 abcde)
+  xdg.configFile."abcde/config".source = pkgs.writeText "config" ''
+    ACTIONS=default,getalbumart
+
+    ALBUMARTFILE="cover.jpg"
+    ALBUMARTTYPE="JPG"
+
+    CDDBMETHOD=musicbrainz
+
+    # cd ripping program
+    CDROMREADERSYNTAX=cdparanoia
+    CDPARANOIA=cdparanoia
+    CDPARANOIAOPTS="--never-skip=10"
+
+    # move here
+    OUTPUTDIR="$HOME/import/music"
+
+    # output type
+    FLACENCODERSYNTAX=flac
+    OUTPUTTYPE=flac
+    FLAC=flac
+    #  --best is the same as -8 (highest compression) (also see -e)
+    FLACOPTS='--verify --best'
+
+    EXTRAVERBOSE=2
+    EJECTCD=y
+    MAXPROCS=4
+
+    post_encode ()
+    {
+      # beets fixes some things (e.g. moving multi-disc albums together) and
+      # adds some extra info (e.g. genres with lastgenre)
+      echo "-------------- beets:"
+      beet import "$HOME/import/music"
+    }
+  '';
+
   programs.beets = {
     enable = true;
     settings = {
-      directory = cfg.musicDirectory;
+      directory = "/data/fast/music";
       plugins =
         "fromfilename discogs duplicates fetchart embedart badfiles lastgenre scrub";
       paths = {
@@ -44,7 +76,7 @@ in
         "albumtype:soundtrack" = "Soundtracks/$album ($year)/$track $title";
       };
       import = {
-        copy = true;
+        copy = false;
         move = true;
       };
       va_name = "Various Artists";
diff --git a/home/profiles/workstation.nix b/home/profiles/workstation.nix
index e33db2d..74c927f 100644
--- a/home/profiles/workstation.nix
+++ b/home/profiles/workstation.nix
@@ -23,8 +23,9 @@ let
 
       NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]')
 
-      scp "$ALBUM_PATH" "$NAS:~/import/album.zip"
-      ssh "$NAS" bc-to-beet ~/import/album.zip
+      ssh "$NAS" mkdir -p ~/import/music
+      scp "$ALBUM_PATH" "$NAS:~/import/music/album.zip"
+      ssh "$NAS" bc-to-beet ~/import/music/album.zip
     '';
   };
 in