Compare commits
2 Commits
298d52e71c
...
54948644e8
| Author | SHA1 | Date | |
|---|---|---|---|
| 54948644e8 | |||
| dcf59d9a6c |
@@ -24,6 +24,21 @@ Arguments:
|
|||||||
output_directory Directory where the resulting MP3 will be saved.
|
output_directory Directory where the resulting MP3 will be saved.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### tdl
|
||||||
|
Download URLs using tiddl, either individually or from a list file.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Usage: ./tdl [URL] | -f [FILE]
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
URL A single URL to download.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-f, --file FILE Path to a text file containing one URL per line.
|
||||||
|
--help Display this help message and exit.
|
||||||
|
```
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
- ffmpeg (with libmp3lame support)
|
- ffmpeg (with libmp3lame support)
|
||||||
- bash
|
- bash
|
||||||
|
- [tiddl](https://github.com/oskvr37/tiddl) (for tdl script)
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
show_help() {
|
||||||
|
echo "Usage: tdl [URL] | -f [FILE]"
|
||||||
|
echo "Download URLs using tiddl."
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " URL A single URL to download."
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -f, --file FILE Path to a text file containing one URL per line."
|
||||||
|
echo " --help Display this help message and exit."
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]] || [[ "$1" == "--help" ]]; then
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "-f" || "$1" == "--file" ]]; then
|
||||||
|
if [[ -z "$2" ]]; then
|
||||||
|
echo "Error: File path required for $1."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
INPUT_FILE="$2"
|
||||||
|
if [[ ! -f "$INPUT_FILE" ]]; then
|
||||||
|
echo "Error: File '$INPUT_FILE' not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r url || [[ -n "$url" ]]; do
|
||||||
|
[[ -z "$url" || "$url" =~ ^[[:space:]]*# ]] && continue
|
||||||
|
url=$(echo "$url" | xargs)
|
||||||
|
tiddl download url "$url"
|
||||||
|
done < "$INPUT_FILE"
|
||||||
|
else
|
||||||
|
tiddl download url "$1"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user