Update .forgejo/workflows/generate-m3u.yml
Some checks are pending
Enhanced IPTV Playlist with Discovery / enhance-and-discover (push) Waiting to run
Some checks are pending
Enhanced IPTV Playlist with Discovery / enhance-and-discover (push) Waiting to run
This commit is contained in:
parent
3a503ff2e3
commit
a159864ffe
1 changed files with 27 additions and 159 deletions
|
@ -5,9 +5,6 @@ on:
|
|||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# Run discovery daily at 6 AM UTC
|
||||
- cron: '0 6 * * *'
|
||||
|
||||
jobs:
|
||||
enhance-and-discover:
|
||||
|
@ -24,7 +21,7 @@ jobs:
|
|||
- name: Install Discovery Dependencies
|
||||
run: |
|
||||
echo "Installing discovery dependencies..."
|
||||
pip install requests beautifulsoup4
|
||||
pip install requests
|
||||
echo "Dependencies installed"
|
||||
|
||||
- name: Configure Git
|
||||
|
@ -48,28 +45,6 @@ jobs:
|
|||
echo "Discovery script not found, skipping discovery"
|
||||
fi
|
||||
|
||||
- name: Enable Stream Health Checking (Optional)
|
||||
run: |
|
||||
echo "Checking health check configuration..."
|
||||
if [ -f config/settings.json ]; then
|
||||
# Check if health checking should be enabled
|
||||
HEALTH_ENABLED=$(python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('config/settings.json', 'r') as f:
|
||||
settings = json.load(f)
|
||||
print(settings.get('enable_health_check', False))
|
||||
except:
|
||||
print(False)
|
||||
" 2>/dev/null || echo "False")
|
||||
|
||||
if [ "$HEALTH_ENABLED" = "True" ]; then
|
||||
echo "Health checking is enabled"
|
||||
else
|
||||
echo "Health checking is disabled (recommended for faster processing)"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Check Import File
|
||||
run: |
|
||||
echo "Checking import file..."
|
||||
|
@ -95,79 +70,30 @@ except:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
- name: Generate Enhanced Reports
|
||||
- name: Create Simple Report
|
||||
run: |
|
||||
echo "Generating enhanced reports..."
|
||||
|
||||
echo "Creating report..."
|
||||
if [ -f playlist.m3u ]; then
|
||||
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||
echo "Generated playlist: $CHANNELS channels"
|
||||
echo "Found $CHANNELS channels in playlist"
|
||||
|
||||
# Count countries and categories from existing system
|
||||
COUNTRIES=$(grep 'group-title=' playlist.m3u | sed 's/.*group-title="//; s/".*//' | sort -u | wc -l || echo "0")
|
||||
|
||||
# Create enhanced summary report
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
ENHANCED_REPORT="reports/daily/enhanced_report_$DATE.md"
|
||||
REPORT="reports/daily/report_$DATE.md"
|
||||
|
||||
# Check for discovery report
|
||||
DISCOVERY_REPORT=""
|
||||
echo "# Enhanced IPTV Report" > "$REPORT"
|
||||
echo "Generated: $(date)" >> "$REPORT"
|
||||
echo "Channels: $CHANNELS" >> "$REPORT"
|
||||
|
||||
# Check if discovery ran
|
||||
if ls reports/daily/discovery_report_*.md 1> /dev/null 2>&1; then
|
||||
DISCOVERY_REPORT=$(ls -t reports/daily/discovery_report_*.md | head -1)
|
||||
DISCOVERED_COUNT=$(grep "Total Channels Discovered:" "$DISCOVERY_REPORT" | grep -o '[0-9]*' || echo "0")
|
||||
else
|
||||
DISCOVERED_COUNT="0"
|
||||
LATEST_DISCOVERY=$(ls -t reports/daily/discovery_report_*.md | head -1)
|
||||
DISCOVERED_COUNT=$(grep "Total Channels Discovered:" "$LATEST_DISCOVERY" | grep -o '[0-9]*' || echo "0")
|
||||
echo "Discovered this session: $DISCOVERED_COUNT" >> "$REPORT"
|
||||
fi
|
||||
|
||||
cat > "$ENHANCED_REPORT" << EOF
|
||||
# Enhanced IPTV System Report
|
||||
**Generated:** $(date)
|
||||
|
||||
## System Overview
|
||||
- **Total Channels:** $CHANNELS
|
||||
- **Countries/Groups:** $COUNTRIES
|
||||
- **Discovery Session:** $DISCOVERED_COUNT new channels found
|
||||
- **System Status:** ✅ Fully Operational
|
||||
|
||||
## Features Active
|
||||
- ✅ **Automated Discovery** - Finding channels from multiple sources
|
||||
- ✅ **Smart Categorization** - Country-based grouping with pattern matching
|
||||
- ✅ **Duplicate Detection** - Signature-based deduplication
|
||||
- ✅ **Quality Detection** - 4K/FHD/HD/SD identification
|
||||
- ✅ **Content Filtering** - Adult content filtering available
|
||||
- 🔄 **Health Checking** - Available but disabled for performance
|
||||
|
||||
## Recent Activity
|
||||
EOF
|
||||
|
||||
if [ "$DISCOVERED_COUNT" -gt "0" ]; then
|
||||
echo "- 🔍 **Discovery:** $DISCOVERED_COUNT new channels discovered and processed" >> "$ENHANCED_REPORT"
|
||||
echo "Report created: $REPORT"
|
||||
else
|
||||
echo "- 🔍 **Discovery:** No new channels found this session" >> "$ENHANCED_REPORT"
|
||||
fi
|
||||
|
||||
echo "- 📺 **Processing:** Generated playlist with $CHANNELS total channels" >> "$ENHANCED_REPORT"
|
||||
echo "- 🌍 **Organization:** Channels organized into $COUNTRIES country groups" >> "$ENHANCED_REPORT"
|
||||
|
||||
cat >> "$ENHANCED_REPORT" << EOF
|
||||
|
||||
## Next Enhancement Phases
|
||||
- [ ] **Phase 2:** Genre-based sub-categorization (News, Sports, Movies, etc.)
|
||||
- [ ] **Phase 3:** Stream health validation and backup URL rotation
|
||||
- [ ] **Phase 4:** AI-powered channel metadata enhancement
|
||||
|
||||
## Quick Access
|
||||
- 📺 [Download Playlist](../playlist.m3u)
|
||||
- 📋 [View Channels](../channels.txt)
|
||||
- 🔍 [Discovery Config](../config/discovery_sources.json)
|
||||
|
||||
---
|
||||
*Enhanced IPTV System with Automated Discovery*
|
||||
EOF
|
||||
|
||||
echo "Enhanced report created: $ENHANCED_REPORT"
|
||||
else
|
||||
echo "No playlist generated"
|
||||
echo "No playlist found"
|
||||
fi
|
||||
|
||||
- name: Clean Old Reports
|
||||
|
@ -177,9 +103,9 @@ EOF
|
|||
if ls *.md >/dev/null 2>&1; then
|
||||
COUNT=$(ls *.md | wc -l)
|
||||
echo "Found $COUNT reports"
|
||||
if [ "$COUNT" -gt 5 ]; then
|
||||
echo "Keeping 5 most recent reports..."
|
||||
ls -t *.md | tail -n +6 | xargs rm -f
|
||||
if [ "$COUNT" -gt 3 ]; then
|
||||
echo "Removing excess reports..."
|
||||
ls -t *.md | tail -n +4 | xargs rm -f
|
||||
echo "Cleanup done"
|
||||
fi
|
||||
else
|
||||
|
@ -193,56 +119,19 @@ EOF
|
|||
echo '#EXTM3U' > bulk_import.m3u
|
||||
echo "Import file reset"
|
||||
|
||||
- name: Update Discovery Statistics
|
||||
run: |
|
||||
echo "Updating discovery statistics..."
|
||||
|
||||
# Create or update discovery stats
|
||||
if [ ! -f config/discovery_stats.json ]; then
|
||||
echo '{"total_sessions": 0, "total_discovered": 0, "last_discovery": ""}' > config/discovery_stats.json
|
||||
fi
|
||||
|
||||
# Update stats if discovery report exists
|
||||
if ls reports/daily/discovery_report_*.md 1> /dev/null 2>&1; then
|
||||
LATEST_DISCOVERY=$(ls -t reports/daily/discovery_report_*.md | head -1)
|
||||
DISCOVERED_COUNT=$(grep "Total Channels Discovered:" "$LATEST_DISCOVERY" | grep -o '[0-9]*' || echo "0")
|
||||
|
||||
python3 -c "
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
with open('config/discovery_stats.json', 'r') as f:
|
||||
stats = json.load(f)
|
||||
except:
|
||||
stats = {'total_sessions': 0, 'total_discovered': 0, 'last_discovery': ''}
|
||||
|
||||
stats['total_sessions'] += 1
|
||||
stats['total_discovered'] += $DISCOVERED_COUNT
|
||||
stats['last_discovery'] = datetime.now().isoformat()
|
||||
|
||||
with open('config/discovery_stats.json', 'w') as f:
|
||||
json.dump(stats, f, indent=2)
|
||||
|
||||
print(f'Updated stats: {stats[\"total_sessions\"]} sessions, {stats[\"total_discovered\"]} total discovered')
|
||||
"
|
||||
fi
|
||||
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
echo "Committing enhanced changes..."
|
||||
echo "Committing changes..."
|
||||
git add .
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
CHANNELS="0"
|
||||
COUNTRIES="0"
|
||||
if [ -f playlist.m3u ]; then
|
||||
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||
COUNTRIES=$(grep 'group-title=' playlist.m3u | sed 's/.*group-title="//; s/".*//' | sort -u | wc -l || echo "0")
|
||||
fi
|
||||
|
||||
# Check if discovery was active
|
||||
# Check for discovery
|
||||
DISCOVERY_NOTE=""
|
||||
if ls reports/daily/discovery_report_*.md 1> /dev/null 2>&1; then
|
||||
LATEST_DISCOVERY=$(ls -t reports/daily/discovery_report_*.md | head -1)
|
||||
|
@ -252,38 +141,17 @@ print(f'Updated stats: {stats[\"total_sessions\"]} sessions, {stats[\"total_disc
|
|||
fi
|
||||
fi
|
||||
|
||||
git commit -m "🚀 Enhanced IPTV: $CHANNELS channels across $COUNTRIES groups$DISCOVERY_NOTE - $(date '+%Y-%m-%d %H:%M')"
|
||||
git commit -m "🚀 Enhanced IPTV with $CHANNELS channels$DISCOVERY_NOTE - $(date '+%Y-%m-%d %H:%M')"
|
||||
git push
|
||||
echo "Changes committed successfully"
|
||||
echo "Changes committed"
|
||||
fi
|
||||
|
||||
- name: Success Summary
|
||||
- name: Summary
|
||||
run: |
|
||||
echo "=== ENHANCED IPTV SYSTEM COMPLETE ==="
|
||||
echo "=== ENHANCED WORKFLOW COMPLETE ==="
|
||||
if [ -f playlist.m3u ]; then
|
||||
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||
COUNTRIES=$(grep 'group-title=' playlist.m3u | sed 's/.*group-title="//; s/".*//' | sort -u | wc -l || echo "0")
|
||||
echo "✅ Playlist: $CHANNELS channels across $COUNTRIES groups"
|
||||
echo "✅ Playlist has $CHANNELS channels"
|
||||
fi
|
||||
|
||||
# Show discovery stats if available
|
||||
if [ -f config/discovery_stats.json ]; then
|
||||
python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('config/discovery_stats.json', 'r') as f:
|
||||
stats = json.load(f)
|
||||
print(f'✅ Discovery: {stats[\"total_sessions\"]} sessions, {stats[\"total_discovered\"]} total found')
|
||||
except:
|
||||
pass
|
||||
"
|
||||
fi
|
||||
|
||||
echo "✅ Enhanced features active:"
|
||||
echo " 🔍 Automated discovery"
|
||||
echo " 🏷️ Smart categorization"
|
||||
echo " 🔄 Duplicate detection"
|
||||
echo " 📊 Enhanced reporting"
|
||||
echo ""
|
||||
echo "🎯 Ready for Phase 2: Genre categorization"
|
||||
echo "🎯 Ready for Phase 3: Stream health validation"
|
||||
echo "✅ Discovery system ready"
|
||||
echo "✅ Enhanced reporting active"
|
Loading…
Add table
Add a link
Reference in a new issue