Here is a brief description of what the Bash command I provided does:
- It sets the variable $season to the season number.
- It sets the variable $index to the current video index.
- It uses a while loop to read each line of the file batch-url.txt and extract the URL from each line using awk.
- If the line is not empty and does not start with a # character (i.e. if it is not a comment), it passes the URL to the yt-dlp command with the filename prefix "S" followed by the season number (contained in the $season variable), followed by "E" and the index of the current line, with a leading zero added if the index is less than 10 (e.g. "01" instead of "1").
This command allows you to download multiple videos from an input batch file by adding the season number and index of each video to the filename prefix.
Note: this command will only work if the yt-dlp command is installed on your system. If it is not, you will need to replace it with the command you wish to use to download the videos.
Additionally, this command assumes that each line of the input batch file contains only one URL. If you need to handle empty lines or comments (starting with #), you should add a condition to ignore them in the while loop.
season=01
index=1
while read line; do
url=$(echo "$line" | awk '{print $1}')
yt-dlp --output "S$(printf "%02d" $season)E$(printf "%02d" $index) %(title)s.%(ext)s" "$url"
((index++))
done < batch-url.txt
season=1; index=1; while read line; do url=$(echo "$line" | awk '{print $1}'); [ -n "$url" ] && [ "${url:0:1}" != "#" ] && yt-dlp --output "S$(printf "%02d" $season)E$(printf "%02d" $index) %(title)s.%(ext)s" "$url"; ((index++)); done < batch-url.txt
yt-dlp --embed-subs --sub-langs all --convert-subs srt --ppa "EmbedSubtitle:-disposition:s:0 0" --merge mkv URL
season=1; index=1; while read line; do url=$(echo "$line" | awk '{print $1}'); [ -n "$url" ] && [ "${url:0:1}" != "#" ] && yt-dlp --embed-subs --sub-langs all --convert-subs srt --ppa "EmbedSubtitle:-disposition:s:0 0" --merge mkv --output "S$(printf "%02d" $season)E$(printf "%02d" $index) %(title)s.%(ext)s" "$url"; ((index++)); done < batch-url.txt