package shakuhachi
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A music collection manager
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.3.3.tar.gz
sha256=7d07b9c7edcd5f5cee242facf4260272c56e56eb34b897888299ceece3e61d57
sha512=305f97d253d39f3b9d260e018d45f2563bea911cb164ad4d40c450e6c21081f1e7cde68203f9be6633b6933e1bad39da8405b99e8ace58adcc07758d37b8f2fd
doc/src/shakuhachi.query/queryArtist.ml.html
Source file queryArtist.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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159(*****************************************************************************) (* *) (* 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/. *) (* *) (*****************************************************************************) include QueryUtil (* TODO: Change the query to compute other field. *) let matches_node _subfields artist node = let id = SkhcDb.Artist.id artist in let name = SkhcDb.Artist.name artist in let sort_name = SkhcDb.Artist.sort_name artist in let flag = SkhcDb.Artist.flag artist in let artwork = SkhcDb.Artist.artwork artist in let rating = SkhcDb.Artist.rating artist in let created_at = SkhcDb.Artist.created_at artist in let modified_at = SkhcDb.Artist.updated_at artist in match node with | Node.Substring s -> let insensible = true in let regex = false in matches ~insensible regex s name || omatches ~insensible regex s sort_name | Field (FString s) -> ( let regex = Field.String.regex s in let insensible = Field.String.insensible s in let field = Field.String.key s in let value = Field.String.value s in match field with | SortName -> omatches ~insensible regex value sort_name | Title -> matches ~insensible regex value name | Artist -> matches ~insensible regex value name | Path -> matches ~insensible regex value name | AlbumArtist -> matches ~insensible regex value name | Composer -> matches ~insensible regex value name | Album -> false | Genre -> false | Arbitrary _ -> false | FileExtension -> false ) | Field (FBool b) -> ( let field = Field.Bool.key b in let b = Field.Bool.value b in match field with | Flag -> flag = b | Art -> let cover = Option.is_some artwork in b = cover ) | Field (FInt64 i64) -> ( let field = Field.Int64.key i64 in let frange = Field.Int64.value i64 in match field with Id -> Range.matches frange id | Size -> false ) | Field (FInt i) -> ( let field = Field.Int.key i in let frange = Field.Int.value i in match field with | Rating -> rating |> Option.map (Range.matches frange) |> Option.value ~default:false | Track | Year | Plays | AlbumCount | Disc | Length -> false ) | Field (FFloat f) -> ( let field = Field.Float.key f in let frange = Field.Float.value f in match field with | AvgDuration | AvgRating | AvgSize -> false | CreatedAt -> Range.matches frange created_at | ModifiedAt -> Range.matches frange modified_at | PlayedAt -> (* When artist query will be more detailled. *) false ) let compare_key (r, key) lhs rhs = let lhs, rhs = if r then (rhs, lhs) else (lhs, rhs) in let cmp c f lhs rhs = c (f lhs) (f rhs) in let ocmp c f lhs rhs = Option.compare c (f lhs) (f rhs) in match key with | Field.(FString s) -> ( let field = Field.String.key s in match field with | SortName -> ocmp String.compare SkhcDb.Artist.sort_name lhs rhs | Title | Artist | Path | AlbumArtist | Composer -> cmp String.compare SkhcDb.Artist.name lhs rhs | Album -> 0 | Genre -> 0 | Arbitrary _ -> 0 | FileExtension -> 0 ) | FBool b -> ( let field = Field.Bool.key b in match field with | Flag -> cmp Bool.compare SkhcDb.Artist.flag lhs rhs | Art -> cmp Bool.compare (fun s -> Option.is_some @@ SkhcDb.Artist.artwork s) lhs rhs ) | FInt64 i64 -> ( let field = Field.Int64.key i64 in match field with | Id -> cmp Int64.compare SkhcDb.Artist.id lhs rhs | Size -> 0 ) | FInt i -> ( let field = Field.Int.key i in match field with | Rating -> ocmp Int.compare SkhcDb.Artist.rating lhs rhs | Track | Year | Plays | AlbumCount | Disc | Length -> 0 ) | FFloat f -> ( let field = Field.Float.key f in match field with | AvgDuration | AvgRating | AvgSize -> 0 | CreatedAt -> cmp Float.compare SkhcDb.Artist.created_at lhs rhs | ModifiedAt -> cmp Float.compare SkhcDb.Artist.updated_at lhs rhs | PlayedAt -> 0 )
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>