hook for recording play

This commit is contained in:
2025-08-24 22:46:34 +02:00
parent f93b85b55e
commit a48a92ca58
6 changed files with 45 additions and 20 deletions

View File

@@ -71,6 +71,11 @@ if [ "${MUSICDIR:-}" ]; then
echo "Playing release $2" >>/tmp/foo
exit 0
fi
if [ "${1:-}" = "--play-recording" ]; then
echo "Playing recording $2" >>/tmp/foo
exit 0
fi
fi
if [ "${1:-}" = "--internal-preview-artist" ]; then
@@ -83,7 +88,8 @@ if [ "${1:-}" = "--internal-reload" ]; then
while [ -f "$LOCKFILE" ]; do
sleep 1
done
cat "$RESULTS"
column -t -s "$(printf '\t')" "$RESULTS" |
sed 's| \+\([0-9a-f-]\+\)$|\t\1|'
exit 0
fi
@@ -256,6 +262,12 @@ if [ "${1:-}" = "--internal-list-releases" ]; then
fi
if [ "${1:-}" = "--internal-list-recordings" ]; then
deco="$(grep "$2" "$LOCALDATA_RELEASES" | cut -d "$(printf '\t')" -f 2)"
if [ "$deco" ]; then
base="$(dirname "$deco")"
rectmp=$(mktemp)
$JQ -r --arg base "$base/" '.tracks | to_entries | map(.key + "\t" + $base + .value) | join("\n")' "$deco" >"$rectmp"
fi
mb_release "$2" |
$JQ -r '.media[] |
.position as $pos |
@@ -270,12 +282,17 @@ if [ "${1:-}" = "--internal-list-recordings" ]; then
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 1,2,5 |
sed 's| \+\([0-9a-f-]\+\)$|\t\1|'
column -t -s "$(printf '\t')" -R 2,3,6 |
sed 's| \+\([0-9a-f-]\+\):\(.*$\)$|\t\1\t\2|'
if [ -f "$rectmp" ]; then
rm -f "$rectmp"
fi
exit 0
fi
@@ -485,6 +502,8 @@ while true; do
--accept-nth="{2}" \
--with-nth="{1}" \
--expect="ctrl-h,ctrl-a" \
--bind="enter:execute-silent:$0 --play-recording {3}" \
--bind="focus:transform:[ {3} ] && echo \"rebind:enter\" || echo \"unbind:enter\"" \
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/track/{r2}' &" \
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up"
)