Add tdl script to automate tiddl
This commit is contained in:
@@ -24,6 +24,20 @@ Arguments:
|
||||
output_directory Directory where the resulting MP3 will be saved.
|
||||
```
|
||||
|
||||
### tdl
|
||||
Automates downloading a list of URLs from a text file using tiddl.
|
||||
|
||||
```text
|
||||
Usage: ./tdl [FILE]
|
||||
|
||||
Arguments:
|
||||
FILE Path to a text file containing one URL per line.
|
||||
|
||||
Options:
|
||||
--help Display this help message and exit.
|
||||
```
|
||||
|
||||
## Requirements
|
||||
- ffmpeg (with libmp3lame support)
|
||||
- bash
|
||||
- [tiddl](https://github.com/oskvr37/tiddl) (for tdl script)
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user