Update .forgejo/workflows/generate-m3u.yml
All checks were successful
Generate M3U Playlist / build (push) Successful in 2m6s
All checks were successful
Generate M3U Playlist / build (push) Successful in 2m6s
This commit is contained in:
parent
43a7650144
commit
0f35cf3e13
1 changed files with 10 additions and 134 deletions
|
@ -12,8 +12,6 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
|
@ -25,158 +23,36 @@ jobs:
|
||||||
git config --local user.email "actions@forgejo.plainrock127.xyz"
|
git config --local user.email "actions@forgejo.plainrock127.xyz"
|
||||||
git config --local user.name "IPTV Playlist Bot"
|
git config --local user.name "IPTV Playlist Bot"
|
||||||
|
|
||||||
- name: Check files before processing
|
- name: Run Playlist Generation
|
||||||
run: |
|
run: |
|
||||||
echo "=== Repository Status ==="
|
echo "Running playlist generation..."
|
||||||
ls -la
|
|
||||||
|
|
||||||
echo "=== Checking key files ==="
|
|
||||||
if [ -f scripts/generate_playlist.py ]; then
|
|
||||||
echo "✅ scripts/generate_playlist.py found"
|
|
||||||
else
|
|
||||||
echo "❌ scripts/generate_playlist.py missing"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d scripts ]; then
|
|
||||||
echo "✅ scripts/ directory found"
|
|
||||||
echo " Scripts directory contents:"
|
|
||||||
ls -la scripts/
|
|
||||||
else
|
|
||||||
echo "❌ scripts/ directory missing"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f scripts/__init__.py ]; then
|
|
||||||
echo "✅ scripts/__init__.py found (Python package)"
|
|
||||||
else
|
|
||||||
echo "⚠️ scripts/__init__.py missing - will create"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f channels.txt ]; then
|
|
||||||
echo "✅ channels.txt found ($(wc -l < channels.txt) lines)"
|
|
||||||
else
|
|
||||||
echo "ℹ️ channels.txt not found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f bulk_import.m3u ]; then
|
|
||||||
echo "✅ bulk_import.m3u found ($(wc -l < bulk_import.m3u) lines)"
|
|
||||||
else
|
|
||||||
echo "ℹ️ bulk_import.m3u not found (normal if no import)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Python package structure
|
|
||||||
run: |
|
|
||||||
echo "=== Setting up Python package structure ==="
|
|
||||||
|
|
||||||
# Create __init__.py if it doesn't exist
|
|
||||||
if [ ! -f scripts/__init__.py ]; then
|
|
||||||
echo "Creating scripts/__init__.py..."
|
|
||||||
cat > scripts/__init__.py << 'EOF'
|
|
||||||
"""
|
|
||||||
IPTV Playlist Generator Scripts Package
|
|
||||||
Modular components for playlist generation and management.
|
|
||||||
"""
|
|
||||||
|
|
||||||
__version__ = "2.0.0"
|
|
||||||
__author__ = "IPTV Playlist Generator"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create config directory
|
|
||||||
mkdir -p config
|
|
||||||
mkdir -p backups
|
|
||||||
mkdir -p reports
|
|
||||||
|
|
||||||
echo "✅ Package structure ready"
|
|
||||||
|
|
||||||
- name: Generate M3U Playlist
|
|
||||||
run: |
|
|
||||||
echo "=== Running playlist generation ==="
|
|
||||||
|
|
||||||
# Change to scripts directory and run
|
|
||||||
cd scripts
|
cd scripts
|
||||||
python generate_playlist.py
|
python generate_playlist.py
|
||||||
|
|
||||||
# Move generated files back to root if needed
|
|
||||||
if [ -f playlist.m3u ]; then
|
if [ -f playlist.m3u ]; then
|
||||||
mv playlist.m3u ../
|
mv playlist.m3u ../
|
||||||
fi
|
fi
|
||||||
if [ -f playlist_update.log ]; then
|
if [ -f playlist_update.log ]; then
|
||||||
mv playlist_update.log ../
|
mv playlist_update.log ../
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Go back to root
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- name: Check results
|
- name: Check Results
|
||||||
run: |
|
run: |
|
||||||
echo "=== Results ==="
|
|
||||||
ls -la
|
|
||||||
|
|
||||||
if [ -f playlist.m3u ]; then
|
if [ -f playlist.m3u ]; then
|
||||||
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||||
echo "✅ playlist.m3u generated with $CHANNEL_COUNT channels"
|
echo "Generated playlist with $CHANNEL_COUNT channels"
|
||||||
echo "File size: $(du -h playlist.m3u | cut -f1)"
|
|
||||||
echo "First 5 lines:"
|
|
||||||
head -5 playlist.m3u
|
|
||||||
else
|
else
|
||||||
echo "❌ playlist.m3u not generated"
|
echo "No playlist generated"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f playlist_update.log ]; then
|
- name: Commit Changes
|
||||||
echo "=== Log content (last 50 lines) ==="
|
|
||||||
tail -50 playlist_update.log
|
|
||||||
else
|
|
||||||
echo "❌ No log file found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for generated reports
|
|
||||||
if [ -d reports ] && [ "$(ls -A reports)" ]; then
|
|
||||||
echo "=== Generated Reports ==="
|
|
||||||
ls -la reports/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for config files
|
|
||||||
if [ -d config ] && [ "$(ls -A config)" ]; then
|
|
||||||
echo "=== Config Files ==="
|
|
||||||
ls -la config/
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit and push changes
|
|
||||||
run: |
|
run: |
|
||||||
echo "=== Preparing to commit ==="
|
git add .
|
||||||
|
if ! git diff --staged --quiet; then
|
||||||
# Pull latest changes first to avoid conflicts
|
|
||||||
git pull origin main || echo "Pull failed, continuing anyway"
|
|
||||||
|
|
||||||
# Add files (including new modular structure)
|
|
||||||
git add scripts/ || true
|
|
||||||
git add channels.txt || true
|
|
||||||
git add playlist.m3u || true
|
|
||||||
git add playlist_update.log || true
|
|
||||||
git add config/ || true
|
|
||||||
git add reports/ || true
|
|
||||||
git add backups/ || true
|
|
||||||
git add docs/ || true
|
|
||||||
|
|
||||||
# Check if anything to commit
|
|
||||||
if git diff --staged --quiet; then
|
|
||||||
echo "ℹ️ No changes to commit"
|
|
||||||
else
|
|
||||||
CHANNEL_COUNT="0"
|
CHANNEL_COUNT="0"
|
||||||
if [ -f playlist.m3u ]; then
|
if [ -f playlist.m3u ]; then
|
||||||
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||||
fi
|
fi
|
||||||
|
git commit -m "Updated playlist: $CHANNEL_COUNT channels"
|
||||||
echo "📝 Committing changes..."
|
git push
|
||||||
git commit -m "📺 Updated playlist: $CHANNEL_COUNT channels ($(date '+%Y-%m-%d %H:%M')) [Modular v2.0]"
|
|
||||||
|
|
||||||
# Try to push, with retry if needed
|
|
||||||
echo "🚀 Pushing changes..."
|
|
||||||
if ! git push origin main; then
|
|
||||||
echo "⚠️ Push failed, trying to pull and push again..."
|
|
||||||
git pull origin main --rebase || true
|
|
||||||
git push origin main || echo "❌ Push failed again - manual intervention may be needed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Changes committed and pushed"
|
|
||||||
fi
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue