package shakuhachi

  1. Overview
  2. Docs
A music collection manager

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.2.0.tar.gz
sha256=966fc8667c2aa9830e64950d2de74bd564a65d60e1f50cfd3dc1e99ef106dc47
sha512=6423ce04d784ba521a7f49fabdafbe036e2dd80cd08ca999fdc6767262d7f12aa4e5002d65efd4c568b343eaabf4d680191c88334d629e1ca0156084531e9e0b

doc/src/shakuhachi.query/substring.ml.html

Source file substring.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(*****************************************************************************)
(*                                                                           *)
(*  Copyright (C) 2026 Yves Ndiaye                                           *)
(*                                                                           *)
(* This Source Code Form is subject to the terms of the Mozilla Public       *)
(* License, v. 2.0. If a copy of the MPL was not distributed with this       *)
(* file, You can obtain one at https://mozilla.org/MPL/2.0/.                 *)
(*                                                                           *)
(*****************************************************************************)

(** Operations on substring node' values *)

(** type of substring node' values *)
type t =
  | STitle
  | SSortName
  | SArtist
  | SAlbum
  | SAlbumArtist
  | SComposer
  | SGenre

(** [assocs] is each substring associated with their key. *)
let assocs =
  [
    (Keys.title, STitle);
    (Keys.sort_name, SSortName);
    (Keys.artist, SArtist);
    (Keys.album, SAlbum);
    (Keys.album_artist, SAlbumArtist);
    (Keys.composer, SComposer);
    (Keys.genre, SGenre);
  ]

(** [to_string substring] is a {!Keys} associated with [substring]. *)
let to_string = function
  | STitle ->
      Keys.title
  | SSortName ->
      Keys.sort_name
  | SArtist ->
      Keys.artist
  | SAlbum ->
      Keys.album
  | SAlbumArtist ->
      Keys.album_artist
  | SComposer ->
      Keys.composer
  | SGenre ->
      Keys.genre

(** [of_string s] tries to parse [s] a key associated with a substring. *)
let of_string t = List.assoc_opt t assocs

(** default list of substring used by {i skhc} when the query.field key in
    configuration file is missing. *)
let default = [ STitle; SSortName; SArtist; SAlbum; SAlbumArtist ]

(** [compare s0 s1] is [Stdlib.compare s0 s1]. *)
let compare : t -> t -> int = Stdlib.compare