From e5cda5460452e44e824bf7480ddb6db8625f694d Mon Sep 17 00:00:00 2001
From: ath3 <ha05190@protonmail.com>
Date: Thu, 27 Jun 2019 03:38:02 +0200
Subject: [PATCH] Small ringtone plugin fixes

---
 plugins/ringtone | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/ringtone b/plugins/ringtone
index 3b16edd4..ee7ae8a4 100755
--- a/plugins/ringtone
+++ b/plugins/ringtone
@@ -8,14 +8,14 @@
 # Shell: POSIX compliant
 # Author: Arun Prakash Jana
 
-if ! [ -z "$1" ]; then
+if [ -n "$1" ]; then
     echo -n "start (hh:mm:ss): "
     read start
-    st=`date -d "$start" +%s`
+    st=$(date -d "$start" +%s) || exit 1
 
     echo -n "end (hh:mm:ss): "
     read end
-    et=`date -d "$end" +%s`
+    et=$(date -d "$end" +%s) || exit 1
 
     if [ $st -ge $et ]; then
         echo "error: start >= end"
@@ -24,7 +24,7 @@ if ! [ -z "$1" ]; then
 
     interval=$(( $et - $st ))
 
-    outfile=`basename "$1"`
+    outfile=$(basename "$1")
     outfile="${outfile%.*}"_ringtone.mp3
 
     ffmpeg -i "$1" -ss "$start" -t "$interval" -vn -sn -acodec libmp3lame -q:a 2 "$outfile"
-- 
2.51.0