]> Sergey Matveev's repositories - nnn.git/commitdiff
Small ringtone plugin fixes
authorath3 <ha05190@protonmail.com>
Thu, 27 Jun 2019 01:38:02 +0000 (03:38 +0200)
committerath3 <ha05190@protonmail.com>
Thu, 27 Jun 2019 01:38:02 +0000 (03:38 +0200)
plugins/ringtone

index 3b16edd424e6be87489b24e416fa24e38afd770b..ee7ae8a47a0c83d9c5942907ea40b14c661493ba 100755 (executable)
@@ -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"