mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Compare commits
5 Commits
cb5504de6f
...
2cb49c035b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cb49c035b | ||
|
|
475e4abb40 | ||
|
|
1d1c9dd1a8 | ||
|
|
6ec5ae9779 | ||
|
|
b7da698d00 |
@ -136,6 +136,60 @@ cmd bulkrename ${{
|
||||
lf -remote "send $id unselect"
|
||||
}}
|
||||
|
||||
cmd encodetomp3 ${{
|
||||
clear;
|
||||
set -f;
|
||||
|
||||
#Variables for notify-send
|
||||
converted_filenames="";
|
||||
converted_files_count=0;
|
||||
videos_without_audio_streams="";
|
||||
videos_without_audio_streams_count=0;
|
||||
|
||||
for pickedFilepath in $fx; do
|
||||
case $pickedFilepath in
|
||||
*.mp4 | *.webm | *.mkv)
|
||||
;;
|
||||
*)
|
||||
echo 'Skipping ${pickedFilepath}' && continue 1;;
|
||||
esac
|
||||
|
||||
parsed_MP3=$(echo "$pickedFilepath" | sed 's/\(.mp4\|.webm\|.mkv\)/.mp3/' | sed 's|.*\/||');
|
||||
parsed_MP3="~/Music/${parsed_MP3}";
|
||||
|
||||
#Using ffprobe because videos without audiostream result in exit code 1 which stops this entire loop of many files
|
||||
#Remove (alongside its 2 variables) if you don't record videos without audio (which are admittedly rare)
|
||||
if [[ $(ffprobe -loglevel error -show_entries stream=codec_type -of csv=p=0 "$pickedFilepath") != *"audio"* ]]; then
|
||||
((videos_without_audio_streams_count=videos_without_audio_streams_count+1));
|
||||
videos_without_audio_streams="$videos_without_audio_streams"$'\n'"$pickedFilepath";
|
||||
continue 1;
|
||||
fi
|
||||
|
||||
ffmpeg -i "$pickedFilepath" "$parsed_MP3";
|
||||
|
||||
((converted_files_count=converted_files_count+1));
|
||||
converted_filenames="$converted_filenames"$'\n'"$pickedFilepath";
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
rm -f -- $pickedFilepath;
|
||||
fi
|
||||
done
|
||||
|
||||
#Notify the results to the user
|
||||
if [[ $converted_files_count -gt 0 ]]; then
|
||||
converted_filenames=$(echo "$converted_filenames" | sed 's|.*\/||');
|
||||
notify-send "Converted MP3 Files($converted_files_count):" "$converted_filenames";
|
||||
fi;
|
||||
|
||||
if [[ $videos_without_audio_streams_count -gt 0 ]]; then
|
||||
videos_without_audio_streams=$(echo "$videos_without_audio_streams" | sed 's|.*\/||');
|
||||
notify-send "Videos without audio stream($videos_without_audio_streams_count):" "$videos_without_audio_streams";
|
||||
fi;
|
||||
|
||||
#Uncomment the below line if you want to automatically unselect the original converted video files
|
||||
#lf -remote "send $id unselect";
|
||||
}}
|
||||
|
||||
# Bindings
|
||||
map <c-f> $lf -remote "send $id select \"$(fzf)\""
|
||||
map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)"
|
||||
@ -177,5 +231,8 @@ map <c-l> unselect
|
||||
|
||||
|
||||
|
||||
map b encodetomp3
|
||||
map <a-b> encodetomp3 delete_after_encoding
|
||||
|
||||
# Source Bookmarks
|
||||
source "~/.config/lf/shortcutrc"
|
||||
|
||||
@ -30,6 +30,11 @@ image/svg+xml)
|
||||
[ ! -f "$CACHE" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1"
|
||||
image "$CACHE.png" "$2" "$3" "$4" "$5" "$1"
|
||||
;;
|
||||
image/x-xcf)
|
||||
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
|
||||
[ ! -f "$CACHE.jpg" ] && convert "$1[0]" "$CACHE.jpg"
|
||||
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
|
||||
;;
|
||||
image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
|
||||
text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
|
||||
text/troff) man ./ "$1" | col -b ;;
|
||||
|
||||
@ -9,7 +9,7 @@ output="$(date '+%y%m%d-%H%M-%S').png"
|
||||
xclip_cmd="xclip -sel clip -t image/png"
|
||||
ocr_cmd="xclip -sel clip"
|
||||
|
||||
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
|
||||
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)\\nOCR a selected area (copy)" | dmenu -l 7 -i -p "Screenshot which area?")" in
|
||||
"a selected area") maim -u -s pic-selected-"${output}" ;;
|
||||
"current window") maim -B -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
|
||||
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user