diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-02-19 10:00:47 -0500 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-02-19 10:01:37 -0500 |
| commit | b707a6ab4bd8b98809c22e892e33315bfb1684c4 (patch) | |
| tree | 044af2939c4a432ab37b90ceb9a00a8027ae3d28 | |
| parent | 996a1d0157193e32c6205469b42d6178f99f92c6 (diff) | |
Add minor script changes
| -rwxr-xr-x | scripts/http-echo | 1 | ||||
| -rwxr-xr-x | scripts/preview | 6 | ||||
| -rwxr-xr-x | scripts/timer | 13 | ||||
| -rwxr-xr-x | scripts/vid-dl | 23 |
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")" + } |
