From 9968200684a5438b494239368198f6935ef678cf Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 001/104] extras: Update extras/mpvc-autostart --- extras/mpvc-autostart | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-autostart b/extras/mpvc-autostart index b9b37919..da147991 100755 --- a/extras/mpvc-autostart +++ b/extras/mpvc-autostart @@ -4,6 +4,7 @@ # @description mpvc auto pause/resume audio based on device presence # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From 54857b689ca52b8a4181c80903e631b843e36faf Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 002/104] extras: Update extras/mpvc-chapter --- extras/mpvc-chapter | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-chapter b/extras/mpvc-chapter index dbfd0c31..30fe565c 100755 --- a/extras/mpvc-chapter +++ b/extras/mpvc-chapter @@ -4,6 +4,7 @@ # @description mpvc chapter helper utils (see mpvc chapter-list instead) # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From 44584d3a95634bc8a54492a81732b1e11c3976df Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 003/104] extras: Update extras/mpvc-cut --- extras/mpvc-cut | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-cut b/extras/mpvc-cut index 9a608c6d..0f8365c9 100755 --- a/extras/mpvc-cut +++ b/extras/mpvc-cut @@ -4,6 +4,7 @@ # @description mpvc cuts playing media between ab-loop points (idea from lwillets) # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From 821ec78ad6c76ea5d0c97d9d467febf0a43d2bdf Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 004/104] extras: Update extras/mpvc-equalizer --- extras/mpvc-equalizer | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-equalizer b/extras/mpvc-equalizer index 9e35623b..4b020ce6 100755 --- a/extras/mpvc-equalizer +++ b/extras/mpvc-equalizer @@ -4,6 +4,7 @@ # @description mpvc equalizer based on firequalizer15.lua # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From cea4a531ad792258cf31fada6522993341f8a6cf Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 005/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index dc870041..978b478a 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -4,6 +4,7 @@ # @description mpvc fzf, mpv terminal user interface # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From b6962c9ea2ffee501327d852c3a194927a1874c9 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 006/104] extras: Update extras/mpvc-installer --- extras/mpvc-installer | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-installer b/extras/mpvc-installer index 7bc1cc87..90972c8f 100755 --- a/extras/mpvc-installer +++ b/extras/mpvc-installer @@ -5,6 +5,7 @@ # @description mpvc installer # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From 178fe4fcbcb248c4c863ee775f4ebb9c4eff15e2 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 007/104] extras: Update extras/mpvc-mpris --- extras/mpvc-mpris | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-mpris b/extras/mpvc-mpris index 18fd469a..c2d25665 100755 --- a/extras/mpvc-mpris +++ b/extras/mpvc-mpris @@ -4,6 +4,7 @@ # @description mpvc-mpris speaks MPRIS to control mplayer through key-bindings # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From 684e1b76d9c502e376426f2d7ce338f7a292b75a Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 008/104] extras: Update extras/mpvc-now --- extras/mpvc-now | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-now b/extras/mpvc-now index 4b78af57..222a8983 100755 --- a/extras/mpvc-now +++ b/extras/mpvc-now @@ -4,6 +4,7 @@ # @description mpvc-now get a shareable URL to the "now listening" playlist # @author gmt4 (c) Copyright 2024 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From eceecefd928f4154dcbff6409f0583179c66fca5 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 009/104] extras: Update extras/mpvc-tui --- extras/mpvc-tui | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-tui b/extras/mpvc-tui index 3b207649..aaa1dc7e 100755 --- a/extras/mpvc-tui +++ b/extras/mpvc-tui @@ -4,6 +4,7 @@ # @description mpvc tui, mpv terminal user interface # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # PROGNAME=${0##*/} From 979276c04119c64137c3489a41c8b76af386d0bc Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:40:49 +0200 Subject: [PATCH 010/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-web b/extras/mpvc-web index 5337bc63..09fe0275 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -4,6 +4,7 @@ # @description mpvc web, A hack to remotely control mpvc from web/http # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # # REMEMBER This is a hack, DISCLAIMER * Use at Your Own Risk * From 7adb4904129cc9407c29f0842b2a676415cd6c67 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:42:52 +0200 Subject: [PATCH 011/104] extras: Update extras/win32/socat.bat --- extras/win32/socat.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/win32/socat.bat b/extras/win32/socat.bat index 7a865da8..a5dd2162 100644 --- a/extras/win32/socat.bat +++ b/extras/win32/socat.bat @@ -3,6 +3,7 @@ :: @description mimic socat over win32 named pipe for mpvc :: @author gmt4 (c) Copyright 2022 GPLv2+ :: @url github.com/gmt4/mpvc +:: SPDX-License-Identifier: GPL-2.0-or-later :: @echo off From e1251d0edb402353c65f57cd2511ec98a92f7fd8 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:42:52 +0200 Subject: [PATCH 012/104] extras: Update extras/win32/socat.ps1 --- extras/win32/socat.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/win32/socat.ps1 b/extras/win32/socat.ps1 index 3f5e23ab..085831dd 100644 --- a/extras/win32/socat.ps1 +++ b/extras/win32/socat.ps1 @@ -3,6 +3,7 @@ # @description mimic socat over win32 named pipe for mpvc # @author gmt4 (c) Copyright 2022 GPLv2+ # @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later # # Disclaimer: this is a kludge written because I could not find any other tool that did the job. From 84e3ab34778384844fa1f2395fa40f20bd1a1b9b Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:38:03 +0200 Subject: [PATCH 013/104] extras: Add extras/mpvc-cast --- extras/mpvc-cast | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 extras/mpvc-cast diff --git a/extras/mpvc-cast b/extras/mpvc-cast new file mode 100755 index 00000000..7fb7ec2a --- /dev/null +++ b/extras/mpvc-cast @@ -0,0 +1,60 @@ +#!/usr/bin/env sh +# +# @file mpvc-cast +# @description mpvc cast, mpv screen cast recorder +# @author gmt4 (c) Copyright 2022 GPLv2+ +# @url github.com/gmt4/mpvc +# SPDX-License-Identifier: GPL-2.0-or-later +# + +PROGNAME=${0##*/} +PROGVERSION="v1.5" +PROGAUTHOR=gmt4 +PROGURL="https://github.com/gmt4/mpvc" +SITEURL="https://gmt4.github.io/mpvc" + +set -euf + +mpvc_screencast() +{ + vres=$(xrandr | awk ' + /^Screen 0: .* current .*/ { + r=$0; sub("^.* current ","",r); sub(", maximum .*$","",r); gsub(" ","",r); print r; exit + }' + ) + + asrc=$(pactl list sources | awk ' + /^Source #.*/ { + s=$2; sub("#","",s);} / *Description: Monitor of Built-in Audio Analog Stereo/ {print s; exit + }' + ) + + fout="mpvc-cast-$(date -Isec | sed 's/:/-/g').mkv" + + loglevel=${loglevel:-warning} + framerate=${framerate:-25} + + if [ -z "$vres" ]; then usage; fi + if [ -z "$asrc" ]; then usage; fi + + echo "# $PROGNAME: recording vres $vres asrc $asrc to $fout (ctl+c to finish)" + ffmpeg -hide_banner -loglevel "$loglevel" -video_size "$vres" -framerate "$framerate" -f x11grab -i :0.0 -f pulse -ac 2 -i "$asrc" "$fout" +} + +usage() +{ + echo "usage: $PROGNAME [cast|help] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL" + exit +} + +main() +{ + [ $# -lt 1 ] && usage + + case "$1" in + cast) mpvc_screencast "$@" ;; + *) usage;; + esac +} + +main "$@" From 003dfa027d3b046fc7d48a33c9945ad4181f3f17 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:38:07 +0200 Subject: [PATCH 014/104] extras: Update extras/mpvc-installer --- extras/mpvc-installer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-installer b/extras/mpvc-installer index 90972c8f..6686a1dc 100755 --- a/extras/mpvc-installer +++ b/extras/mpvc-installer @@ -25,7 +25,7 @@ MPV_CONFDIR="${CONFIGDIR:-$HOME/.config/mpv}" DOCS="README.md docs/mpv.conf docs/logbook.html" LICENSES="LICENSE.md" -SCRIPT="mpvc extras/mpvc-tui extras/mpvc-fzf extras/mpvc-cut extras/mpvc-chapter extras/mpvc-mpris extras/mpvc-equalizer extras/mpvc-web extras/mpvc-autostart extras/mpvc-now extras/mpvc-installer" +SCRIPT="mpvc extras/mpvc-tui extras/mpvc-fzf extras/mpvc-cut extras/mpvc-chapter extras/mpvc-mpris extras/mpvc-equalizer extras/mpvc-web extras/mpvc-autostart extras/mpvc-now extras/mpvc-cast extras/mpvc-installer" CONFIG="docs/mpv.conf" mpvc_config() From 1afe942c22d92adb03fed249f246d677cb9b93fe Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:20:11 +0200 Subject: [PATCH 015/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 09fe0275..624c5e40 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -142,7 +142,7 @@ mpvc_web_index() $(if [ -n "${MPVC_WEB_REFRESH:-}" ]; then echo ""; fi) - $PROGNAME @ $MPVC_WEB_HOSTNAME ๐ŸŽง + mpvc @ $MPVC_WEB_HOSTNAME ๐ŸŽง
- $PROGNAME $(mpvc-installer check-update | awk -v progurl=$PROGURL '{ print ""$NF""; }') mpvc-tui for the web + $PROGNAME + $(mpvc-installer version | awk '{print $6}') mpvc for the web /h + #top EOF } + mpvc_web_index_js() { cat < Date: Thu, 18 Jul 2024 09:10:49 +0200 Subject: [PATCH 051/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index d04806c9..1330d49a 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -180,8 +180,9 @@ mpvc_web_index() ๐ŸŽง $PROGNAME #stat - #list - $([ -n "$MPVC_WEB_ARCHIVE_ENABLE" ] && echo '#arch'; ) + #ls + $([ -n "$MPVC_WEB_ARCHIVE_ENABLE" ] && echo '#arc'; ) + #now ]
    From def7048e896f7dcdcc70178ee9623f9292b02d61 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Fri, 19 Jul 2024 19:20:10 +0200 Subject: [PATCH 052/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 1330d49a..2db20108 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -93,9 +93,9 @@ mpvc_web_select_form() arg="${2:-}" echo "
    " - echo "$cmd" + echo "" awk -v cmd="$cmd" -v arg="$arg" ' - BEGIN { print ""; printf "\n" } NR > 0 { gsub("\"",""); print "" } END { print ""} ' @@ -162,11 +162,11 @@ mpvc_web_index() dark) echo ":root { --body-bg: #222; --body-color: #eee; --pre-bg:#333; --link-color:#07f; }";; esac ) - body { background: var(--body-bg); color: var(--body-color); font-family: monospace; font-size: var(--body-font-size); margin: 0 0;} - select { width: 6rem; height: 1.1rem; font-size: var(--body-font-size); } + body { background: var(--body-bg); color: var(--body-color); font-family: monospace; font-size: var(--body-font-size); } + select { width: 100%; height: 1.1rem; font-size: var(--body-font-size); } code { background: var(--pre-bg); } pre { background: var(--pre-bg); } - ul { padding: 0rem 1rem; margin: 0 0; } + ul { padding: 0rem 0.5rem; } a { color: var(--link-color); padding: 0.05rem 0.05rem; } From 54fa6759f3814d83609cbd8234c4e254587374a1 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Fri, 19 Jul 2024 19:26:43 +0200 Subject: [PATCH 053/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 2db20108..81b54d33 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -69,14 +69,14 @@ mpvc_web_defaults() mpvc_web_config() { - if ! command -v python3 >/dev/null; then - echo "$PROGNAME: Error: No python3 found, install to continue." - exit - fi if ! command -v mpvc >/dev/null; then echo "$PROGNAME: Error: No mpvc found, install to continue." exit fi + if ! command -v python3 >/dev/null; then + echo "$PROGNAME: Error: No python3 found, install to continue." + exit + fi if ! command -v stunnel >/dev/null; then echo "$PROGNAME: Warning: No stunnel found, install to support SSL." fi @@ -276,7 +276,7 @@ mpvc_web_index() rst
- [ Status ]
+ [ Status #lyrics ]
[ Playlist @@ -404,6 +404,7 @@ cert = ${MPVC_WEB_SSL_PEM} key = ${MPVC_WEB_SSL_PEM} cafile = ${MPVC_WEB_SSL_PEM} verify=$MPVC_WEB_SSL_VERIFY +#protocol = proxy TIMEOUTclose = 0 EOF } @@ -567,7 +568,7 @@ main() case "${MPVC_WEB_CMD:-}" in start) mpvc_web ;; stop) pkill -f "$PROGNAME" ;; - status) ps auxww | grep 'mpvc-web' ;; + status) ps auxww | grep "$PROGNAME" ;; *) usage ;; esac } From cfaafc90b0d0172c1dc332b1cecb279f603c425c Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Fri, 19 Jul 2024 20:38:01 +0200 Subject: [PATCH 054/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 81b54d33..54647c60 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -163,7 +163,7 @@ mpvc_web_index() esac ) body { background: var(--body-bg); color: var(--body-color); font-family: monospace; font-size: var(--body-font-size); } - select { width: 100%; height: 1.1rem; font-size: var(--body-font-size); } + select { width: 100%; height: font-size: var(--body-font-size); } code { background: var(--pre-bg); } pre { background: var(--pre-bg); } ul { padding: 0rem 0.5rem; } From 304e865228b6d40c26f44c5efc0afde61739c42d Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 20 Jul 2024 07:36:30 +0200 Subject: [PATCH 055/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 54647c60..45d574cf 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -300,7 +300,8 @@ mpvc_web_index()
$PROGNAME - $(mpvc-installer version | awk '{print $6}') mpvc for the web + $(mpvc-installer version | awk '{print $6}') + @gmt4 (c) 2024 /h #top From 445c1e0428d38234284ea228be856c23b540f4de Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 20 Jul 2024 07:37:26 +0200 Subject: [PATCH 056/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 45d574cf..9da3d8a5 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -356,7 +356,9 @@ mpvc_web_cgi() #!/bin/sh set -euf mpvc_strip_escapes(){ sed '/\x1b\[7m/ { s|\x1b\[7m||; s| |+|; }; s|\x1b\[0m||;'; } -mpvc_out() { echo "Content-Type: text/plain"; echo; $MPVC "\$@"; } +mpvc_plain() { echo "Content-Type: text/plain"; echo; $MPVC "\$@"; } +mpvc_html() { echo "Content-Type: text/html"; echo; echo "\$@"; } +mpvc_redir() { mpvc_html ''; } main() { if [ -n "\${USER:-}" ]; then @@ -364,12 +366,13 @@ main() fi cmd="\${1:-}"; case "\$cmd" in equalizer|fzf|now) shift; $MPVC-\$cmd "\$@"; return ;; esac case "\${QUERY_STRING:-}" in - status|playlist) mpvc_out "\${QUERY_STRING}" | mpvc_strip_escapes ;; - fullplaylist) mpvc_out fullplaylist | mpvc_strip_escapes ;; - rawplaylist) mpvc_out saven | mpvc_strip_escapes ;; - chapter-list) mpvc_out chapter-list | mpvc_strip_escapes ;; - chapter-list-nr) mpvc_out chapter-list-nr | mpvc_strip_escapes ;; - chapter-list-full) mpvc_out chapter-list-full | mpvc_strip_escapes ;; + lyrics) mpvc_redir "https://ddg.gg?ia=lyrics&iax=lyrics&q=lyrics \$($MPVC -f '%title%')" ;; + status|playlist) mpvc_plain "\${QUERY_STRING}" | mpvc_strip_escapes ;; + fullplaylist) mpvc_plain fullplaylist | mpvc_strip_escapes ;; + rawplaylist) mpvc_plain saven | mpvc_strip_escapes ;; + chapter-list) mpvc_plain chapter-list | mpvc_strip_escapes ;; + chapter-list-nr) mpvc_plain chapter-list-nr | mpvc_strip_escapes ;; + chapter-list-full) mpvc_plain chapter-list-full | mpvc_strip_escapes ;; *) $MPVC "\$@" ;; esac } From d26ac12a1639aeb1efc63b629c8a529b0cc65764 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 20 Jul 2024 08:05:25 +0200 Subject: [PATCH 057/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 9da3d8a5..f423f2af 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -163,7 +163,7 @@ mpvc_web_index() esac ) body { background: var(--body-bg); color: var(--body-color); font-family: monospace; font-size: var(--body-font-size); } - select { width: 100%; height: font-size: var(--body-font-size); } + select { width: 95%; font-size: var(--body-font-size); } code { background: var(--pre-bg); } pre { background: var(--pre-bg); } ul { padding: 0rem 0.5rem; } From 0d992c3dc25c0597b9288a6458c9a1dfba27f5e2 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 20 Jul 2024 09:04:05 +0200 Subject: [PATCH 058/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index f423f2af..62c5cdfc 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -300,8 +300,8 @@ mpvc_web_index()
$PROGNAME - $(mpvc-installer version | awk '{print $6}') - @gmt4 (c) 2024 + $PROGVERSION + @$PROGAUTHOR (c) 2024 /h #top From fcba2326aa0521e39aa46ab6f0eecc880b0e02f3 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 20 Jul 2024 20:11:12 +0200 Subject: [PATCH 059/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 62c5cdfc..8fa6688f 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -186,12 +186,14 @@ mpvc_web_index() ]
    + $([ -n "${MPVC_WEB_DEV:-}" ] && cat < - - + mpvc cli +EOF +)
  • $(mpvc stash list | awk 'NR>1{print $NF}' | mpvc_web_select_form "mpvc -q stash apply" "${MPVC_WEB_SHORTCUT_APPLY}")
  • From 5de637b8a85c1f09605a35cbb948e5ef0abfc9a1 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 20 Jul 2024 20:26:34 +0200 Subject: [PATCH 060/104] mpvc: Update mpvc --- mpvc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mpvc b/mpvc index f042551d..23ba2a67 100755 --- a/mpvc +++ b/mpvc @@ -165,8 +165,8 @@ mpvc_defaults() %artist% - %title% \r\ [%status%] #%position%/%playlistlength% %time%/%length% (%percentage%%%) \r\ vol:%volume%%% mute:%muted% repeat:%repeat% single:%single% \r\ -vid:%video% scr:%screen% win:%force-window% fs:%fullscreen% idle:%idle% \r\ -chapter:%chapter% %=chapter%/%chapters%" +vid:%video% scr:%screen% win:%force-window% fs:%fullscreen% \r\ +chapter:%chapter% %=chapter%/%chapters% idle:%idle%" fi } From 5c3b967ce49f9d0b77837fc555758cfdb8ef2522 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:12:48 +0200 Subject: [PATCH 061/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 8fa6688f..e39e4423 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -303,7 +303,7 @@ EOF
    $PROGNAME $PROGVERSION - @$PROGAUTHOR (c) 2024 + @$PROGAUTHOR (c) 2024 /h #top From 7c1c0f219cd545165c5adbde736320b3b24f2bef Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 27 Jul 2024 12:54:29 +0200 Subject: [PATCH 062/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index e39e4423..70145013 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -415,7 +415,7 @@ TIMEOUTclose = 0 EOF } -mpvc_web() +mpvc_web_setup() { mpvc_web_config echo "# $PROGNAME $PROGVERSION running (beta version: might contain bugs!) SSL=${MPVC_WEB_SSL_ENABLE}" @@ -463,6 +463,14 @@ mpvc_web() fi chmod a-w -R "$MPVC_WEB_ROOT/" + ) +} + +mpvc_web() +{ + mpvc_web_setup + ( + cd "$MPVC_WEB_ROOT" || return # XXX handle cli commands, rewrite this mess python3 -u -m http.server --cgi --bind "$MPVC_WEB_HOST" "$MPVC_WEB_PORT" "$@" 2>&1 | From 9f7330dbf18962ecb78d00741ed7fb61bfd5f90e Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 29 Jul 2024 22:55:50 +0200 Subject: [PATCH 063/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 70145013..f68e2181 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -251,10 +251,10 @@ EOF ch+
  • - $(echo "-15\n-10\n-5\n-2\n0\n+2\n+5\n+10\n+15" | mpvc_web_select_form "mpvc -q track" "${MPVC_WEB_SHORTCUT_TRACK}") + $(echo "-15\n-10\n-5\n-2\n-1\n0\n+1\n+2\n+5\n+10\n+15" | mpvc_web_select_form "mpvc -q track" "${MPVC_WEB_SHORTCUT_TRACK}")
  • - $(echo "-10\n-5\n-4\n-2\n0\n+2\n+4\n+5\n+10" | mpvc_web_select_form "mpvc -q cplay") + $(echo "-10\n-5\n-4\n-2\n-1\n0\n+1\n+2\n+4\n+5\n+10" | mpvc_web_select_form "mpvc -q cplay")
  • $(echo "-30\n-20\n-10\n-5\n0\n+5\n+10\n+20\n+30" | mpvc_web_select_form "mpvc -q vol" "${MPVC_WEB_SHORTCUT_VOL}") @@ -580,9 +580,9 @@ main() shift $((OPTIND - 1)) case "${MPVC_WEB_CMD:-}" in + status) ps auxww | grep "$PROGNAME" ;; start) mpvc_web ;; stop) pkill -f "$PROGNAME" ;; - status) ps auxww | grep "$PROGNAME" ;; *) usage ;; esac } From 0573c91a6ba1cc1a316302bed6cef3a459c8a7cc Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 30 Jul 2024 06:38:07 +0200 Subject: [PATCH 064/104] extras: rm extras/mpvc-cast --- extras/mpvc-cast | 59 ------------------------------------------------ extras/mpvc-cut | 40 +++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 65 deletions(-) delete mode 100755 extras/mpvc-cast diff --git a/extras/mpvc-cast b/extras/mpvc-cast deleted file mode 100755 index 5adf6ca2..00000000 --- a/extras/mpvc-cast +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env sh -# -# @file mpvc-cast -# @description mpvc cast, mpv screen cast recorder -# @author gmt4 (c) Copyright 2022 GPLv2+ -# @url github.com/gmt4/mpvc -# SPDX-License-Identifier: GPL-2.0-or-later -# - -PROGNAME=${0##*/} -PROGVERSION="v1.5" -PROGAUTHOR=gmt4 -PROGURL="https://github.com/gmt4/mpvc" -SITEURL="https://gmt4.github.io/mpvc" - -set -euf - -mpvc_screencast() -{ - vres=$(xrandr | awk ' - /^Screen 0: .* current .*/ { - r=$0; sub("^.* current ","",r); sub(", maximum .*$","",r); gsub(" ","",r); print r; exit - }' - ) - - asrc=$(pactl list sources | awk ' - /^Source #.*/ { - s=$2; sub("#","",s);} / *Description: Monitor of Built-in Audio Analog Stereo/ {print s; exit - }' - ) - - fout="${fout:-mpvc-cast-$(date -Isec | sed 's/:/-/g').mkv}" - loglevel=${loglevel:-warning} - framerate=${framerate:-25} - - if [ -z "$vres" ]; then usage; fi - if [ -z "$asrc" ]; then usage; fi - - echo "# $PROGNAME: recording vres $vres asrc $asrc to $fout (ctl+c to finish)" - ffmpeg -hide_banner -loglevel "$loglevel" -video_size "$vres" -framerate "$framerate" -f x11grab -i :0.0 -f pulse -ac 2 -i "$asrc" "$fout" -} - -usage() -{ - echo "usage: $PROGNAME [cast|help] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL" - exit -} - -main() -{ - [ $# -lt 1 ] && usage - - case "$1" in - cast) mpvc_screencast "$@" ;; - *) usage;; - esac -} - -main "$@" diff --git a/extras/mpvc-cut b/extras/mpvc-cut index 0f8365c9..f35cac8b 100755 --- a/extras/mpvc-cut +++ b/extras/mpvc-cut @@ -52,6 +52,35 @@ mpvc_cutfile() esac } +mpvc_cut() +{ + mpvc_cutfile "$operation" "$(mpvc g 'path')" "$(mpvc g 'ab-loop-a')" "$(mpvc g 'ab-loop-b')" +} + +mpvc_screencast() +{ + vres=$(xrandr | awk ' + /^Screen 0: .* current .*/ { + r=$0; sub("^.* current ","",r); sub(", maximum .*$","",r); gsub(" ","",r); print r; exit + }' + ) + + asrc=$(pactl list sources | awk ' + /^Source #.*/ { + s=$2; sub("#","",s);} / *Description: Monitor of Built-in Audio Analog Stereo/ {print s; exit + }' + ) + + fout="${fout:-mpvc-cast-$(date -Isec | sed 's/:/-/g').mkv}" + loglevel=${loglevel:-warning} + framerate=${framerate:-25} + + if [ -z "$vres" ]; then usage; fi + if [ -z "$asrc" ]; then usage; fi + + echo "# $PROGNAME: recording vres $vres asrc $asrc to $fout (ctl+c to finish)" + ffmpeg -hide_banner -loglevel "$loglevel" -video_size "$vres" -framerate "$framerate" -f x11grab -i :0.0 -f pulse -ac 2 -i "$asrc" "$fout" +} usage() { echo "usage: $PROGNAME -[vdlLh] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL" @@ -64,14 +93,13 @@ main() case "${1:-}" in -h|--help|help) usage ;; - -l|--lossy|lossy) operation="lossy" ;; - -L|--lossless|lossless) operation="lossless" ;; - -v|--vidcord|vidcord) operation="vidcord" ;; - -d|--default|default|'') operation="default" ;; + -l|--lossy|lossy) operation="lossy" mpvc_cut ;; + -L|--lossless|lossless) operation="lossless" mpvc_cut ;; + -v|--vidcord|vidcord) operation="vidcord" mpvc_cut ;; + -d|--default|default|'') operation="default" mpvc_cut ;; + cast) mpvc_screencast "$@" ;; *) usage ;; esac - - mpvc_cutfile "$operation" "$(mpvc g 'path')" "$(mpvc g 'ab-loop-a')" "$(mpvc g 'ab-loop-b')" } main "$@" From 2649ae925b8074080ab774cd351fb14c4f4c9d99 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 30 Jul 2024 20:44:50 +0200 Subject: [PATCH 065/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index f68e2181..2285dc4d 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -166,7 +166,7 @@ mpvc_web_index() select { width: 95%; font-size: var(--body-font-size); } code { background: var(--pre-bg); } pre { background: var(--pre-bg); } - ul { padding: 0rem 0.5rem; } + ul { padding: 0rem 0.8rem; } a { color: var(--link-color); padding: 0.05rem 0.05rem; } From 343bf9a56d5612d771411a1cf1f75aa0a4e575fb Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:17:37 +0200 Subject: [PATCH 066/104] extras: Update extras/mpvc-installer --- extras/mpvc-installer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-installer b/extras/mpvc-installer index 69bae754..482cd7a4 100755 --- a/extras/mpvc-installer +++ b/extras/mpvc-installer @@ -25,7 +25,7 @@ MPV_CONFDIR="${CONFIGDIR:-$HOME/.config/mpv}" DOCS="README.md docs/mpv.conf docs/logbook.html" LICENSES="LICENSE.md" -SCRIPT="mpvc extras/mpvc-tui extras/mpvc-fzf extras/mpvc-cut extras/mpvc-chapter extras/mpvc-mpris extras/mpvc-equalizer extras/mpvc-web extras/mpvc-autostart extras/mpvc-now extras/mpvc-cast extras/mpvc-installer" +SCRIPT="mpvc extras/mpvc-tui extras/mpvc-fzf extras/mpvc-cut extras/mpvc-chapter extras/mpvc-mpris extras/mpvc-equalizer extras/mpvc-web extras/mpvc-autostart extras/mpvc-now extras/mpvc-installer" CONFIG="docs/mpv.conf" mpvc_config() From 97c079e668982fbbb42d00a56015f5a93a32dd22 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:43:58 +0200 Subject: [PATCH 067/104] Update README.md --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 68e0765d..c46f72f3 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,14 @@ ![GitHub top language](https://img.shields.io/github/languages/top/lwilletts/mpvc) ![GitHub lines of Code](https://sloc.xyz/github/lwilletts/mpvc/?category=code) -# mpvc ๐ŸŽง +# mpvc ๐ŸŽง [^install] A terminal music player in POSIX sh(1) that interfaces mpv providing mpc(1) commands + extras. Originally a fork of [lwillets/mpvc](https://github.com/lwilletts/mpvc) that evolved on its own, providing some extra goodies such as: improved CLI, TUI, FZF, WEB, EQ, & playing media from YouTube & streaming services. Check the [Wiki](../../wiki), [LogBook](../../wiki#logbook) & [Casts](../../wiki#screencasts) for a detailed view of the extra features of this fork. +Skip directly to [Installation](#Installation) to try mpvc! +
    mpvc-tui -T: running the mpvc TUI (click to view screenshot) @@ -28,7 +30,7 @@ Check the [Wiki](../../wiki), [LogBook](../../wiki#logbook) & [Casts](../../wiki ![mpvc tui+fzf+notifications screenshot](../../blob/master/docs/assets/mpvc-tui-fzf.png)
    -## Overview โ–ถ๏ธ +## Overview โ–ถ๏ธ [^install] [mpvc](../../) player functionality is provided by: @@ -73,6 +75,8 @@ Check for missing dependencies using `mpvc-installer check-reqs`. - [Gentoo](#gentoo-mpvc) - [Nix](#nix-mpvc) +Installing is just a matter of fetching the scripts either via Git/Curl/etc., scripts can be used directly from the repo, the `mpvc-installer` bit is just there for easiness, to fetch & link them into your `BINDIR=~/bin/` by default, + ### Manual The easiest install method is just to run the [mpvc-installer](../../blob/master/extras/mpvc-installer) to install under `$HOME/bin` @@ -84,11 +88,14 @@ curl -fsSL -o mpvc-installer https://github.com/lwilletts/mpvc/raw/master/extras ### Git +Below is a **Quick Start** guide showcasing mpvc commands usage. + ```sh # fetch a local copy of the github repo git clone https://github.com/lwilletts/mpvc/ # use extras/mpvc-installer: just copy/link to your $HOME/bin (cd mpvc; extras/mpvc-installer link-user) + (cd mpvc; extras/mpvc-installer check-reqs) # use mpvc-fzf to search and play youtube media mpvc-fzf -p 'kupla mirage' @@ -216,3 +223,6 @@ Like any piece of software, mpvc is not perfect: all effort has been made to make mpvc as POSIX compliant as possible. Check out the [Issue Tracker](../../issues) for further improvements to be made. + +[^install]: Skip directly to [Installation](#Installation) to try mpvc + From 9f646935b0d6dc93ee3ff8b788181a3334178f2d Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 30 Jul 2024 22:25:18 +0200 Subject: [PATCH 068/104] extras: Update extras/mpvc-fzf (lyrics + similar) --- extras/mpvc-fzf | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index 978b478a..40d6b9c8 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -85,6 +85,41 @@ mpvcfzf_isearch() ' } +mpvcfzf_ssearch() +{ + id="${1##https://yewtu.be/}" + output=$(curl -fsSL -A '' "https://yewtu.be/watch?v=$id") + echo "$output" | + awk ' + /
    / { c++; next } + c && c-- { + sub("^ *

    "," "); + sub("

    $",""); + print $0 + }' +} + +mpvcfzf_splay() +{ + mpvcfzf_ssearch "$1" | + mpvcfzf_preview --prompt="(similar) " | + mpvcfzf_awk1 +} + +mpvcfzf_lyrics() +{ + id="${1##https://yewtu.be/}" + output=$(curl -fsSL -A '' "https://yewtu.be/watch?v=$id") + echo "$output" | + awk ' + c==0 && / Date: Wed, 31 Jul 2024 14:27:29 +0200 Subject: [PATCH 069/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index 40d6b9c8..c888fd00 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -113,8 +113,8 @@ mpvcfzf_lyrics() output=$(curl -fsSL -A '' "https://yewtu.be/watch?v=$id") echo "$output" | awk ' - c==0 && / Date: Wed, 31 Jul 2024 15:06:09 +0200 Subject: [PATCH 070/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index c888fd00..97768e0e 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -109,7 +109,8 @@ mpvcfzf_splay() mpvcfzf_lyrics() { - id="${1##https://yewtu.be/}" + id=${1:-$(mpvc get filename current)} + id="${id##https://yewtu.be/}" output=$(curl -fsSL -A '' "https://yewtu.be/watch?v=$id") echo "$output" | awk ' @@ -416,8 +417,8 @@ main() F) shift; mpvcfzf_preview "$@" ;; g) mpvcfzf_fetch "$OPTARG";; G) mpvcfzf_fetch $(mpvcfzf_iplay "$OPTARG") ;; - i) mpvcfzf_lyrics "${OPTARG:-$(mpvc get filename current fullpath)}";; - I) mpvcfzf_lyrics "$(mpvc get filename current fullpath)";; + i) mpvcfzf_lyrics "${OPTARG:-}";; + I) mpvcfzf_lyrics "";; k) mpvcfzf_ddg_play "$OPTARG";; K) mpvcfzf_ddg "$OPTARG";; h) mpvcfzf_usage ;; From aad22b2316d8ee01df3c7de45aaf8dd8061c4aec Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:35:34 +0200 Subject: [PATCH 071/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index 97768e0e..16b8d977 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -45,6 +45,11 @@ mpvcfzf_config() fi } +mpvcfzf_getvideo_id() +{ + echo "${1##*/}" +} + mpvcfzf_isearch_once() { mpvcfzf_isearch "$@" | awk 'NR==2 {sub(" +", " # "); print}' @@ -87,7 +92,8 @@ mpvcfzf_isearch() mpvcfzf_ssearch() { - id="${1##https://yewtu.be/}" + id=${1:-$(mpvc get filename)} + id=$(mpvcfzf_getvideo_id "$id") output=$(curl -fsSL -A '' "https://yewtu.be/watch?v=$id") echo "$output" | awk ' @@ -109,21 +115,22 @@ mpvcfzf_splay() mpvcfzf_lyrics() { - id=${1:-$(mpvc get filename current)} - id="${id##https://yewtu.be/}" + id=${1:-$(mpvc get filename)} + id=$(mpvcfzf_getvideo_id "$id") output=$(curl -fsSL -A '' "https://yewtu.be/watch?v=$id") echo "$output" | - awk ' + awk -v id=$id ' c==0 && / Date: Thu, 1 Aug 2024 13:03:18 +0200 Subject: [PATCH 072/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index 16b8d977..61fee9c8 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -122,7 +122,7 @@ mpvcfzf_lyrics() awk -v id=$id ' c==0 && / Date: Sat, 3 Aug 2024 12:35:58 +0200 Subject: [PATCH 073/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 2285dc4d..46798666 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -29,7 +29,7 @@ mpvc_web_defaults() XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"} MPVC_CONFIG="${MPVC_CONFIG:-$XDG_CONFIG_HOME/mpvc/mpvc.conf}" - MPVC_WEB_HOSTNAME=$(hostname) + MPVC_WEB_HOSTNAME=${MPVC_WEB_HOSTNAME:-$(hostname)} MPVC_WEB_HOST=${MPVC_WEB_HOST:-localhost} MPVC_WEB_PORT=${MPVC_WEB_PORT:-8000} MPVC_WEB_ROOT=${MPVC_WEB_ROOT:-/tmp/mpvc-web/root} @@ -40,6 +40,7 @@ mpvc_web_defaults() MPVC_WEB_SSL_ENABLE=${MPVC_WEB_SSL_ENABLE:-} MPVC_WEB_SSL_VERIFY=${MPVC_WEB_SSL_VERIFY:-0} MPVC_WEB_ARCHIVE_ENABLE=${MPVC_WEB_ARCHIVE_ENABLE:-} + MPVC_WEB_CAST_URL=${MPVC_WEB_CAST_URL:-} MPVC_WEB_HTML_THEME=${MPVC_WEB_HTML_THEME:-} MPVC_WEB_HTML_REFRESH=${MPVC_WEB_HTML_REFRESH:-} @@ -181,8 +182,9 @@ mpvc_web_index() $PROGNAME #stat #ls - $([ -n "$MPVC_WEB_ARCHIVE_ENABLE" ] && echo '#arc'; ) - #now + $([ -n "$MPVC_WEB_ARCHIVE_ENABLE" ] && echo '#a'; ) + #n + $([ -n "$MPVC_WEB_CAST_URL" ] && echo "#c"; ) ]
      @@ -538,7 +540,7 @@ mpvc_web() ) } -optflags="ha:b:c:d:p:P:r:R:s:S:t:" +optflags="ha:b:c:C:d:p:P:r:R:s:S:t:" usage() { echo "usage: $PROGNAME -[$optflags] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL" @@ -564,6 +566,7 @@ main() case "$flag" in h) usage ;; c) MPVC_WEB_CMD="$OPTARG"; ;; + C) MPVC_WEB_CAST_URL="$OPTARG"; ;; d) MPVC_WEB_DEV="$OPTARG"; ;; b) MPVC_WEB_HOST="$OPTARG" ;; p) MPVC_WEB_PORT="$OPTARG" ;; From 0c0936ec52ea20755d41691dd62c1fd71119644a Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 4 Aug 2024 18:36:49 +0200 Subject: [PATCH 074/104] mpvc: Update mpvc --- mpvc | 1 + 1 file changed, 1 insertion(+) diff --git a/mpvc b/mpvc index 23ba2a67..7e4ae4a7 100755 --- a/mpvc +++ b/mpvc @@ -1154,6 +1154,7 @@ main() { -C|--clear|clear) mpvc_clear_playlist; QUIETFLAG=true;; --delay|delay) mpvc_delay;; --wait|wait) mpvc_wait;; + --tac|tac) mpvc_tac;; --ttysize|ttysize) mpvc_tty_size; QUIETFLAG=true;; --ttycols|ttycols) mpvc_tty_cols; QUIETFLAG=true;; From 9e067a62d76d28c52bc0c2b176783fa999545dc3 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 4 Aug 2024 18:37:05 +0200 Subject: [PATCH 075/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 46798666..23b8c054 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -197,7 +197,7 @@ mpvc_web_index() EOF )
    • - $(mpvc stash list | awk 'NR>1{print $NF}' | mpvc_web_select_form "mpvc -q stash apply" "${MPVC_WEB_SHORTCUT_APPLY}") + $(mpvc stash list | awk 'NR>1{print $NF}' | mpvc tac | mpvc_web_select_form "mpvc -q stash apply" "${MPVC_WEB_SHORTCUT_APPLY}")
    • From 956437b412ca37c7a4a2fb113878bd43ef8728a2 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:31:57 +0200 Subject: [PATCH 076/104] mpvc: Update mpvc --- mpvc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpvc b/mpvc index 7e4ae4a7..987f9737 100755 --- a/mpvc +++ b/mpvc @@ -1154,7 +1154,7 @@ main() { -C|--clear|clear) mpvc_clear_playlist; QUIETFLAG=true;; --delay|delay) mpvc_delay;; --wait|wait) mpvc_wait;; - --tac|tac) mpvc_tac;; + --tac|tac) mpvc_tac; exit 0;; --ttysize|ttysize) mpvc_tty_size; QUIETFLAG=true;; --ttycols|ttycols) mpvc_tty_cols; QUIETFLAG=true;; From 84d448497ddecf6738dbd5b07491c9977befaa0d Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:43:09 +0200 Subject: [PATCH 077/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 23b8c054..e3b2a43e 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -96,8 +96,8 @@ mpvc_web_select_form() echo "
      " echo "" awk -v cmd="$cmd" -v arg="$arg" ' - BEGIN { print ""; print "
      ' From 5e2e9d92d529341018f60787774da214f9eca75b Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:00:27 +0200 Subject: [PATCH 078/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index e3b2a43e..1fdec74c 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -95,11 +95,12 @@ mpvc_web_select_form() echo "
      " echo "" + echo ""; print "
      ' } From 13f6b6751cc1a17c52da6750c44eda208b87f5f7 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:46:38 +0200 Subject: [PATCH 079/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index 61fee9c8..2d28f1f9 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -378,7 +378,7 @@ mpvcfzf_version() echo "usage: $PROGNAME -[optflags] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL" } -optflags="01ab:B:cCd:efFg:G:hi:Ik:K:n:s:S:p:P:o:Or:lL:xy:Y:v" +optflags="01ab:B:cCd:efFg:G:hi:Ik:K:n:s:S:p:P:o:O:r:lL:xy:Y:v" mpvcfzf_usage() { echo "usage: $PROGNAME -[$optflags] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL" From de0a5a87bc3636838c36f09146ebcda925486d9c Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:59:15 +0200 Subject: [PATCH 080/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 1fdec74c..f67c3808 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -96,7 +96,7 @@ mpvc_web_select_form() echo "
      " echo "" echo " +
      +EOF +} + mpvc_web_help() { cat <
        - $([ -n "${MPVC_WEB_DEV:-}" ] && cat < -
        - mpvc cli - -
        -EOF -) + $([ -n "${MPVC_WEB_DEV:-}" ] && mpvc_web_cli)
      • $(mpvc stash list | awk 'NR>1{print $NF}' | mpvc tac | mpvc_web_select_form "mpvc -q stash apply" "${MPVC_WEB_SHORTCUT_APPLY}")
      • @@ -352,17 +360,27 @@ function toggleColorScheme(mode="dark") break; } } + +function httpGet(url) +{ + var xmlHttp = new XMLHttpRequest(); + xmlHttp.open("GET", url, false); + xmlHttp.send(null); + return xmlHttp.responseText; +} EOF } -mpvc_web_cgi() +mpvc_web_cgi() # /cgi-bin/mpvc { cat <&2; } +mpvc_strip() { sed '/\x1b\[7m/ { s|\x1b\[7m||; s| |+|; }; s|\x1b\[0m||;'; } +mpvc_cmd() { echo "Content-Type: text/plain"; echo; $MPVC "\$@"; } +mpvc_plain() { echo "Content-Type: text/plain"; echo; echo "\$@"; } +mpvc_html() { echo "Content-Type: text/html"; echo; echo "\$@"; } mpvc_redir() { mpvc_html ''; } main() { @@ -372,12 +390,13 @@ main() cmd="\${1:-}"; case "\$cmd" in equalizer|fzf|now) shift; $MPVC-\$cmd "\$@"; return ;; esac case "\${QUERY_STRING:-}" in lyrics) mpvc_redir "https://ddg.gg?ia=lyrics&iax=lyrics&q=lyrics \$($MPVC -f '%title%')" ;; - status|playlist) mpvc_plain "\${QUERY_STRING}" | mpvc_strip_escapes ;; - fullplaylist) mpvc_plain fullplaylist | mpvc_strip_escapes ;; - rawplaylist) mpvc_plain saven | mpvc_strip_escapes ;; - chapter-list) mpvc_plain chapter-list | mpvc_strip_escapes ;; - chapter-list-nr) mpvc_plain chapter-list-nr | mpvc_strip_escapes ;; - chapter-list-full) mpvc_plain chapter-list-full | mpvc_strip_escapes ;; + status|playlist) mpvc_cmd "\${QUERY_STRING}" | mpvc_strip ;; + fullplaylist) mpvc_cmd fullplaylist | mpvc_strip ;; + rawplaylist) mpvc_cmd saven | mpvc_strip ;; + chapter-list) mpvc_cmd chapter-list | mpvc_strip ;; + chapter-list-nr) mpvc_cmd chapter-list-nr | mpvc_strip ;; + chapter-list-full) mpvc_cmd chapter-list-full | mpvc_strip ;; + mpvc-fzf*) mpvc_plain "\$(eval $PROGDIR/"\$@")" ;; *) $MPVC "\$@" ;; esac } @@ -429,7 +448,7 @@ mpvc_web_setup() mkdir -p "$MPVC_WEB_ROOT" || return mkdir -p "$MPVC_WEB_ROOT/cgi-bin/" || return cd "$MPVC_WEB_ROOT" || return - chmod u+w -R "${MPVC_WEB_ROOT%/*}" + chmod -R u+w "${MPVC_WEB_ROOT%/*}" # setup streamable mpvc archive if requested if [ -n "${MPVC_WEB_ARCHIVE_ENABLE}" ]; then @@ -465,7 +484,7 @@ mpvc_web_setup() echo "# $PROGNAME Setup development/cli features (MPVC_WEB_DEV=${MPVC_WEB_DEV:-} is not set)" fi - chmod a-w -R "$MPVC_WEB_ROOT/" + chmod -R a-w "$MPVC_WEB_ROOT/" ) } From 99cfbcf62f2f9cb4cd0af83ca31a052b5f99b743 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Thu, 8 Aug 2024 18:58:01 +0200 Subject: [PATCH 086/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 201 +++++++++++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 86 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 425d7f22..07c79305 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -108,16 +108,126 @@ mpvc_web_select_form() mpvc_web_cli() { cat < + + +
        - mpvc cli - +
        EOF } +mpvc_web_index_js() +{ + cat <= 0; i--) + { + rule = document.styleSheets[0].rules[i] + if (!("media" in rule)) + continue; + rule = document.styleSheets[0].rules[i].media; + if (! rule.mediaText.includes("prefers-color-scheme")) + continue; + switch (mode) { + case "light": + rule.appendMedium("original-prefers-color-scheme"); + if (rule.mediaText.includes("light")) rule.deleteMedium("(prefers-color-scheme: light)"); + if (rule.mediaText.includes("dark")) rule.deleteMedium("(prefers-color-scheme: dark)"); + break; + case "dark": + rule.appendMedium("(prefers-color-scheme: light)"); + rule.appendMedium("(prefers-color-scheme: dark)"); + if (rule.mediaText.includes("original")) rule.deleteMedium("original-prefers-color-scheme"); + break; + default: + rule.appendMedium("(prefers-color-scheme: dark)"); + if (rule.mediaText.includes("light")) rule.deleteMedium("(prefers-color-scheme: light)"); + if (rule.mediaText.includes("original")) rule.deleteMedium("original-prefers-color-scheme"); + } + break; + } +} + +function mpvcOnKeyDownEvent(event, that) +{ + if (event.keyCode == 13) + { + if (! that.value.startsWith('http')) + { + console.log(that.value) + var datalist=document.getElementById("mpvc-yts-datalist") + var url='/cgi-bin/mpvc/?mpvc-fzf+-s+'+that.value; + data=mpvcHttpGet(url); + + lines=data.split('\n'); + for (i in lines) + { + var option = '
      [ Status #lyrics ]
      - + [ Playlist full @@ -407,15 +414,15 @@ mpvc_web_index() load ]
      - +
      @@ -432,8 +439,8 @@ EOF mpvc_web_favicon() { + # ๐ŸŽง cat < ๐ŸŽง EOF } @@ -524,47 +531,49 @@ mpvc_web() python3 -u -m http.server --cgi --bind "$MPVC_WEB_HOST" "$MPVC_WEB_PORT" "$@" 2>&1 | awk -v mpvc="$MPVC_CGI" \ ' - /GET \/\?cmd=mpvc%20mpv/ { system(mpvc" -q mpv") } - /GET \/\?cmd=mpvc%20clear/ { system(mpvc" -q clear") } - /GET \/\?cmd=mpvc%20kill/ { system(mpvc" -q kill") } - /GET \/\?cmd=mpvc%20vol%20-5/ { system(mpvc" -q vol -5") } - /GET \/\?cmd=mpvc%20vol%20\+5/ { system(mpvc" -q vol +5") } - - /GET \/\?cmd=mpvc%20--mute/ { system(mpvc" -q --mute") } - /GET \/\?cmd=mpvc%20toggle/ { system(mpvc" -q toggle") } - /GET \/\?cmd=mpvc%20play/ { system(mpvc" -q play") } - /GET \/\?cmd=mpvc%20start%200/ { system(mpvc" -q start 0") } - /GET \/\?cmd=mpvc%20start%20$/ { system(mpvc" -q start $") } - /GET \/\?cmd=mpvc%20stop/ { system(mpvc" -q stop") } - /GET \/\?cmd=mpvc%20prev/ { system(mpvc" -q prev") } - /GET \/\?cmd=mpvc%20next/ { system(mpvc" -q next") } - /GET \/\?cmd=mpvc%20playrand/ { system(mpvc" -q playrand") } - - /GET \/\?cmd=mpvc%20shuffle/ { system(mpvc" -q shuffle") } - /GET \/\?cmd=mpvc%20unshuffle/ { system(mpvc" -q unshuffle") } - - /GET \/\?cmd=mpvc%20repeat/ { system(mpvc" -q repeat") } - /GET \/\?cmd=mpvc%20single/ { system(mpvc" -q single") } - /GET \/\?cmd=mpvc%20replay/ { system(mpvc" -q replay") } - - /GET \/\?cmd=mpvc%20togglev/ { system(mpvc" -q togglev") } - /GET \/\?cmd=mpvc%20aspect/ { system(mpvc" -q aspect") } - /GET \/\?cmd=mpvc%20togglew/ { system(mpvc" -q togglew") } - /GET \/\?cmd=mpvc%20togglef/ { system(mpvc" -q togglef") } - /GET \/\?cmd=mpvc%20togglei/ { system(mpvc" -q togglei") } - - /GET \/\?cmd=mpvc%20cstart/ { system(mpvc" -q cplay 0") } - /GET \/\?cmd=mpvc%20creplay/ { system(mpvc" -q chapter-replay") } - /GET \/\?cmd=mpvc%20cloop/ { system(mpvc" -q chapter-loop") } - /GET \/\?cmd=mpvc%20cprev/ { system(mpvc" -q chapter-prev") } - /GET \/\?cmd=mpvc%20cnext/ { system(mpvc" -q chapter-next") } - /GET \/\?cmd=mpvc%20cplayrand/ { system(mpvc" -q cplayrand") } + BEGIN { quiet=1 } + + /GET \/\?cmd=mpvc%20mpv/ { system(mpvc" mpvc -q mpv") } + /GET \/\?cmd=mpvc%20clear/ { system(mpvc" mpvc -q clear") } + /GET \/\?cmd=mpvc%20kill/ { system(mpvc" mpvc -q kill") } + /GET \/\?cmd=mpvc%20vol%20-5/ { system(mpvc" mpvc -q vol -5") } + /GET \/\?cmd=mpvc%20vol%20\+5/ { system(mpvc" mpvc -q vol +5") } + + /GET \/\?cmd=mpvc%20--mute/ { system(mpvc" mpvc -q --mute") } + /GET \/\?cmd=mpvc%20toggle/ { system(mpvc" mpvc -q toggle") } + /GET \/\?cmd=mpvc%20play/ { system(mpvc" mpvc -q play") } + /GET \/\?cmd=mpvc%20start%200/ { system(mpvc" mpvc -q start 0") } + /GET \/\?cmd=mpvc%20start%20$/ { system(mpvc" mpvc -q start $") } + /GET \/\?cmd=mpvc%20stop/ { system(mpvc" mpvc -q stop") } + /GET \/\?cmd=mpvc%20prev/ { system(mpvc" mpvc -q prev") } + /GET \/\?cmd=mpvc%20next/ { system(mpvc" mpvc -q next") } + /GET \/\?cmd=mpvc%20playrand/ { system(mpvc" mpvc -q playrand") } + + /GET \/\?cmd=mpvc%20shuffle/ { system(mpvc" mpvc -q shuffle") } + /GET \/\?cmd=mpvc%20unshuffle/ { system(mpvc" mpvc -q unshuffle") } + + /GET \/\?cmd=mpvc%20repeat/ { system(mpvc" mpvc -q repeat") } + /GET \/\?cmd=mpvc%20single/ { system(mpvc" mpvc -q single") } + /GET \/\?cmd=mpvc%20replay/ { system(mpvc" mpvc -q replay") } + + /GET \/\?cmd=mpvc%20togglev/ { system(mpvc" mpvc -q togglev") } + /GET \/\?cmd=mpvc%20aspect/ { system(mpvc" mpvc -q aspect") } + /GET \/\?cmd=mpvc%20togglew/ { system(mpvc" mpvc -q togglew") } + /GET \/\?cmd=mpvc%20togglef/ { system(mpvc" mpvc -q togglef") } + /GET \/\?cmd=mpvc%20togglei/ { system(mpvc" mpvc -q togglei") } + + /GET \/\?cmd=mpvc%20cstart/ { system(mpvc" mpvc -q cplay 0") } + /GET \/\?cmd=mpvc%20creplay/ { system(mpvc" mpvc -q chapter-replay") } + /GET \/\?cmd=mpvc%20cloop/ { system(mpvc" mpvc -q chapter-loop") } + /GET \/\?cmd=mpvc%20cprev/ { system(mpvc" mpvc -q chapter-prev") } + /GET \/\?cmd=mpvc%20cnext/ { system(mpvc" mpvc -q chapter-next") } + /GET \/\?cmd=mpvc%20cplayrand/ { system(mpvc" mpvc -q cplayrand") } /GET \/\?cli=mpvc/ { r=$0; gsub("HTTP.*$", "", r); - gsub("^.*GET \\/\\?cli=mpvc\\+", mpvc" ", r); - gsub("^.*GET \\/\\?cli=mpvc-", mpvc" ", r); + gsub("^.*GET \\/\\?cli=(mpvc-)", mpvc" mpvc-", r); + gsub("^.*GET \\/\\?cli=(mpvc)\\+", mpvc" mpvc", r); if (ENVIRON["MPVC_WEB_DEV"] && match(r, "^"mpvc)) { @@ -573,8 +582,8 @@ mpvc_web() gsub("%22", "\"", r); gsub("%2B", "+", r); gsub("%23", "#", r); - gsub("%2F", "/",r); - gsub("%3A", ":",r); + gsub("%2F", "/", r); + gsub("%3A", ":", r); #print(r); system(r); # XXX From dad5d12c80e25978411ffe6c6b3a5ebc34c927a1 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 10 Aug 2024 07:22:46 +0200 Subject: [PATCH 089/104] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24557a05..2c5eaa19 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ brew install gawk socat fzf rlwrap jq gnu-sed yt-dlp # mpv curl libnotify emerge mpvc ``` -### Nix [mpvc](http://github.com/nixos/nixpkgs/tree/master/pkgs/applications/misc/mpvc) +### Nix [mpvc](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/mp/mpvc/) ```console nix-env -i mpvc From 740a669ea17338970bd405c6a6deee2c32b5a449 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 10 Aug 2024 10:10:02 +0200 Subject: [PATCH 090/104] extras: Update extras/mpvc-web (fix&break things) --- extras/mpvc-web | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 00191fc1..06a0425e 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -204,6 +204,8 @@ mpvc_cmd() { echo "Content-Type: text/plain"; echo; $MPVC "\$@"; } mpvc_plain() { echo "Content-Type: text/plain"; echo; echo "\$@"; } mpvc_html() { echo "Content-Type: text/html"; echo; echo "\$@"; } mpvc_redir() { mpvc_html ''; } +mpvc_split() { for f in \$@; do echo "\$f"; done; } + main() { QUERY_STRING="\${QUERY_STRING:-\$@}" @@ -221,11 +223,11 @@ main() mpvc+chapter-list-nr) mpvc_cmd chapter-list-nr | mpvc_strip ;; mpvc+chapter-list-full) mpvc_cmd chapter-list-full | mpvc_strip ;; - mpvc-now*) mpvc_plain "\$(eval $PROGDIR/"\$@")" ;; - mpvc-fzf*) mpvc_plain "\$(eval $PROGDIR/"\$@")" ;; - mpvc-equalizer*) mpvc_plain "\$(eval $PROGDIR/"\$@")" ;; + mpvc-now*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; + mpvc-fzf*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; + mpvc-equalizer*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; - mpvc*) mpvc_plain "\$(eval $MPVC "\$@")" ;; + mpvc*) mpvc_plain "\$($MPVC \$(mpvc_split "\$@"))" ;; esac } main "\$@" From 073fd1fe3bb85f2aa3ea16417351507f287bb92d Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 10 Aug 2024 10:19:53 +0200 Subject: [PATCH 091/104] extras: Update extras/mpvc-web (fix&break things) --- extras/mpvc-web | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 06a0425e..06e9bce3 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -199,12 +199,13 @@ mpvc_web_cgi() # /cgi-bin/mpvc #!/bin/sh set -euf mpvc_warn() { echo "\$@" >&2; } +mpvc_quiet() { "\$@" >/dev/null; } mpvc_strip() { sed '/\x1b\[7m/ { s|\x1b\[7m||; s| |+|; }; s|\x1b\[0m||;'; } mpvc_cmd() { echo "Content-Type: text/plain"; echo; $MPVC "\$@"; } mpvc_plain() { echo "Content-Type: text/plain"; echo; echo "\$@"; } mpvc_html() { echo "Content-Type: text/html"; echo; echo "\$@"; } mpvc_redir() { mpvc_html ''; } -mpvc_split() { for f in \$@; do echo "\$f"; done; } +mpvc_split() { for i in \$@; do echo "\$i"; done; } main() { @@ -223,11 +224,11 @@ main() mpvc+chapter-list-nr) mpvc_cmd chapter-list-nr | mpvc_strip ;; mpvc+chapter-list-full) mpvc_cmd chapter-list-full | mpvc_strip ;; - mpvc-now*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; - mpvc-fzf*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; - mpvc-equalizer*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; + mpvc-now[+\ ]*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; + mpvc-fzf[+\ ]*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; + mpvc-equalizer[+\ ]*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; - mpvc*) mpvc_plain "\$($MPVC \$(mpvc_split "\$@"))" ;; + mpvc[+\ ]*) mpvc_plain "\$($PROGDIR/\$(mpvc_split "\$@"))" ;; esac } main "\$@" @@ -575,7 +576,7 @@ mpvc_web() r=$0; gsub("HTTP.*$", "", r); gsub("^.*GET \\/\\?cli=(mpvc-)", mpvc" mpvc-", r); - gsub("^.*GET \\/\\?cli=(mpvc)\\+", mpvc" mpvc", r); + gsub("^.*GET \\/\\?cli=(mpvc)\\+", mpvc" mpvc ", r); if (ENVIRON["MPVC_WEB_DEV"] && match(r, "^"mpvc)) { From 5b46db4e6f2fcc24bcfadd41fd042f784fc15ff5 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 10 Aug 2024 11:49:20 +0200 Subject: [PATCH 092/104] mpvc: Update mpvc --- mpvc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpvc b/mpvc index c8e24778..8029443e 100755 --- a/mpvc +++ b/mpvc @@ -1017,7 +1017,7 @@ main() { mpvc_config arg1=${1:-} case "$arg1" in - ytquery|ytqueryjson) ;; + ytquery|ytqueryjson|--tac|tac) ;; -k|--kill|kill|-K|--killall|killall) ;; -c|--crop|crop|-C|--clear|clear|cmd|sockcmd|socklist|--socklist) ;; -a|add|append|-A|playnext|--playnext|-n|playnow|--playnow|mpv|--mpv|stash|--stash|--toggle|toggle|-q|--quiet) ;; From 6835a8995437a58da0f414ac876c62db3598bfbe Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:11:04 +0200 Subject: [PATCH 093/104] extras: Update extras/mpvc-fzf --- extras/mpvc-fzf | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/mpvc-fzf b/extras/mpvc-fzf index 2d28f1f9..2a10b8a4 100755 --- a/extras/mpvc-fzf +++ b/extras/mpvc-fzf @@ -426,6 +426,7 @@ main() G) mpvcfzf_fetch $(mpvcfzf_iplay "$OPTARG") ;; i) mpvcfzf_lyrics "${OPTARG:-}";; I) mpvcfzf_lyrics "";; + L) echo "https://ddg.gg?ia=lyrics&iax=lyrics&q=lyrics $(mpvc -f '%title%')" ;; k) mpvcfzf_ddg_play "$OPTARG";; K) mpvcfzf_ddg "$OPTARG";; h) mpvcfzf_usage ;; From 08fb15e66f874520fedc9546d324439b5b137d2b Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:11:11 +0200 Subject: [PATCH 094/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 06e9bce3..8cbdcafa 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -214,7 +214,7 @@ main() env -i PATH="/usr/bin:/bin" HOME="\$HOME" TERM="\$TERM" QUERY_STRING="\${QUERY_STRING:-}" "\$0" "\$@"; exit; fi case "\$QUERY_STRING" in - lyrics) mpvc_redir "https://ddg.gg?ia=lyrics&iax=lyrics&q=lyrics \$($MPVC -f '%title%')" ;; + lyrics) mpvc_redir "\$($MPVC-fzf -L '')" ;; mpvc+status) mpvc_cmd status | mpvc_strip ;; mpvc+playlist) mpvc_cmd playlist | mpvc_strip ;; From 5c8fd46de725cb8199514939743ab09bdf75ee89 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 17 Aug 2024 10:54:27 +0200 Subject: [PATCH 095/104] mpvc: Update mpvc --- mpvc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpvc b/mpvc index 8029443e..d6cfc3ad 100755 --- a/mpvc +++ b/mpvc @@ -301,7 +301,7 @@ mpvc_get_playlist_json() { mpvc_get_playlist_once() { mpvc_get_playlist_json | - sed 's|,"current":true||; s|,"playing":true||; s|,"id":[0-9]\+||; s|{"filename":"\(.*\)"}|\1|; s|","title":.*||; s/,$//; /^\[$/d; /\]$/d' | + sed 's|,"current":true||; s|,"playing":true||; s|,"id":[0-9]*||; s|{"filename":"\(.*\)"}|\1|; s|","title":.*||; s/,$//; /^\[$/d; /\]$/d' | awk -v numbered="${1:-}" ' { gsub("^[ \t]*", " ") From 157ca82e048b75014c1f85cd4b17d88aea972e48 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:44:43 +0200 Subject: [PATCH 096/104] extras: Update extras/mpvc-web --- extras/mpvc-web | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-web b/extras/mpvc-web index 8cbdcafa..f949d589 100755 --- a/extras/mpvc-web +++ b/extras/mpvc-web @@ -313,10 +313,11 @@ mpvc_web_index() [ ๐ŸŽง $PROGNAME - #stat + #st #ls - $([ -n "$MPVC_WEB_ARCHIVE_ENABLE" ] && echo '#a'; ) #n + #x + $([ -n "$MPVC_WEB_ARCHIVE_ENABLE" ] && echo '#a'; ) $([ -n "$MPVC_WEB_CAST_URL" ] && echo "#c"; ) ]
      @@ -483,6 +484,7 @@ mpvc_web_setup() echo "# $PROGNAME Setup $MPVC_WEB_ROOT" mkdir -p "$MPVC_WEB_ROOT" || return mkdir -p "$MPVC_WEB_ROOT/cgi-bin/" || return + mkdir -p "$MPVC_WEB_ROOT/extras/" || return cd "$MPVC_WEB_ROOT" || return chmod -R u+w "${MPVC_WEB_ROOT%/*}" From c3751a6136ff354bc2db264c64a3b9e8865a2e07 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 17 Aug 2024 11:06:16 +0200 Subject: [PATCH 097/104] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c5eaa19..6c0664a5 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ pacman -Sy mpv gawk curl socat fzf rlwrap jq libnotify BSD (and pkg(1) based derivatives as FreeBSD, see [FAQ](../../wiki/FAQ)): ```console -pkg install -y mpv gawk curl socat fzf rlwrap jq libnotify gsed +pkg install -y mpv curl socat fzf rlwrap jq libnotify # gawk gsed ``` ### MacOS @@ -140,7 +140,7 @@ pkg install -y mpv gawk curl socat fzf rlwrap jq libnotify gsed MacOS (and brew(1) based derivatives see [FAQ](../../wiki/FAQ)): ```console -brew install gawk socat fzf rlwrap jq gnu-sed yt-dlp # mpv curl libnotify +brew install mpv curl socat fzf rlwrap jq libnotify yt-dlp # gawk gnu-sed ``` ### Gentoo [mpvc](https://gitlab.com/xy2_/osman) From 2de9551c97da08ebe1d4132daf608cdb690b4936 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sat, 17 Aug 2024 19:45:01 +0200 Subject: [PATCH 098/104] extras: Update extras/mpvc-equalizer --- extras/mpvc-equalizer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mpvc-equalizer b/extras/mpvc-equalizer index 4b020ce6..e1d7dc0f 100755 --- a/extras/mpvc-equalizer +++ b/extras/mpvc-equalizer @@ -102,7 +102,7 @@ mpvc_values() mpvc getr af | jq '.data | .[] | .params.graph' | grep -o "gain_entry = '.*':" | - sed -n 's/gain_entry = .//; s/.:$//; s|entry([0-9]\{1,2\},\([-.0-9]\+\));\?|\n\1 |gp' + sed -n 's/gain_entry = .//; s/.:$//; s|entry([0-9]\{1,2\},\([-.0-9]*\));*|\n\1 |gp' } mpvc_setvals() From d8358c6cf0f206d73182ea5230107f957877ef7a Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 18 Aug 2024 09:00:49 +0200 Subject: [PATCH 099/104] extras: Update extras/mpvc-equalizer --- extras/mpvc-equalizer | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/mpvc-equalizer b/extras/mpvc-equalizer index e1d7dc0f..1fc8ae0e 100755 --- a/extras/mpvc-equalizer +++ b/extras/mpvc-equalizer @@ -118,8 +118,9 @@ mpvc_bars() freq_table="0\n65\n157\n288\n472\n733\n1k1\n1k6\n2k4\n3k4\n4k9\n7k0\n10k\n14k\n20k\n" gain_table="$(printf "$mpvc_values" | sed '/^$/d')" preset=$(awk /"$(echo "$gain_table" | awk 'NR<10{s=s""$0} END{print s}')"/' {print $NF}' $0) + gain_table=$(echo "$mpvc_values") - awk -v freq="$freq_table" -v gain="$gain_table" -v cols=$(mpvc ttycols) -v preset=$preset ' + awk -v freq="$freq_table" -v gain="$gain_table" -v cols="$(mpvc ttycols)" -v preset="$preset" ' function mpvc_bar_line(val) { valf=val From 11c637643f46caccd74d1533bed7523089e77386 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 18 Aug 2024 09:08:41 +0200 Subject: [PATCH 100/104] extras: Update extras/mpvc-equalizer --- extras/mpvc-equalizer | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extras/mpvc-equalizer b/extras/mpvc-equalizer index 1fc8ae0e..8de134e1 100755 --- a/extras/mpvc-equalizer +++ b/extras/mpvc-equalizer @@ -15,21 +15,24 @@ PROGURL="https://github.com/gmt4/mpvc" MPVC_LABEL="${MPVC_LABEL:-mpvc-equalizer}" +MPVC_FREQ_TABLE="0 65 157 288 472 733 1k1 1k6 2k4 3k4 4k9 7k0 10k 14k 20k" +MPVC_GAIN_TABLE="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" + set -euf mpvc() { "$PROGDIR/mpvc" "$@"; } # mpvc-web? mpvc_genfilter() { - awk -v quote="'" -v gain_curr="$*" \ + awk -v quote="'" -v gain_curr="$*" -v freq_table_str="MPVC_FREQ_TABLE" -v gain_table_str="$MPVC_GAIN_TABLE" \ ' BEGIN { num_entry=15 min_val = -360 max_val = 120 - n=split("0 65 157 288 472 733 1k1 1k6 2k4 3k4 4k9 7k0 10k 14k 20k", freq_table) - n=split("0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", gain_table) + n=split(freq_table_str, freq_table) + n=split(gain_table_str, gain_table) if (gain_curr) n=split(gain_curr, gain_table) } @@ -115,10 +118,10 @@ mpvc_bars() { mpvc_values="$(mpvc_values)" if [ -z "$mpvc_values" ]; then usage; fi - freq_table="0\n65\n157\n288\n472\n733\n1k1\n1k6\n2k4\n3k4\n4k9\n7k0\n10k\n14k\n20k\n" + freq_table="$MPVC_FREQ_TABLE" gain_table="$(printf "$mpvc_values" | sed '/^$/d')" preset=$(awk /"$(echo "$gain_table" | awk 'NR<10{s=s""$0} END{print s}')"/' {print $NF}' $0) - gain_table=$(echo "$mpvc_values") + gain_table=$(echo $gain_table) awk -v freq="$freq_table" -v gain="$gain_table" -v cols="$(mpvc ttycols)" -v preset="$preset" ' function mpvc_bar_line(val) From 960c3650ab36f7f00853dd6e9423c857fcb56abd Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 18 Aug 2024 09:17:28 +0200 Subject: [PATCH 101/104] extras: Update extras/mpvc-equalizer --- extras/mpvc-equalizer | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extras/mpvc-equalizer b/extras/mpvc-equalizer index 8de134e1..68aec9c4 100755 --- a/extras/mpvc-equalizer +++ b/extras/mpvc-equalizer @@ -13,13 +13,12 @@ PROGVERSION="v1.5" PROGAUTHOR=gmt4 PROGURL="https://github.com/gmt4/mpvc" -MPVC_LABEL="${MPVC_LABEL:-mpvc-equalizer}" +set -euf +MPVC_LABEL="${MPVC_LABEL:-mpvc-equalizer}" MPVC_FREQ_TABLE="0 65 157 288 472 733 1k1 1k6 2k4 3k4 4k9 7k0 10k 14k 20k" MPVC_GAIN_TABLE="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" -set -euf - mpvc() { "$PROGDIR/mpvc" "$@"; } # mpvc-web? mpvc_genfilter() @@ -96,7 +95,7 @@ mpvc_presets() rock) echo "4.8 2.8 -3.4 -4.8 -2.0 2.4 5.3 6.7 6.7 6.7";; # preset: rock techno) echo "4.8 3.3 0.0 -3.4 -2.9 0.0 4.8 5.7 5.8 5.3";; # preset: techno - ''|help|list) awk '/# preset: / { print }' $0;; + ''|help|list) awk '/# preset: / { print }' "$0";; esac } @@ -120,7 +119,7 @@ mpvc_bars() if [ -z "$mpvc_values" ]; then usage; fi freq_table="$MPVC_FREQ_TABLE" gain_table="$(printf "$mpvc_values" | sed '/^$/d')" - preset=$(awk /"$(echo "$gain_table" | awk 'NR<10{s=s""$0} END{print s}')"/' {print $NF}' $0) + preset=$(awk /"$(echo "$gain_table" | awk 'NR<10{s=s""$0} END{print s}')"/' {print $NF}' "$0") gain_table=$(echo $gain_table) awk -v freq="$freq_table" -v gain="$gain_table" -v cols="$(mpvc ttycols)" -v preset="$preset" ' From 338b353ba53b16f0cecc3db8f2e66041d11264cc Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Sun, 18 Aug 2024 09:48:28 +0200 Subject: [PATCH 102/104] extras: Update extras/mpvc-autostart --- extras/mpvc-autostart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/mpvc-autostart b/extras/mpvc-autostart index da147991..295a73d1 100755 --- a/extras/mpvc-autostart +++ b/extras/mpvc-autostart @@ -19,7 +19,7 @@ mpvc_defaults() ARGS=${ARGS:-} } -mpvc_pingcheck() { ping -w 5 -c 5 "$@" | awk 'NR == 2 && /time=/ { sub(":.*time=",": time="); print }'; } +mpvc_pingcheck() { ping -c 5 "$@" | awk 'NR == 2 && /time=/ { sub(":.*time=",": time="); print }'; } mpvc_btcheck() { hcitool scan | awk "/$@/ {print}"; } # monitor presence of your phone (eg LAN IP/BT): if device is present resume audio, otherwise, pause audio. @@ -46,7 +46,7 @@ mpvc_autoscan() [ "$ncheck" -gt 0 ] && mpvc -q resume # n>0 pings up: resume [ "$ncheck" -le -$NCHECK ] && mpvc -q pause # n<0 pings down: pause fi - echo "# $(date -Imin) PERIOD=$PERIOD NCHECK=$NCHECK pause=$pause c=${#check} n=${ncheck} $check" # $@ + echo "# $(date) PERIOD=$PERIOD NCHECK=$NCHECK pause=$pause c=${#check} n=${ncheck} $check" # $@ done } From 2a98bff01dd4d1d1748dd83a4672dbaab06295f8 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:37:37 +0200 Subject: [PATCH 103/104] Update mpvc --- mpvc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpvc b/mpvc index d6cfc3ad..3e213cbc 100755 --- a/mpvc +++ b/mpvc @@ -903,7 +903,7 @@ isInt() { printf '%d' "$1" >/dev/null 2>&1 && [ -n "$1" ]; } mpvc_tty_size() { # this is convoluted as mpvc is run as cgi by mpvc-web without an actual tty - ttydev="${ttydev:-$(if tty -s; then tty; else ps -hp $$ -o tty | awk '{sub("^","/dev/");l=$0} END{print l}'; fi)}" + ttydev="${ttydev:-$(if tty -s; then tty; else ps -hp $$ -o tty | awk '{sub("^","/dev/");gsub(" ","");l=$0} END{print l}'; fi)}" ttysize=${ttysize:-$(equiet stty -F "$ttydev" size || equiet stty -f "$ttydev" size || equiet stty size || stty)} echo "$ttysize" From f8da4cb3373e56eec7c719747d91bdd46aeea504 Mon Sep 17 00:00:00 2001 From: gmt4 <791491+gmt4@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:48:51 +0200 Subject: [PATCH 104/104] Update mpvc --- mpvc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpvc b/mpvc index 3e213cbc..1ade46aa 100755 --- a/mpvc +++ b/mpvc @@ -885,7 +885,7 @@ mpvc_print_status() { } ' ) - mpvc_cmd "expand-text" "${F}" | sed 's/ \\r/\n/g' + mpvc_cmd "expand-text" "${F}" | awk '{gsub(" \\\\r","\n");print}' } mpvc_print_status_final() {