Add tdl script to automate tiddl

This commit is contained in:
2026-06-05 23:01:28 +02:00
parent 298d52e71c
commit dcf59d9a6c
2 changed files with 46 additions and 0 deletions
Executable
+32
View File
@@ -0,0 +1,32 @@
`#!/bin/bash
show_help() {
echo "Usage: tdl [FILE]"
echo "Download a list of URLs from a file using tiddl."
echo ""
echo "Arguments:"
echo " FILE Path to a text file containing one URL per line."
echo ""
echo "Options:"
echo " --help Display this help message and exit."
}
if [[ $# -eq 0 ]] || [[ "$1" == "--help" ]]; then
show_help
exit 0
fi
INPUT_FILE="$1"
if [[ ! -f "$INPUT_FILE" ]]; then
echo "Error: File '$INPUT_FILE' not found."
exit 1
fi
while IFS= read -r url || [[ -n "$url" ]]; do
# Skip empty lines and comments
[[ -z "$url" || "$url" =~ ^[[:space:]]*# ]] && continue
# Trim whitespace
url=$(echo "$url" | xargs)
tiddl download url "$url"
done < "$INPUT_FILE"