Add file test for m3u8 files to correct them in case youtube-dl was wrong. - an… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit ef2a8267309f40a3a475dd332006ce1987bf9077 | |
parent fc2e372e7b1c8849f9daa63c7ec6b4d36378932c | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sat, 23 Oct 2021 21:17:14 +0200 | |
Add file test for m3u8 files to correct them in case youtube-dl was wrong. | |
Diffstat: | |
M annna-add-hashtag | 18 ++++++++++++++++++ | |
M modules/hashtags/hashtags.txt | 1 - | |
2 files changed, 18 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/annna-add-hashtag b/annna-add-hashtag | |
@@ -62,6 +62,24 @@ processtag() { | |
cd "${memecachedir}" | |
tagfile="$(basename "$(find . -name "${stag}.*" | grep -v .orig)")" | |
+ | |
+ # In case youtube-dl mangled with the extension, rename to what file | |
+ # suggests us as ending. | |
+ case "${tagfile}" in | |
+ *.m3u8|*.M3U8) | |
+ realext="$(file --mime-type -b "${tagfile}" | cut -d'/' -f 2)" | |
+ if [ "${realext}" != "m3u8" ]; | |
+ then | |
+ newtagfile="$(printf "%s\n" "${tagfile}" \ | |
+ | tr '[:upper:]' '[:lower:]' \ | |
+ | sed "s,m3u8,${realext},")" | |
+ printf "Renaming %s to %s.\n" "${tagfile}" "${newtagfi… | |
+ mv "${tagfile}" "${newtagfile}" | |
+ tagfile="${newtagfile}" | |
+ fi | |
+ ;; | |
+ esac | |
+ | |
case "${tagfile}" in | |
*.MP4|*.mp4|*.MKV|*.mkv|*.webm|*.WEBM|*.mov|*.MOV) | |
printf "Making %s streamable by adding faststart.\n" "${tagfil… | |
diff --git a/modules/hashtags/hashtags.txt b/modules/hashtags/hashtags.txt | |
@@ -3052,7 +3052,6 @@ | |
#covid gopher://bitreich.org/I/memecache/covid.png | |
#cow gopher://bitreich.org/9/memecache/cow.mkv | |
#cow-drive-in gopher://bitreich.org/I/memecache/cow-drive-in.jpg | |
-#cow-job gopher://bitreich.org/9/memecache/cow-job.m3u8 | |
#cow-lick gopher://bitreich.org/I/memecache/cow-lick.jpg | |
#cow-tipping gopher://bitreich.org/I/memecache/cow-tipping.png | |
#cowabunga gopher://bitreich.org/I/memecache/cowabunga.png |