Просмотр исходного кода

Merge branch 'master' of github.com:profplump/UberZach-Video

Zachary Kotlarek 9 лет назад
Родитель
Сommit
aa5f68dde2
2 измененных файлов с 9 добавлено и 3 удалено
  1. 6 0
      m3u8-fetch.sh
  2. 3 3
      m3u8-uri.sh

+ 6 - 0
m3u8-fetch.sh

@@ -7,4 +7,10 @@ if [ -z "${URI}" ] || [ -z "${FILE}" ] || [ -e "${FILE}" ]; then
 	exit 1
 fi
 
+# Parse the playlist if needed
+if ! echo "${URI}" | grep -q -i '\.m3u8$'; then
+	URI="`~/bin/video/m3u8-uri.sh "${URI}"`"
+fi
+
+# Fetch
 ffmpeg -i "${URI}" -bsf:a aac_adtstoasc -vcodec copy -c copy "${FILE}"

+ 3 - 3
m3u8-uri.sh

@@ -3,13 +3,13 @@
 # Command-line parameters
 URI="${1}"
 if [ -z "${URI}" ]; then
-	wcho "Usage: ${0} uri" 1>&2
+	echo "Usage: ${0} uri" 1>&2
 	exit 1
 fi
 
 # Fetch the M3U8
 M3U8="`mktemp -t 'M3U8'`"
-curl -o "${M3U8}" "${URI}"
+curl -4 -s -o "${M3U8}" "${URI}"
 PREFIX="`echo "${URI}" | sed 's%^\(.*\)\/.*$%\1%'`"
 
 # Find the highest-resolution/highest-bandwidth stream
@@ -25,4 +25,4 @@ echo "${PREFIX}/${URI}"
 
 # Cleanup
 rm -f "${M3U8}"
-exit 0
+exit 0