From 1390824f4a379b8692c0555e8ccd00d0e63785a8 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 18 Sep 2023 22:25:13 +0200 Subject: [mmedia] use mmedia in favor of mcurs Use a function for concat_path this make it easy to disable it by redefining it. --- bin/menuscripts/mmedia | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin/menuscripts/mmedia') diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia index 3f7016c..5d7c4ae 100755 --- a/bin/menuscripts/mmedia +++ b/bin/menuscripts/mmedia @@ -4,6 +4,8 @@ tmp="/tmp/mmedia" dirs="$HOME/dl" +concat_path() { sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g"; } + case "$1" in "video") regex='^.\+\.\(webm\|mp4\|mpeg\|mkv\)$' @@ -17,16 +19,22 @@ case "$1" in regex='^.\+\.\(png\|avif\|jpg\)$' dirs="$dirs $HOME/pics" viewer() { imv "$1"; } ;; + "cursus") + regex='^.*/[cC]ursus/index.html$' + dirs="$HOME/docs/school" + concat_path() { cat; } + viewer() { $BROWSER "$1"; } ;; *) choice="$(cat <<-EOF | commander -d -c video pdf images + cursus EOF )" [ "$choice" ] || exit 1 "$0" "$choice" - exit 1 ;; + exit ;; esac shift @@ -35,7 +43,7 @@ shift choice="$(find -L $dirs 2> /dev/null | grep "$regex" | sort | tee "$tmp" | - sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g" | + concat_path | commander -c -d -n -x)" file="$(sed -n "${choice}p" "$tmp")" -- cgit v1.2.3