From dcf59d9a6c00007a7c0280660f0f42108c6d8197 Mon Sep 17 00:00:00 2001 From: Robin Steinberg Date: Fri, 5 Jun 2026 23:01:28 +0200 Subject: [PATCH] Add tdl script to automate tiddl --- README.md | 14 ++++++++++++++ tdl | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 tdl diff --git a/README.md b/README.md index ae159c0..45621bd 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/tdl b/tdl new file mode 100755 index 0000000..af1b150 --- /dev/null +++ b/tdl @@ -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"