summaryrefslogtreecommitdiffstats
path: root/skripti/365_prenesi_omejene_vsebine.sh
diff options
context:
space:
mode:
Diffstat (limited to 'skripti/365_prenesi_omejene_vsebine.sh')
-rwxr-xr-xskripti/365_prenesi_omejene_vsebine.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/skripti/365_prenesi_omejene_vsebine.sh b/skripti/365_prenesi_omejene_vsebine.sh
index f9a8c69..510b0c1 100755
--- a/skripti/365_prenesi_omejene_vsebine.sh
+++ b/skripti/365_prenesi_omejene_vsebine.sh
@@ -7,13 +7,24 @@
set -euo pipefail
page=`curl --fail-with-body https://365.rtvslo.si/oddaja/dnevnik/92` # outputa preveč shita za set -x
set -x
-for id in `find -type f -size 7931523c | sed -E 's/^.*\[([0-9]*)\].*$/\1/g'` # repair broken downloads (pravice potekle)
-do
- yt-dlp --no-continue http://365.rtvslo.si/arhiv/oddaja/$id
+find . -size -12M -type f -name '*.mp4' | while read file
+do # grep for specific audio codec ... if sample rate is 44100 and (tv broadcast is at 48000) and smaller than 12M, it's most likely the dummy/pravicepotekle video
+ samplerate=`ffprobe "$file" 2>&1 | grep 0x6134706D | grep -Eo '[0-9]+ Hz' | cut -d\ -f1`
+ id=`grep -Eo "\[[0-9]+\]\.mp" <<<"$file" | grep -o '[0-9]*'`
+ if [ $samplerate -eq 48000 ]
+ then
+ continue
+ fi
+ if [ $samplerate -eq 44100 ]
+ then
+ yt-dlp --no-continue http://365.rtvslo.si/arhiv/oddaja/$id # retry fu*ked up downloads
+ continue
+ fi
+ echo -e "Subject: unknown samplerate in 365.sh\n\nVideo file: $file\nsamplerate: $samplerate\n" | sendmail root
done
rm -f Error\ \[*\].mp4
dnevnik_id=`grep href=./arhiv/dnevnik <<<"$page" | cut -d\" -f2 | cut -d/ -f4 | head -n1`
-client_id=`grep client-id <<<"$page" | cut -d\" -f2 | head -n1`
+client_id=`grep 'client-id="' <<<"$page" | head -n1 | sed -E 's/^.*client-id="([^"]*)".*$/\1/'`
if [ ! -f zadnji ]
then
echo $dnevnik_id > zadnji