Add script to generate randomized playlists with titles and img->video - bitreich-tv - Meme TV encoding and streaming
(HTM) git clone git://bitreich.org/bitreich-tv git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-tv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) LICENSE
---
(DIR) commit 4dbed1990ed587289774455d962949f76cd01b45
(DIR) parent 469296142ed571c3e38749a234a9eb31205645ac
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
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(-)
---
(DIR) diff --git a/brtv-generate-playlist.sh b/brtv-generate-playlist.sh
@@ -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#\#}.${video_ext}"
+
+ 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" "${tag#\#}.${video_ext}"
+ else
+ # skip mpv-incompatible formats that are not converted to videos
+ continue
+ fi
+done