Update .forgejo/workflows/generate-m3u.yml
Some checks failed
📺 Generate M3U Playlist / build (push) Has been cancelled
Some checks failed
📺 Generate M3U Playlist / build (push) Has been cancelled
This commit is contained in:
parent
efba1c1333
commit
e7deeed53c
1 changed files with 138 additions and 48 deletions
|
@ -1,4 +1,4 @@
|
||||||
name: Generate M3U Playlist
|
name: 📺 Generate M3U Playlist
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -10,73 +10,163 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: 📥 Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: 🐍 Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Configure Git
|
- name: ⚙️ Configure Git
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "actions@forgejo.plainrock127.xyz"
|
git config --local user.email "actions@forgejo.plainrock127.xyz"
|
||||||
git config --local user.name "Gitea Actions Bot"
|
git config --local user.name "IPTV Playlist Bot"
|
||||||
|
|
||||||
- name: Set file permissions and debug
|
- name: 📁 Create directory structure
|
||||||
run: |
|
run: |
|
||||||
echo "=== Current user and permissions ==="
|
echo "=== Creating directory structure ==="
|
||||||
whoami
|
mkdir -p logs config templates scripts docs
|
||||||
pwd
|
chmod 664 channels.txt 2>/dev/null || echo "channels.txt not found"
|
||||||
ls -la
|
chmod 664 bulk_import.m3u 2>/dev/null || echo "bulk_import.m3u not found"
|
||||||
echo "=== Setting file permissions ==="
|
|
||||||
chmod 664 channels.txt || echo "Could not chmod channels.txt"
|
|
||||||
chmod 664 bulk_import.m3u || echo "Could not chmod bulk_import.m3u (might not exist)"
|
|
||||||
chmod 775 . || echo "Could not chmod directory"
|
|
||||||
echo "=== Files before processing ==="
|
|
||||||
echo "channels.txt line count:"
|
|
||||||
wc -l channels.txt || echo "channels.txt not found"
|
|
||||||
echo "bulk_import.m3u exists:"
|
|
||||||
ls -la bulk_import.m3u || echo "bulk_import.m3u not found"
|
|
||||||
|
|
||||||
- name: Generate M3U
|
|
||||||
run: python generate_playlist.py
|
|
||||||
|
|
||||||
- name: Debug after processing
|
- name: 🔍 Pre-processing diagnostics
|
||||||
run: |
|
run: |
|
||||||
echo "=== Files after processing ==="
|
echo "=== Repository Status ==="
|
||||||
|
pwd && whoami && ls -la
|
||||||
|
echo "=== File Status ==="
|
||||||
|
if [ -f channels.txt ]; then
|
||||||
|
echo "channels.txt: $(wc -l < channels.txt) lines"
|
||||||
|
else
|
||||||
|
echo "channels.txt: Not found"
|
||||||
|
fi
|
||||||
|
if [ -f bulk_import.m3u ]; then
|
||||||
|
echo "bulk_import.m3u: $(wc -l < bulk_import.m3u) lines"
|
||||||
|
else
|
||||||
|
echo "bulk_import.m3u: Not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🚀 Generate M3U Playlist
|
||||||
|
run: |
|
||||||
|
echo "Starting playlist generation..."
|
||||||
|
python scripts/generate_playlist.py
|
||||||
|
|
||||||
|
- name: 📊 Post-processing diagnostics
|
||||||
|
run: |
|
||||||
|
echo "=== Processing Results ==="
|
||||||
ls -la
|
ls -la
|
||||||
echo "=== channels.txt line count after ==="
|
if [ -f playlist.m3u ]; then
|
||||||
wc -l channels.txt || echo "channels.txt not found"
|
echo "playlist.m3u: Generated ($(wc -l < playlist.m3u) lines)"
|
||||||
echo "=== bulk_import.m3u still exists? ==="
|
else
|
||||||
ls -la bulk_import.m3u || echo "bulk_import.m3u not found (good!)"
|
echo "playlist.m3u: Not generated"
|
||||||
echo "=== Log content ==="
|
fi
|
||||||
cat playlist_update.log || echo "No log file"
|
if [ -f bulk_import.m3u ]; then
|
||||||
echo "=== playlist.m3u line count ==="
|
echo "bulk_import.m3u: Still exists"
|
||||||
wc -l playlist.m3u || echo "playlist.m3u not found"
|
else
|
||||||
|
echo "bulk_import.m3u: Cleaned up"
|
||||||
- name: Prepare for Pages
|
fi
|
||||||
|
echo "=== Logs ==="
|
||||||
|
if [ -f logs/playlist_update.log ]; then
|
||||||
|
echo "Main log (last 10 lines):"
|
||||||
|
tail -10 logs/playlist_update.log
|
||||||
|
fi
|
||||||
|
if [ -f logs/error.log ]; then
|
||||||
|
echo "Errors found:"
|
||||||
|
cat logs/error.log
|
||||||
|
else
|
||||||
|
echo "No errors logged"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 📊 Generate statistics
|
||||||
|
run: |
|
||||||
|
if [ -f playlist.m3u ]; then
|
||||||
|
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||||
|
GROUPS=$(grep -o 'group-title="[^"]*"' playlist.m3u | sort -u | wc -l || echo "0")
|
||||||
|
echo "Total channels: $CHANNEL_COUNT"
|
||||||
|
echo "Number of groups: $GROUPS"
|
||||||
|
else
|
||||||
|
echo "No playlist generated"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 📦 Prepare deployment
|
||||||
run: |
|
run: |
|
||||||
mkdir -p docs
|
mkdir -p docs
|
||||||
cp playlist.m3u docs/playlist.m3u
|
[ -f playlist.m3u ] && cp playlist.m3u docs/
|
||||||
cp playlist_update.log docs/playlist_update.log || true
|
[ -f channels.txt ] && cp channels.txt docs/
|
||||||
|
[ -d logs ] && cp -r logs docs/
|
||||||
- name: Commit and Push
|
|
||||||
run: |
|
cat > docs/index.html << 'EOF'
|
||||||
git add channels.txt || echo "No channels.txt to add"
|
<!DOCTYPE html>
|
||||||
git add playlist.m3u || echo "No playlist.m3u to add"
|
<html>
|
||||||
git add playlist_update.log || echo "No playlist_update.log to add"
|
<head>
|
||||||
git add docs/playlist.m3u || echo "No docs/playlist.m3u to add"
|
<title>📺 IPTV Playlist</title>
|
||||||
git add docs/playlist_update.log || echo "No docs/playlist_update.log to add"
|
<meta charset="UTF-8">
|
||||||
|
<style>
|
||||||
|
body { font-family: Arial, sans-serif; margin: 40px; background: #f5f5f5; }
|
||||||
|
.container { max-width: 800px; background: white; padding: 30px; border-radius: 10px; }
|
||||||
|
h1 { color: #333; border-bottom: 3px solid #007acc; padding-bottom: 10px; }
|
||||||
|
.download-btn {
|
||||||
|
display: inline-block; padding: 12px 24px; background: #007acc;
|
||||||
|
color: white; text-decoration: none; border-radius: 5px; margin: 10px 5px;
|
||||||
|
}
|
||||||
|
.download-btn:hover { background: #005a99; }
|
||||||
|
.file-list a {
|
||||||
|
display: block; padding: 10px 15px; color: #007acc;
|
||||||
|
text-decoration: none; border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>📺 IPTV Playlist Manager</h1>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3>📊 Quick Access</h3>
|
||||||
|
<a href="playlist.m3u" class="download-btn" download>📺 Download Playlist</a>
|
||||||
|
<a href="channels.txt" class="download-btn">📋 View Channels</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>📁 Available Files</h3>
|
||||||
|
<div class="file-list">
|
||||||
|
<a href="playlist.m3u">📺 playlist.m3u - Main IPTV playlist</a>
|
||||||
|
<a href="channels.txt">📋 channels.txt - Channel database</a>
|
||||||
|
<a href="logs/">📊 logs/ - Processing logs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p><strong>Last Updated:</strong> <span id="timestamp"></span></p>
|
||||||
|
<script>
|
||||||
|
document.getElementById('timestamp').textContent = new Date().toLocaleString();
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: 💾 Commit and push changes
|
||||||
|
run: |
|
||||||
|
rm -f *.backup* || true
|
||||||
|
|
||||||
|
[ -f channels.txt ] && git add channels.txt
|
||||||
|
[ -f playlist.m3u ] && git add playlist.m3u
|
||||||
|
[ -d logs ] && git add logs/
|
||||||
|
[ -d config ] && git add config/
|
||||||
|
[ -d docs ] && git add docs/
|
||||||
|
|
||||||
echo "=== Git status ==="
|
|
||||||
git status
|
git status
|
||||||
|
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
|
exit 0
|
||||||
else
|
else
|
||||||
git commit -m "Update M3U playlist via Gitea Actions - $(date)"
|
CHANNEL_COUNT="0"
|
||||||
|
if [ -f playlist.m3u ]; then
|
||||||
|
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMIT_MSG="🎬 Updated IPTV playlist: $CHANNEL_COUNT channels ($(date '+%Y-%m-%d %H:%M'))"
|
||||||
|
git commit -m "$COMMIT_MSG"
|
||||||
git push
|
git push
|
||||||
|
echo "Changes committed successfully!"
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Loading…
Add table
Add a link
Reference in a new issue