Skip to content

Commit

Permalink
Feat: check streams withs errors daily
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jul 21, 2024
1 parent ee48581 commit 2b5ff21
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: checkStreams

# Controls when the workflow will run
on:
#run it daily
#run it each wednesday
schedule:
- cron: "6 1 * * 3"

Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/checkStreamsError.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow checks the streams with ffprobe

name: checkStreams

# Controls when the workflow will run
on:
#run it daily but wedenesday
schedule:
- cron: "6 1 * * 0,1,2,4,5,6"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
check:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install prerequisites
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Check all streams
run: ./build.sh check_stream_error_json

- name: Add, commit and push
uses: EndBug/add-and-commit@v9.1.4
with:
add: docs/db
message: Update webradio status file
push: true
25 changes: 20 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,13 @@ check_stream() {

# Checks all streams and writes the status json file
check_stream_all_json() {
printf "Checking all streams"
local CHECK_ALL=$1
if [ "$CHECK_ALL" -eq 1 ]
then
echo "Checking all streams"
else
echo "Checking streams with errors"
fi
local rc=0
exec 3<> "${STATUSFILE}.tmp"
printf "{" >&3
Expand All @@ -1281,6 +1287,13 @@ check_stream_all_json() {
fi
local STREAM
STREAM=$(grep -v "#" "$F" | head -1)
local ERROR_COUNT
ERROR_COUNT=$(jq ".\"$M3U\".count" docs/db/index/status.min.json)
[ "$ERROR_COUNT" = "null" ] && ERROR_COUNT=0
if [ "$CHECK_ALL" -eq 0 ] && [ "$ERROR_COUNT" -eq 0 ]
then
continue
fi
local RETRY_COUNT=0
while :
do
Expand All @@ -1293,9 +1306,6 @@ check_stream_all_json() {
OUT=$(jq -n --arg value "$OUT" '$value')
local DATE
DATE=$(date +%Y-%m-%d)
local ERROR_COUNT
ERROR_COUNT=$(jq ".\"$M3U\".count" docs/db/index/status.min.json)
[ "$ERROR_COUNT" = "null" ] && ERROR_COUNT=0
ERROR_COUNT=$((ERROR_COUNT+1))
printf "\"%s\":{\"date\":\"%s\",\"count\":%s,\"error\":%s}" "$M3U" "$DATE" "$ERROR_COUNT" "$OUT" >&3
echo ""
Expand Down Expand Up @@ -1350,7 +1360,10 @@ case "$ACTION" in
exit $?
;;
check_stream_all_json)
check_stream_all_json
check_stream_all_json 1
;;
check_stream_error_json)
check_stream_all_json 0
;;
normalize_fields)
normalize_fields "$2"
Expand Down Expand Up @@ -1413,6 +1426,8 @@ case "$ACTION" in
echo " checks the stream from m3u"
echo " check_stream_all_json:"
echo " creates the status.json file"
echo " check_stream_error_json:"
echo " re-checks the streams with errors form status.json file"
echo " normalize_fields <dir>:"
echo " normalizes fields"
echo " create:"
Expand Down
2 changes: 1 addition & 1 deletion docs/db/index/status.min.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"http___livestreams_radioton_de_http_rt-live-bw_m3u.m3u.AAC.64":{"date":"2024-07-17","count":18,"error":"http://livestreams.radioton.de/http/rt-live-mobile-bw.m3u: Invalid data found when processing input"},"http___yumicoradio_net_8000_stream.m3u":{"date":"2024-07-17","count":5,"error":"[tcp @ 0x5598e0c86b80] Connection to tcp://yumicoradio.net:8000 failed: Connection timed out\nhttp://yumicoradio.net:8000/stream: Connection timed out"},"https___18003_live_streamtheworld_com_RT_SPAAC_aac.m3u":{"date":"2024-07-17","count":7,"error":"https://18003.live.streamtheworld.com/RT_SPAAC.aac: Server returned 403 Forbidden (access denied)"},"https___22653_live_streamtheworld_com_TOPZEN_mp3.m3u":{"date":"2024-07-17","count":9,"error":"https://22653.live.streamtheworld.com/TOPZEN.mp3: Server returned 403 Forbidden (access denied)"},"https___akashvani_gov_in_radio_live_php_channel_5.m3u":{"date":"2024-07-17","count":6,"error":"https://akashvani.gov.in/radio/live.php?channel=5: Invalid data found when processing input"},"https___chokostream_com_8010_live.m3u":{"date":"2024-07-17","count":5,"error":"[tcp @ 0x55e336dba200] Failed to resolve hostname chokostream.com: Temporary failure in name resolution\nhttps://chokostream.com:8010/live: Input/output error"},"https___chokostream_com_8050_live.m3u":{"date":"2024-07-17","count":5,"error":"[tcp @ 0x55599e96b200] Failed to resolve hostname chokostream.com: Temporary failure in name resolution\nhttps://chokostream.com:8050/live: Input/output error"},"https___chokostream_com_8070_live.m3u":{"date":"2024-07-17","count":5,"error":"[tcp @ 0x559e0de99200] Failed to resolve hostname chokostream.com: Temporary failure in name resolution\nhttps://chokostream.com:8070/live: Input/output error"},"https___emisoras_dip-badajoz_es_58062_stream.m3u":{"date":"2024-07-17","count":8,"error":"[tls @ 0x56436557cbc0] A TLS fatal alert has been received.\nhttps://emisoras.dip-badajoz.es:58062/stream: Input/output error"},"https___ledjamradio_ice_infomaniak_ch_ledjamradio_mp3.m3u":{"date":"2024-07-17","count":9,"error":"https://ledjamradio.ice.infomaniak.ch/ledjamradio.mp3: Server returned 5XX Server Error reply"},"https___myradio24_org_radiometal.m3u":{"date":"2024-07-17","count":9,"error":"https://myradio24.org/radiometal: Server returned 404 Not Found"},"https___server1_fex_red_8366_stream.m3u":{"date":"2024-07-17","count":1,"error":"https://server1.fex.red:8366/stream: Server returned 401 Unauthorized (authorization failed)"},"https___www_ragya_com_prahar.m3u":{"date":"2024-07-17","count":6,"error":"https://www.ragya.com/prahar: Invalid data found when processing input"}}
{"http___livestreams_radioton_de_http_rt-live-bw_m3u.m3u.AAC.64":{"date":"2024-07-21","count":19,"error":"http://livestreams.radioton.de/http/rt-live-mobile-bw.m3u: Invalid data found when processing input"},"https___18003_live_streamtheworld_com_RT_SPAAC_aac.m3u":{"date":"2024-07-21","count":8,"error":"https://18003.live.streamtheworld.com/RT_SPAAC.aac: Server returned 403 Forbidden (access denied)"},"https___akashvani_gov_in_radio_live_php_channel_5.m3u":{"date":"2024-07-21","count":7,"error":"https://akashvani.gov.in/radio/live.php?channel=5: Invalid data found when processing input"},"https___chokostream_com_8010_live.m3u":{"date":"2024-07-21","count":6,"error":"[tcp @ 0x555e0e659dc0] Failed to resolve hostname chokostream.com: Temporary failure in name resolution\nhttps://chokostream.com:8010/live: Input/output error"},"https___chokostream_com_8050_live.m3u":{"date":"2024-07-21","count":6,"error":"[tcp @ 0x5d300902adc0] Failed to resolve hostname chokostream.com: Temporary failure in name resolution\nhttps://chokostream.com:8050/live: Input/output error"},"https___chokostream_com_8070_live.m3u":{"date":"2024-07-21","count":6,"error":"[tcp @ 0x5e3e0991bdc0] Failed to resolve hostname chokostream.com: Temporary failure in name resolution\nhttps://chokostream.com:8070/live: Input/output error"},"https___www_ragya_com_prahar.m3u":{"date":"2024-07-21","count":7,"error":"https://www.ragya.com/prahar: Invalid data found when processing input"}}
Binary file modified docs/db/index/status.min.json.gz
Binary file not shown.

0 comments on commit 2b5ff21

Please sign in to comment.