gonna uncomplect
This commit is contained in:
commit
ce07ab9308
3 changed files with 107 additions and 0 deletions
40
flake.lock
Normal file
40
flake.lock
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-schemas": {
|
||||
"locked": {
|
||||
"lastModified": 1697467827,
|
||||
"narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=",
|
||||
"rev": "764932025c817d4e500a8d2a4d8c565563923d29",
|
||||
"revCount": 29,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1712867921,
|
||||
"narHash": "sha256-edTFV4KldkCMdViC/rmpJa7oLIU8SE/S35lh/ukC7bg=",
|
||||
"rev": "51651a540816273b67bc4dedea2d37d116c5f7fe",
|
||||
"revCount": 557634,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.557634%2Brev-51651a540816273b67bc4dedea2d37d116c5f7fe/018ed69f-a175-7ab0-bc05-651225022c5a/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-schemas": "flake-schemas",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
29
flake.nix
Normal file
29
flake.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.9)
|
||||
{
|
||||
inputs = {
|
||||
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
||||
};
|
||||
outputs = { self, flake-schemas, nixpkgs }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
});
|
||||
in {
|
||||
schemas = flake-schemas.schemas;
|
||||
|
||||
devShells = forEachSupportedSystem ({ pkgs }: {
|
||||
default = pkgs.mkShell {
|
||||
|
||||
packages = with pkgs; [
|
||||
nixpkgs-fmt
|
||||
];
|
||||
|
||||
LD_LIBRARY_PATH=pkgs.lib.makeLibraryPath [ pkgs.openssl pkgs.libyaml ];
|
||||
# not necessary
|
||||
# LIBRARY_PATH="${pkgs.raylib}/include";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
38
hsmusic.lisp
Normal file
38
hsmusic.lisp
Normal file
|
@ -0,0 +1,38 @@
|
|||
(ql:quickload '(:cl-yaml :alexandria :cl-graph :cl-ppcre))
|
||||
(defpackage :hsmusic
|
||||
(:use :common-lisp :alexandria :cl-graph))
|
||||
(in-package :hsmusic)
|
||||
|
||||
(defparameter tracks
|
||||
(loop for path in (directory #p"album/*.yaml")
|
||||
appending (loop for entry in (yaml:parse path :multi-document-p t)
|
||||
when (and (not (symbolp entry)) (gethash "Track" entry))
|
||||
collect entry)))
|
||||
|
||||
; terrible, idc
|
||||
; lossy! (not surprising)
|
||||
(defun normalize-name (name)
|
||||
(ppcre:regex-replace-all
|
||||
"(^track:|\W)"
|
||||
(sb-unicode:normalize-string (string-downcase name) :nfkd)
|
||||
""))
|
||||
|
||||
(defparameter graph (containers:make-container 'graph-container :default-edge-type :directed))
|
||||
|
||||
(loop for track in tracks
|
||||
do
|
||||
(loop for ref in (append (gethash "Referenced Tracks" track) (gethash "Sampled Tracks" track))
|
||||
do (format t "~a -> ~a~%" (normalize-name (gethash "Track" track)) (normalize-name ref))
|
||||
do (add-edge-between-vertexes
|
||||
graph
|
||||
(normalize-name (gethash "Track" track))
|
||||
(normalize-name ref))))
|
||||
|
||||
(defun track-vertex (name)
|
||||
(find-vertex-if graph (lambda (x) (equal (slot-value x 'element) (normalize-name name)))))
|
||||
|
||||
; instead of this whole graph thing, i *could* do an alist
|
||||
; rassoc exists
|
||||
; BUT the graph library has :o algorithms :o
|
||||
; BUT still would be faster than 1st attempt
|
||||
|
Loading…
Reference in a new issue