Generic update.

This commit is contained in:
CronyAkatsuki 2023-02-22 19:17:52 +01:00
parent de255e55d7
commit 868fbb687b
5 changed files with 107 additions and 3 deletions

46
recorder Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
record () {
## Options
frameRate=60 # FPS
audioQuality=10 # Opus Qual - Bad 0 <> 10 Good
videoQuality=15 # H264 QVal - Lower is better
recordLocation=~/vids/yt
## Auto-Config - Use the last render device which should be the Intel GPU
currentRes=$(xdpyinfo | grep dimensions | awk '{print $2}')
ffmpeg -loglevel 16 -threads 6 -probesize 10M -framerate ${frameRate} -vsync 1 \
-thread_queue_size 512 -f x11grab -s ${currentRes} -r ${frameRate} -i :0.0 \
-thread_queue_size 512 -f pulse -ac 2 -channel_layout stereo -i default -c:a libopus -vbr on -compression_level ${audioQuality} \
-c:v h264_nvenc -qp ${videoQuality} "${recordLocation}/$(date +%y%m%d%H%M%S).mkv" > /tmp/recorder.log &
printf '%s\n' "$!" > /tmp/recording.pid
if [ "$?" -ne "0" ]; then
quick-notify "Recorder" "Failed to start recording"
quick-notify "Recorder" "Error: $(cat /tmp/recorder.log)"
else
touch /tmp/recording.lock
quick-notify "Recorder" "Started recording"
fi
}
stop () {
pid=$(cat /tmp/recording.pid)
kill $pid
if [ "$?" -ne "0" ];then
quick-notify "Recorder" "Failed to stop recording"
else
quick-notify "Recorder" "Stopped recording"
fi
rm /tmp/recording.pid /tmp/recording.lock /tmp/recorder.log
}
if [ -f "/tmp/recording.lock" ]; then
stop
else
record
fi

View File

@ -26,7 +26,7 @@ printf '%s\n' "$password" | sudo -S mount /dev/mapper/luks /mnt/encrypted
while read Line; do
echo "Syncing $(basename $Line)"
rsync -ahAX -v --delete "$Line" $HOME/.local/backup
rsync -ahAX -v --delete "$Line" /mnt/encrypted
done <<< "$(cat $HOME/.config/rsync/backup-list)"
printf '\n%s\n\n' "Unmounting encrypted drive"

View File

@ -2,7 +2,7 @@
tasks=$(task status:pending -notified due export | jq -r '.[].description')
[ -z "$tasks" ] && exit 0
for task in $tasks; do
while read task; do
notify-send 'A task is due.' "$task"
done
done <<< "$(echo $tasks)"
task rc.bulk=0 rc.confirmation=off status:pending -notified due modify +notified

17
vpn Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
up () {
transmission-remote --exit
sudo wg-quick up myvpn
exit
}
down () {
sudo wg-quick down myvpn
start-program transmission-daemon
exit
}
[ "$1" = "up" ] && up
[ "$1" = "down" ] && down
exit 1

41
watcher Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
watch () {
mpv "$1"
clear
read -p 'Did you finish watching? [Y/n]: ' yn
while true; do
if [ -z "$yn" ] || [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
name=$(printf '%s\n' "$1" | sed 's:./::g')
printf '%s\n' "$name" >> "$2"
break
elif [ "$yn" = "N" ] || [ "$yn" = "n" ]; then
break
fi
read -p 'Try again? [Y/n]: ' yn
done
}
# check () {
#
# }
# config
[ ! -d "$HOME/.config/watcher" ] && mkdir -p "$HOME/.config/watcher/"
[ ! -f "$HOME/.config/watcher/config" ] && touch "$HOME/.config/watcher/config"
directory=$(cat $HOME/.config/watcher/config | grep 'directory' | cut -d= -f 2)
exclude=$(printf '! -name %s ' $(cat $HOME/.config/watcher/config | grep 'exclude' | cut -d= -f 2 | sed 's/;/\n/g'))
# watchlist
[ ! -f '$HOME/.cache/watchlist' ] && touch "$HOME/.cache/watchlist"
[ -s "$HOME/.cache/watchlist" ] && watchlist=$(printf '! -name %s ' $(cat $HOME/.cache/watchlist)) || watchlist=""
cd $directory
while true; do
current_dir=$(basename $(pwd))
choice=$(find -maxdepth 1 -mindepth 1 $exclude $watchlist | sort | fzf -i --prompt "Current directory: $current_dir ")
[ -z "$choice" ] && clear && exit
[ -d "$choice" ] && cd "$choice"
[ -f "$choice" ] && watch "$choice" "$HOME/.cache/watchlist" && watchlist=$(printf '! -name %s ' $(cat $HOME/.cache/watchlist))
done