From b4e7cae5ca7e34543d8ff1d905b3ef0e1366bd40 Mon Sep 17 00:00:00 2001 From: hannes Date: Mon, 8 May 2017 09:09:22 +0200 Subject: [PATCH] Added first draft of script This script is the very first initial draft and has not been tested very intensely. --- youtube-dl.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 youtube-dl.sh diff --git a/youtube-dl.sh b/youtube-dl.sh new file mode 100644 index 0000000..0eb41db --- /dev/null +++ b/youtube-dl.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +################################################################# +# This is a script to download music files from youtube # +# # +# Author: Hannes Bohnengel # +# Last modified: 24 July 2016 # +# CLI usage: ./youtube-dl.sh [URL] # +# Required PKGs: youtube-dl, libav-tools # +# # +################################################################# + +## +# -- Settings +## + +# First input argument (URL of youtube) +URL="$1" + +# Create name of output file (for details see youtube-dl --help) +FILENAME="%(title)s.%(ext)s" + +# Extract title of music-file (only to show in CLI) +TITLE=$(youtube-dl --get-title $URL) + +# Setup audio format +AUDIO="mp3" + +# Define command +MYCMD1="youtube-dl -x --audio-format $AUDIO -o ${FILENAME} ${URL}" + +## +# -- End of settings +## + +# Output +echo "================================================================================ + Downloading and transcoding music file from youtube + ---------------------------------------------------\n + URL: $URL + Title: $TITLE +================================================================================\n" + +# Execute command NR 1 +echo "$MYCMD1" + +$MYCMD1 + +echo "\n================================================================================ + Finished download +================================================================================" + +