From d4423467553a3adad831d241912af0a009a165aa Mon Sep 17 00:00:00 2001
From: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sun, 23 Feb 2020 15:23:39 +0530
Subject: [PATCH] Update mocplay to understand opener calls

---
 plugins/mocplay | 4 +++-
 plugins/mp3conv | 2 +-
 plugins/nuke    | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/plugins/mocplay b/plugins/mocplay
index 211a3db5..30818b29 100755
--- a/plugins/mocplay
+++ b/plugins/mocplay
@@ -57,7 +57,9 @@ if [ ! -s "$selection" ] && [ -z "$1" ]; then
    exit
 fi
 
-if [ -s "$selection" ]; then
+if [ "$2" = "opener" ]; then
+    :
+elif [ -s "$selection" ]; then
     printf "Work with selection? Enter 'y' to confirm: "
     read -r resp
 fi
diff --git a/plugins/mp3conv b/plugins/mp3conv
index 1c009097..b582cbca 100755
--- a/plugins/mp3conv
+++ b/plugins/mp3conv
@@ -15,7 +15,7 @@ handle_multimedia() {
 
     case "${mime}" in
         audio/* | video/*)
-            ffmpeg -i "${file}" -vn -codec:a libmp3lame -q:a 2 "${outdir}"/"${file%.*}.mp3"
+            ffmpeg -i "${file}" -vn -codec:a libmp3lame -q:a 2 "${outdir}/${file%.*}.mp3"
             ;;
         *)
             ;;
diff --git a/plugins/nuke b/plugins/nuke
index 9487780e..604777b0 100755
--- a/plugins/nuke
+++ b/plugins/nuke
@@ -99,8 +99,8 @@ handle_pdf() {
 }
 
 handle_audio() {
-    if which mocp >/dev/null 2>&1; then
-        mocplay "${FPATH}" >/dev/null 2>&1
+    if which mocplay >/dev/null 2>&1; then
+        mocplay "${FPATH}" "opener" >/dev/null 2>&1
         exit 0
     elif which mpv >/dev/null 2>&1; then
         mpv "${FPATH}" >/dev/null 2>&1 &
-- 
2.51.0