mirror of
https://github.com/hydroxycarbamide/dotfiles.git
synced 2025-05-07 21:39:07 -04:00
Add nnn
This commit is contained in:
parent
0ef5de12ac
commit
c0889285ff
58 changed files with 5175 additions and 0 deletions
30
dot_config/nnn/plugins/executable_pdfread
Normal file
30
dot_config/nnn/plugins/executable_pdfread
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Read a text or PDF file in British English
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
tmpf="$(basename "$1")"
|
||||
tmpf="${TMPDIR:-/tmp}"/"${tmpf%.*}"
|
||||
|
||||
if [ "$(head -c 4 "$1")" = "%PDF" ]; then
|
||||
# Convert using pdftotext
|
||||
pdftotext -nopgbrk -layout "$1" - | sed 's/\xe2\x80\x8b//g' > "$tmpf".txt
|
||||
|
||||
pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$tmpf".txt)"
|
||||
|
||||
rm "$tmpf".txt
|
||||
else
|
||||
pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$1")"
|
||||
fi
|
||||
|
||||
# to jump around and note the time
|
||||
mpv "$tmpf".wav
|
||||
|
||||
# flat read but better quality
|
||||
# play -qV0 "$tmpf".wav treble 2 gain -l 2
|
||||
|
||||
rm "$tmpf".wav
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue