bitreich-tv

meme tv encoding and streaming
git clone git://src.adamsgaard.dk/bitreich-tv
Log | Files | Refs Back to index

brtv-generate-playlist.sh (814B)


      1 #!/bin/sh
      2 # supply hashtags.txt as stdin
      3 # output is a randomized plaintext playlist with urls to memes and respective
      4 # titles.
      5 
      6 
      7 ### CONFIGURATION START
      8 
      9 # other host to serve titles and images converted to videos
     10 title_image_host="gopher://adamsgaard.dk"
     11 title_dir="title"
     12 img2vid_dir="img2vid"
     13 video_ext="webm"
     14 
     15 ### CONFIGURATION END
     16 
     17 
     18 regeximatch() {
     19 	printf '%s' "$1" | grep -iEq "$2"
     20 }
     21 
     22 sort -R | while read -r tag url; do
     23 	printf '%s/9/%s/%s\n' "$title_image_host" "$title_dir" "${tag#\#}.${video_ext}"
     24 		
     25 	if regeximatch "$url" '\.(mkv|webm|mp4)$'; then
     26 		printf '%s\n' "$url"
     27 	elif regeximatch "$url" '\.(jpg|jpeg|png)$'; then
     28 		printf '%s/9/%s/%s\n' "$title_image_host" "$img2vid_dir" "${tag#\#}.${video_ext}"
     29 	else
     30 		# skip mpv-incompatible formats that are not converted to videos
     31 		continue
     32 	fi
     33 done