Lots of small additions

This commit is contained in:
root
2018-11-02 23:59:32 +00:00
parent d3520d8ebb
commit ef02fecaa8
4 changed files with 264 additions and 3 deletions

31
scripts/stdin2m3u Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
echo "#EXT3MU"
function get_duration {
preconvert=$(youtube-dl --get-duration -- "$1" | perl -p -i -e 's/(\d\d?):(\d\d)/$1 minutes+$2 seconds/' 2> /dev/null)
convert=$(units "$preconvert")
stripped=$(echo "$convert" | grep -o '[0-9]*')
echo "$stripped"
}
function get_title {
result=$(youtube-dl --get-title -- "$1")
echo "$result"
}
function makeline {
duration=$(get_duration "$1")
title=$(get_title "$1")
echo "#EXTINF:$duration,$title"
}
videos=$(cat -)
videos=($videos)
for i in "${videos[@]}"; do
makeline "$i"
echo "ffmpeg2wav:youtube-dl:$i"
done