aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/README.md1
-rwxr-xr-xplugins/ndiff2
-rwxr-xr-xplugins/ringtone31
-rwxr-xr-xplugins/splitjoin2
4 files changed, 34 insertions, 2 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 0b9a742..ecb8519 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -18,6 +18,7 @@
| pdfview | sh | pdftotext/mupdf-tools | View PDF file in `$PAGER` |
| picker | sh | nnn | Pick files and pipe the newline-separated list to another utility |
| pywal | sh | pywal | Set selected image as wallpaper, change terminal color scheme |
+| ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file |
| splitjoin | sh | split, cat | Split file or join selection |
| sxiv | sh | sxiv | Browse images in a dir in sxiv, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))|
| transfer | sh | curl | Upload file to transfer.sh |
diff --git a/plugins/ndiff b/plugins/ndiff
index 9590cf4..3e9d8a4 100755
--- a/plugins/ndiff
+++ b/plugins/ndiff
@@ -6,7 +6,7 @@
# press 'Enter' to ignore and proceed.
#
# Shell: POSIX compliant
-# Author: Arun Prakash Jana
+# Authors: Arun Prakash Jana, ath3
selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
diff --git a/plugins/ringtone b/plugins/ringtone
new file mode 100755
index 0000000..3b16edd
--- /dev/null
+++ b/plugins/ringtone
@@ -0,0 +1,31 @@
+#!/usr/bin/env sh
+
+# Description: Create an mp3 ringtone out of an audio file in any format
+# Needs user to provide start and end where to cut the file
+# Input file audio.ext results in audio_ringtone.mp3
+# Requires: date, ffmpeg
+#
+# Shell: POSIX compliant
+# Author: Arun Prakash Jana
+
+if ! [ -z "$1" ]; then
+ echo -n "start (hh:mm:ss): "
+ read start
+ st=`date -d "$start" +%s`
+
+ echo -n "end (hh:mm:ss): "
+ read end
+ et=`date -d "$end" +%s`
+
+ if [ $st -ge $et ]; then
+ echo "error: start >= end"
+ exit 1
+ fi
+
+ interval=$(( $et - $st ))
+
+ outfile=`basename "$1"`
+ outfile="${outfile%.*}"_ringtone.mp3
+
+ ffmpeg -i "$1" -ss "$start" -t "$interval" -vn -sn -acodec libmp3lame -q:a 2 "$outfile"
+fi
diff --git a/plugins/splitjoin b/plugins/splitjoin
index f79d92e..60a5408 100755
--- a/plugins/splitjoin
+++ b/plugins/splitjoin
@@ -6,7 +6,7 @@
# Adds '.out suffix to the first file to be joined and saves as output file for join
#
# Shell: POSIX compliant
-# Author: Arun Prakash Jana
+# Authors: Arun Prakash Jana, ath3
selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
resp=s