summaryrefslogtreecommitdiffstats
path: root/skripti/earhorn_m3u.sh
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-06-01 23:00:49 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-06-01 23:00:49 +0200
commit178253be0ada30420f39720e7e0fa4ee4058bce0 (patch)
treedb6d574d5945c468fccb0d39250762c41b53c7f0 /skripti/earhorn_m3u.sh
parentearhorn_m3u (diff)
downloadr-178253be0ada30420f39720e7e0fa4ee4058bce0.tar
r-178253be0ada30420f39720e7e0fa4ee4058bce0.tar.gz
r-178253be0ada30420f39720e7e0fa4ee4058bce0.tar.bz2
r-178253be0ada30420f39720e7e0fa4ee4058bce0.tar.lz
r-178253be0ada30420f39720e7e0fa4ee4058bce0.tar.xz
r-178253be0ada30420f39720e7e0fa4ee4058bce0.tar.zst
r-178253be0ada30420f39720e7e0fa4ee4058bce0.zip
Diffstat (limited to '')
-rwxr-xr-xskripti/earhorn_m3u.sh23
1 files changed, 21 insertions, 2 deletions
diff --git a/skripti/earhorn_m3u.sh b/skripti/earhorn_m3u.sh
index 51f33c7..e89a151 100755
--- a/skripti/earhorn_m3u.sh
+++ b/skripti/earhorn_m3u.sh
@@ -1,6 +1,19 @@
#!/bin/bash
-set -xeo pipefail
+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`
@@ -8,7 +21,13 @@ do
h=${time:0:2}
m=${time:2:2}
s=${time:4:2}
- echo "#EXTINF:`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $file | cut -d. -f1`,Radijski arhiv"
+ 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