nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 42a5479fa8e66be2c550f64572c2befd8653bc8d
parent de2773c6774300fd37e6864db9184e606967c276
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Fri, 21 Jun 2019 22:36:34 +0530

Add an mp3 ringtone generator

Diffstat:
Mplugins/README.md | 1+
Mplugins/ndiff | 2+-
Aplugins/ringtone | 31+++++++++++++++++++++++++++++++
Mplugins/splitjoin | 2+-
4 files changed, 34 insertions(+), 2 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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