summaryrefslogtreecommitdiff
path: root/dot/local/bin/m3u8
blob: f4a4e9b4681a02653ec49cb07ac746d097612b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# TODO: Hit URL. Check if received content is m3u8. If not, try `youtube-dl -g`

for INPUT
do
  case "$INPUT" in
       http://*|https://*)
           OUTPUT=${INPUT##*/}.mkv ;;
       *)
           echo "Skipping unrecognized input: $INPUT" >&2
           continue ;;
  esac

  # ffmpeg will prompt the user if "$OUTPUT" exists
  if [ "$IGNORE_EXISTING" -a -e "$OUTPUT" ]
  then
      continue
  else
      ffmpeg -hide_banner -v info -i "$INPUT" -c:v copy -c:a copy "$OUTPUT"
  fi
done