diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-03 18:54:14 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-03 18:54:14 +0200 |
commit | 3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb (patch) | |
tree | dc51ea1b9dc4429546c50dd54d232e81dd0538fd /skripti/earhorn_m3u.sh | |
parent | ds2teor (diff) | |
parent | razne stvari iz b (diff) | |
download | r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.gz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.bz2 r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.lz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.xz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.zst r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.zip |
Diffstat (limited to '')
-rwxr-xr-x | skripti/earhorn_m3u.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/skripti/earhorn_m3u.sh b/skripti/earhorn_m3u.sh new file mode 100755 index 0000000..e89a151 --- /dev/null +++ b/skripti/earhorn_m3u.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -eo pipefail +# $1 je prefix +# $2 je prejšnji file (za caching dolžin) +# $3=1 forsira cache kljub version failu +echo "#EXTM3U" +ver="#earhorn_m3u.sh različica 0" +echo $ver +cache=0 +if [ ! x$3 = x ] || [ ! x$2 = x ] && [ -f $2 ] +then + if [ x"`head -n2 $2 | tail -n1`" = x"$ver" ] + then + cache=1 + fi +fi +find 2* -type f | while read file +do + date=`cut -d/ -f1,2,3 <<<$file | sed s,/,-,g` + time=`cut -d/ -f4 <<<$file | cut -d. -f1` + h=${time:0:2} + m=${time:2:2} + s=${time:4:2} + dol="" + if [ $cache -eq 1 ] + then + grep -B2 ^$1$file$ $2 && continue + fi + dol=`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $file | cut -d. -f1` + echo "#EXTINF:$dol,Radijski arhiv" + echo "#EXT-X-PROGRAM-DATE-TIME:${date}T$h:$m:${s}Z" + echo $1$file +done |