imprv: code ref

This commit is contained in:
2025-08-28 10:30:57 +02:00
parent 34628fc9b0
commit 28f6dc67ba
2 changed files with 44 additions and 11 deletions

View File

@@ -539,17 +539,7 @@ while true; do
"$MODE_SELECT_ARTIST")
sel=$(
echo "$args" |
$JQ -r 'map([.artist.id, .artist.type, .name] | join("\t")) | join("\n")' |
awk \
-F "\t" \
-v file_local_artists="${LOCALDATA_ARTISTS:-}" \
-v format_person="$AV_PERSON" \
-v format_group="$AV_GROUP" \
-v format_disambiguation="$AV_DISAMBIGUATION" \
-v format_local="$FORMAT_LOCAL" \
"$AWK_ARTISTS" |
column -t -s "$(printf '\t')" |
sed 's| \+\([0-9a-f-]\+\)$|\t\1|' |
list_artists_from_json |
$FZF \
--bind="$KEYS_HALFPAGE_DOWN,$KEYS_HALFPAGE_UP,\
$KEYS_BROWSE,\

View File

@@ -165,3 +165,46 @@ generate_playlist() {
sort_by([.pos, .number]) |
map($base + "/" + .file)[]'
}
# Generate artist list from JSON
list_artists_from_json() {
cat |
$JQ -r 'map([.artist.id, .artist.type, .name] | join("\t")) | join("\n")' |
awk \
-F "\t" \
-v file_local_artists="${LOCALDATA_ARTISTS:-}" \
-v format_person="$AV_PERSON" \
-v format_group="$AV_GROUP" \
-v format_disambiguation="$AV_DISAMBIGUATION" \
-v format_local="$FORMAT_LOCAL" \
"$AWK_ARTISTS" |
column -t -s "$(printf '\t')" |
sed 's| \+\([0-9a-f-]\+\)$|\t\1|'
}
# Generate playlist
list_playlist() {
count=$(mpv_playlist_count)
# mb_release "$1" |
# $JQ -r '.media[] |
# .position as $pos |
# .tracks[] | [
# .id,
# $pos,
# .number,
# .length,
# .recording.title,
# (.recording."artist-credit" | map([.name, .joinphrase] | join("")) | join(""))
# ] |
# join("\t")' |
# awk \
# -F "\t" \
# -v file_local_recordings="${rectmp:-}" \
# -v format="$REC_FORMAT" \
# -v format_local="$FORMAT_LOCAL" \
# "$AWK_RECORDINGS" |
# sort -k1,1n -k2,2g |
# cut -d "$(printf '\t')" -f 2- |
# column -t -s "$(printf '\t')" -R 2,3,6 |
# sed 's| \+\([0-9a-f-]\+\):\(.*$\)$|\t\1\t\2|'
}