Update .forgejo/workflows/generate-m3u.yml

This commit is contained in:
stoney420 2025-06-29 05:26:15 +02:00
parent 4ff00de812
commit fd332e99d6

View file

@ -183,7 +183,7 @@ def detect_country_enhanced(channel_name, epg_id="", logo_url="", stream_url="")
elif ".us" in epg_id.lower(): elif ".us" in epg_id.lower():
return "🇺🇸 United States" return "🇺🇸 United States"
elif ".uk" in epg_id.lower(): elif ".uk" in epg_id.lower():
return "🇬🇧 United Kingdom" return "<EFBFBD>🇧 United Kingdom"
elif ".ph" in epg_id.lower(): elif ".ph" in epg_id.lower():
return "🇵🇭 Philippines" return "🇵🇭 Philippines"
elif ".au" in epg_id.lower(): elif ".au" in epg_id.lower():
@ -310,7 +310,11 @@ EOF
- name: Generate Enhanced M3U Playlist - name: Generate Enhanced M3U Playlist
run: | run: |
echo "📺 Generating enhanced M3U playlist..." echo "📺 Generating enhanced M3U playlist..."
python3 -c "import sys # Create a temporary Python script for playlist generation
cat > generate_enhanced_playlist.py << 'EOF'
#!/usr/bin/env python3
import sys
print('🚀 Generating M3U from fixed channels...') print('🚀 Generating M3U from fixed channels...')
# Read channels.txt # Read channels.txt
with open('channels.txt', 'r', encoding='utf-8') as f: with open('channels.txt', 'r', encoding='utf-8') as f:
@ -343,7 +347,11 @@ with open('playlist.m3u', 'w', encoding='utf-8') as f:
f.write(f',{stream_name}\n') f.write(f',{stream_name}\n')
f.write(f'{url}\n') f.write(f'{url}\n')
valid_channels += 1 valid_channels += 1
print(f'✅ Generated playlist.m3u with {valid_channels} channels')" print(f'✅ Generated playlist.m3u with {valid_channels} channels')
EOF
# Make the temporary script executable and run it
chmod +x generate_enhanced_playlist.py
python3 generate_enhanced_playlist.py
- name: Validate Results and Generate Report - name: Validate Results and Generate Report
run: | run: |
@ -406,7 +414,6 @@ print(f'✅ Generated playlist.m3u with {valid_channels} channels')"
- name: Final Summary - name: Final Summary
run: | run: |
echo "🎉 ENHANCED COUNTRY DETECTION COMPLETE!" echo "🎉 ENHANCED COUNTRY DETECTION COMPLETE!"
# Fixed the echo syntax for repeating characters
echo "==================================================" echo "=================================================="
if [ -f playlist.m3u ]; then if [ -f playlist.m3u ]; then
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0") CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
@ -417,3 +424,4 @@ print(f'✅ Generated playlist.m3u with {valid_channels} channels')"
fi fi
echo "📋 Backup files created for safety" echo "📋 Backup files created for safety"
echo "📊 Detailed reports available in reports/daily/" echo "📊 Detailed reports available in reports/daily/"
<EFBFBD>