Update .forgejo/workflows/generate-m3u.yml
Some checks failed
Generate M3U Playlist with Auto-Organization / build-and-organize (push) Failing after 19s
Some checks failed
Generate M3U Playlist with Auto-Organization / build-and-organize (push) Failing after 19s
This commit is contained in:
parent
67596f24a4
commit
71d03261c0
1 changed files with 19 additions and 95 deletions
|
@ -31,12 +31,7 @@ jobs:
|
||||||
echo "Checking import file..."
|
echo "Checking import file..."
|
||||||
if [ -f bulk_import.m3u ]; then
|
if [ -f bulk_import.m3u ]; then
|
||||||
LINES=$(wc -l < bulk_import.m3u)
|
LINES=$(wc -l < bulk_import.m3u)
|
||||||
SIZE=$(du -h bulk_import.m3u | cut -f1)
|
echo "Found bulk_import.m3u with $LINES lines"
|
||||||
echo "Found bulk_import.m3u with $LINES lines ($SIZE)"
|
|
||||||
|
|
||||||
# Show first few lines to verify content
|
|
||||||
echo "First 5 lines:"
|
|
||||||
head -n 5 bulk_import.m3u || echo "Could not read file"
|
|
||||||
else
|
else
|
||||||
echo "Creating empty bulk_import.m3u"
|
echo "Creating empty bulk_import.m3u"
|
||||||
echo '#EXTM3U' > bulk_import.m3u
|
echo '#EXTM3U' > bulk_import.m3u
|
||||||
|
@ -49,7 +44,7 @@ jobs:
|
||||||
echo "Scripts directory exists"
|
echo "Scripts directory exists"
|
||||||
ls -la scripts/
|
ls -la scripts/
|
||||||
else
|
else
|
||||||
echo "❌ Scripts directory not found!"
|
echo "Scripts directory not found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -60,75 +55,29 @@ jobs:
|
||||||
if [ -f generate_playlist.py ]; then
|
if [ -f generate_playlist.py ]; then
|
||||||
echo "Found generate_playlist.py, executing..."
|
echo "Found generate_playlist.py, executing..."
|
||||||
python3 generate_playlist.py
|
python3 generate_playlist.py
|
||||||
echo "Playlist generation completed with exit code: $?"
|
echo "Playlist generation completed"
|
||||||
else
|
else
|
||||||
echo "❌ Error: generate_playlist.py not found in scripts/"
|
echo "Error: generate_playlist.py not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Verify Generated Files
|
|
||||||
run: |
|
|
||||||
echo "Verifying generated files..."
|
|
||||||
if [ -f playlist.m3u ]; then
|
|
||||||
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
|
||||||
SIZE=$(du -h playlist.m3u | cut -f1)
|
|
||||||
echo "✅ Generated playlist.m3u with $CHANNELS channels ($SIZE)"
|
|
||||||
else
|
|
||||||
echo "⚠️ No playlist.m3u generated"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f channels.txt ]; then
|
|
||||||
SIZE=$(du -h channels.txt | cut -f1)
|
|
||||||
echo "✅ Updated channels.txt ($SIZE)"
|
|
||||||
else
|
|
||||||
echo "⚠️ No channels.txt found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Simple Report
|
- name: Create Simple Report
|
||||||
run: |
|
run: |
|
||||||
echo "Creating report..."
|
echo "Creating report..."
|
||||||
DATE=$(date +%Y%m%d_%H%M%S)
|
|
||||||
REPORT="reports/daily/report_$DATE.md"
|
|
||||||
|
|
||||||
echo "# IPTV Playlist Report" > "$REPORT"
|
|
||||||
echo "Generated: $(date)" >> "$REPORT"
|
|
||||||
echo "" >> "$REPORT"
|
|
||||||
|
|
||||||
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")
|
||||||
echo "## Summary" >> "$REPORT"
|
echo "Found $CHANNELS channels in playlist"
|
||||||
echo "- **Channels:** $CHANNELS" >> "$REPORT"
|
|
||||||
echo "- **Generated:** $(date)" >> "$REPORT"
|
|
||||||
echo "- **File size:** $(du -h playlist.m3u | cut -f1)" >> "$REPORT"
|
|
||||||
|
|
||||||
# Add top 10 groups
|
DATE=$(date +%Y%m%d_%H%M%S)
|
||||||
echo "" >> "$REPORT"
|
REPORT="reports/daily/report_$DATE.md"
|
||||||
echo "## Top Channel Groups" >> "$REPORT"
|
|
||||||
if command -v python3 >/dev/null 2>&1; then
|
echo "# Playlist Report" > "$REPORT"
|
||||||
python3 -c "
|
echo "Generated: $(date)" >> "$REPORT"
|
||||||
import re
|
echo "Channels: $CHANNELS" >> "$REPORT"
|
||||||
try:
|
|
||||||
with open('playlist.m3u', 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
groups = {}
|
|
||||||
for line in content.split('\n'):
|
|
||||||
if 'group-title=' in line:
|
|
||||||
match = re.search(r'group-title=\"([^\"]*)', line)
|
|
||||||
if match:
|
|
||||||
group = match.group(1)
|
|
||||||
groups[group] = groups.get(group, 0) + 1
|
|
||||||
|
|
||||||
for group, count in sorted(groups.items(), key=lambda x: x[1], reverse=True)[:10]:
|
|
||||||
print(f'- **{group}:** {count} channels')
|
|
||||||
except Exception as e:
|
|
||||||
print(f'- Error analyzing groups: {e}')
|
|
||||||
" >> "$REPORT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Report created: $REPORT"
|
echo "Report created: $REPORT"
|
||||||
else
|
else
|
||||||
echo "**Status:** No playlist generated" >> "$REPORT"
|
echo "No playlist found"
|
||||||
echo "⚠️ No playlist found for report"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Clean Old Reports
|
- name: Clean Old Reports
|
||||||
|
@ -138,9 +87,9 @@ except Exception as e:
|
||||||
if ls *.md >/dev/null 2>&1; then
|
if ls *.md >/dev/null 2>&1; then
|
||||||
COUNT=$(ls *.md | wc -l)
|
COUNT=$(ls *.md | wc -l)
|
||||||
echo "Found $COUNT reports"
|
echo "Found $COUNT reports"
|
||||||
if [ "$COUNT" -gt 5 ]; then
|
if [ "$COUNT" -gt 3 ]; then
|
||||||
echo "Removing excess reports (keeping 5 most recent)..."
|
echo "Removing excess reports..."
|
||||||
ls -t *.md | tail -n +6 | xargs rm -f
|
ls -t *.md | tail -n +4 | xargs rm -f
|
||||||
echo "Cleanup done"
|
echo "Cleanup done"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -152,9 +101,7 @@ except Exception as e:
|
||||||
run: |
|
run: |
|
||||||
echo "Resetting import file..."
|
echo "Resetting import file..."
|
||||||
echo '#EXTM3U' > bulk_import.m3u
|
echo '#EXTM3U' > bulk_import.m3u
|
||||||
echo "# Import file cleared after processing" >> bulk_import.m3u
|
echo "Import file reset"
|
||||||
echo "# Add your M3U content here for next run" >> bulk_import.m3u
|
|
||||||
echo "Import file reset and ready for next import"
|
|
||||||
|
|
||||||
- name: Commit Changes
|
- name: Commit Changes
|
||||||
run: |
|
run: |
|
||||||
|
@ -167,23 +114,9 @@ except Exception as e:
|
||||||
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")
|
||||||
fi
|
fi
|
||||||
|
git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
|
||||||
# Create detailed commit message
|
|
||||||
COMMIT_MSG="📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
|
|
||||||
|
|
||||||
if [ -f reports/daily/report_*.md ]; then
|
|
||||||
LATEST_REPORT=$(ls -t reports/daily/report_*.md | head -n 1)
|
|
||||||
if [ -f "$LATEST_REPORT" ]; then
|
|
||||||
COMMIT_MSG="$COMMIT_MSG
|
|
||||||
|
|
||||||
📊 Latest Report: $(basename "$LATEST_REPORT")
|
|
||||||
🔄 Auto-processed via workflow"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
git commit -m "$COMMIT_MSG"
|
|
||||||
git push
|
git push
|
||||||
echo "✅ Changes committed and pushed"
|
echo "Changes committed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Summary
|
- name: Summary
|
||||||
|
@ -192,15 +125,6 @@ except Exception as e:
|
||||||
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")
|
||||||
echo "✅ Playlist has $CHANNELS channels"
|
echo "✅ Playlist has $CHANNELS channels"
|
||||||
|
|
||||||
# Show file sizes
|
|
||||||
echo "📊 File sizes:"
|
|
||||||
[ -f playlist.m3u ] && echo " - playlist.m3u: $(du -h playlist.m3u | cut -f1)"
|
|
||||||
[ -f channels.txt ] && echo " - channels.txt: $(du -h channels.txt | cut -f1)"
|
|
||||||
else
|
|
||||||
echo "⚠️ No playlist generated"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "✅ Reports updated"
|
echo "✅ Reports updated"
|
||||||
echo "✅ Repository cleaned"
|
echo "✅ Repository cleaned"
|
||||||
echo "✅ Ready for next import"
|
|
Loading…
Add table
Add a link
Reference in a new issue