aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/http-echo1
-rwxr-xr-xscripts/preview6
-rwxr-xr-xscripts/timer13
-rwxr-xr-xscripts/vid-dl23
4 files changed, 42 insertions, 1 deletions
diff --git a/scripts/http-echo b/scripts/http-echo
index e17445b..094d317 100755
--- a/scripts/http-echo
+++ b/scripts/http-echo
@@ -87,7 +87,6 @@ def launch(address: str, port: int):
if __name__ == "__main__":
import argparse
- # TODO: add help
parser = argparse.ArgumentParser(
description='A simple http echo server'
)
diff --git a/scripts/preview b/scripts/preview
index e3a0172..ff77782 100755
--- a/scripts/preview
+++ b/scripts/preview
@@ -16,6 +16,8 @@ elif grep -q "ISO" <<< "$filetype" ; then
filetype="iso"
elif grep -q "PDF" <<< "$filetype"; then
filetype="pdf"
+elif grep -q "SQLite 3" <<< "$filetype"; then
+ filetype="sqlite"
fi
case $filetype in
@@ -41,6 +43,10 @@ case $filetype in
pdftotext -nodiag -nopgbrk "$path" - | head -n "$remaining_lines"
fi
;;
+ "sqlite")
+ file -b "$path"
+ sqlite3 -readonly "$path" ".schema"
+ ;;
*)
file -b "$path"
;;
diff --git a/scripts/timer b/scripts/timer
new file mode 100755
index 0000000..886c310
--- /dev/null
+++ b/scripts/timer
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+NAME="$1"
+shift
+TIME="$@"
+
+[ -z "$TIME" ] && { TIME="$NAME"; NAME="Timer"; }
+
+if $(sleep "$TIME"); then
+ notify-send -a timer "$NAME" "Elapsed: $TIME\nTimer Ended: $(date +%T)"
+else
+ notify-send -a timer "Error" "Bad time string: $TIME"
+fi
diff --git a/scripts/vid-dl b/scripts/vid-dl
new file mode 100755
index 0000000..8459f49
--- /dev/null
+++ b/scripts/vid-dl
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+[ -z "$1" ] && { echo "Missing url, exitting" >&2; exit 1; }
+
+URL="$1"
+BASE_DIR="$HOME/vid/youtube"
+OUTPUT_TEMPLATE="%(uploader)s/%(title)s.%(ext)s"
+PLAYLIST="$HOME/vid/playlists/watch_later"
+
+[ -n "$2" ] && PLAYLIST="$2"
+[ -d "$PLAYLIST" ] || mkdir -p $(dirname "$PLAYLIST")
+
+FILE="$BASE_DIR/$(yt-dlp --restrict-filenames -O "$OUTPUT_TEMPLATE" "$URL")"
+
+yt-dlp --embed-subs --embed-metadata --sponsorblock-mark all \
+ --yes-playlist \
+ -P $BASE_DIR -o "$OUTPUT_TEMPLATE" --restrict-filenames \
+ --format bestvideo+bestaudio \
+ "$URL" && {
+ echo "$FILE" >> "$PLAYLIST"
+ echo "$FILE $URL" >> "$BASE_DIR/urls"
+ notify-send "Downloaded Vid" "$(basename "$FILE")"
+ }