#!/bin/sh dir=/path/to/ts/stored/dir chan="error" time="error" while read x y z; do case ${x} in GET) y=${y#*/} chan=${y%%/*} case ${chan} in 1[3-9]|[2-5][0-9]|6[0-2]) # chan is between 13 and 62. ;; *) chan="error" ;; esac y=${y#*/} time=${y%%/*} case ${time} in [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) # time is YYYYMMDDhhmm. ;; *) time="error" ;; esac ;; [A-Za-z]*:) ;; *) break ;; esac done echo "HTTP/1.1 200 OK" if [ "${chan}" != "error" -a -e "${dir}/${chan}.ts" ]; then echo "Content-Type: video/mpeg" echo exec tail -c 2097140 -F ${dir}/${chan}.ts else echo "Content-Type: text/html" echo echo "
TBD