Add an mp3 ringtone generator

This commit is contained in:
Arun Prakash Jana 2019-06-21 22:36:34 +05:30
parent de2773c677
commit 42a5479fa8
No known key found for this signature in database
GPG Key ID: A75979F35C080412
4 changed files with 34 additions and 2 deletions

View File

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

View File

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

31
plugins/ringtone Executable file
View File

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

View File

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