Browse Source

Added first draft of script

This script is the very first initial draft and has not been tested very intensely.
master
hannes 10 years ago
committed by GitHub
parent
commit
b4e7cae5ca
  1. 53
      youtube-dl.sh

53
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
================================================================================"
Loading…
Cancel
Save