tAdd script to generate randomized playlists with titles and img->video - bitre… | |
git clone git://src.adamsgaard.dk/bitreich-tv | |
Log | |
Files | |
Refs | |
--- | |
commit 4dbed1990ed587289774455d962949f76cd01b45 | |
parent 469296142ed571c3e38749a234a9eb31205645ac | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sun, 16 Aug 2020 22:12:42 +0200 | |
Add script to generate randomized playlists with titles and img->video | |
Diffstat: | |
A brtv-generate-playlist.sh | 33 +++++++++++++++++++++++++++++… | |
1 file changed, 33 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/brtv-generate-playlist.sh b/brtv-generate-playlist.sh | |
t@@ -0,0 +1,33 @@ | |
+#!/bin/sh | |
+# supply hashtags.txt as stdin | |
+# output is a randomized plaintext playlist with urls to memes and respective | |
+# titles. | |
+ | |
+ | |
+### CONFIGURATION START | |
+ | |
+# other host to serve titles and images converted to videos | |
+title_image_host="gopher://adamsgaard.dk" | |
+title_dir="title" | |
+img2vid_dir="img2vid" | |
+video_ext="webm" | |
+ | |
+### CONFIGURATION END | |
+ | |
+ | |
+regeximatch() { | |
+ printf '%s' "$1" | grep -iEq "$2" | |
+} | |
+ | |
+sort -R | while read -r tag url; do | |
+ printf '%s/9/%s/%s\n' "$title_image_host" "$title_dir" "${tag#\#}.${vi… | |
+ | |
+ if regeximatch "$url" '\.(mkv|webm|mp4)$'; then | |
+ printf '%s\n' "$url" | |
+ elif regeximatch "$url" '\.(jpg|jpeg|png)$'; then | |
+ printf '%s/9/%s/%s\n' "$title_image_host" "$img2vid_dir" "${ta… | |
+ else | |
+ # skip mpv-incompatible formats that are not converted to vide… | |
+ continue | |
+ fi | |
+done |