Files
IPTV/.github/workflows/check_channels_deep.yml
T
Kálmán „KAMI” Szalai 13359f9ed0 Surface recovered Invalid channels on the dashboard, wire --include-invalid into the deep check
Follow-up to the previous commit on this branch: that one added
--invalid/--include-invalid to check_channels.py but deliberately left
them unwired, because generate_dashboard.py's "most recent row per
(list, channel)" view assumed every row was a working channel -
turning --include-invalid on in a workflow would have bloated the
"needs attention" table with hundreds of already-known-dead Invalid
rows, while hiding the one thing that's actually interesting: an
Invalid channel that's alive again wouldn't show up there at all,
since that table only lists rows that are *not* alive.

- generate_dashboard.py: every existing count (cards, trend, by-list,
  "needs attention") is now built from `>` (working) rows only, via a
  `marker_of()` helper that treats history written before this field
  existed as `>` too, since only working channels were ever checked
  back then - so this is a no-op for every dashboard that hasn't
  started using --include-invalid yet.
- New "Flagged Invalid, answering again" section lists `x` rows whose
  latest check came back alive/flaky - the dashboard's equivalent of
  check_channels.py's own `RECOVERED?` line - with a note that this is
  a shortlist for a human, not something to auto-restore.
- check_channels_deep.yml now runs with --include-invalid, and its
  step-summary blurb mentions the new section.

Tested: wrote a small synthetic history.jsonl mixing a marker-less
legacy row, `>` rows, and `x` rows (one alive, one dead) and confirmed
the channel count/cards only reflect the `>` rows, the alive `x` row
shows up under "Flagged Invalid, answering again", the dead `x` row
shows up nowhere (expected - it's just confirming the status quo), and
an all-`>` history renders the new section's "none right now" empty
state. Also ran it against this repo's real 77MB
.github/checker-history/history.jsonl (all pre-dates this change, so
no `x` rows in it) - renders in ~1.5s, unchanged output. pylint:
10.00/10 on both files.
2026-10-23 09:20:28 +02:00

92 lines
3.4 KiB
YAML

name: Channel check (deep)
on:
schedule:
- cron: '0 6 */2 * *' # every 2 days at 06:00 UTC
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
check-deep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install ffmpeg (for the ffprobe second opinion on dead channels)
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Run the deep check (HTTP probes + ffprobe confirmation on dead channels)
run: |
python3 check_channels.py --attempts 3 --timeout 12 --pause 5 --workers 40 --confirm-dead --include-invalid --json run.jsonl | tee check_summary.txt
- name: Append to history and prune entries older than 90 days
run: |
mkdir -p .github/checker-history
history=".github/checker-history/history.jsonl"
touch "$history"
cat run.jsonl >> "$history"
cutoff=$(date -u -d '90 days ago' +%Y-%m-%dT%H:%M:%SZ)
python3 - "$history" "$cutoff" <<'PYEOF'
import json, sys
path, cutoff = sys.argv[1], sys.argv[2]
kept = []
with open(path, encoding="utf-8") as f:
for line in f:
line = line.strip()
if line and json.loads(line)["checked_at"] >= cutoff:
kept.append(line)
with open(path, "w", encoding="utf-8") as f:
f.write("\n".join(kept) + ("\n" if kept else ""))
PYEOF
- name: Commit history
run: |
git config user.name "ChannelCheckerBot" || true
git config user.email "[email protected]" || true
git add .github/checker-history/history.jsonl
git diff --staged --quiet || git commit --quiet -m "Channel check (deep) - $(date -u +%Y-%m-%dT%H:%M:%SZ)"
git pull --rebase origin master || true
git diff --quiet HEAD @{u} || git push origin HEAD
- name: Build the status dashboard
run: python3 generate_dashboard.py --history .github/checker-history/history.jsonl --out docs/index.html
- name: Upload dashboard for Pages
uses: actions/upload-pages-artifact@v3
with:
path: docs
- name: Summarize
if: always()
run: |
{
echo "## Deep channel check - $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo ""
echo "Channels that looked \`dead\` over HTTP were given a second opinion by \`ffprobe\`. A channel still reported \`dead\` here survived both checks and is safe to act on; one reported \`disputed\` looked dead over HTTP but ffprobe found a real stream behind it - needs a human look, not an automatic edit. This run also re-checks every channel already flagged Invalid (\`--include-invalid\`) - one reported \`RECOVERED?\` answered like a live stream again and shows up on the dashboard's own 'Flagged Invalid, answering again' section, also pending a human look before anyone restores it."
echo ""
echo '```'
cat check_summary.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
deploy-pages:
needs: check-deep
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4