All checks were successful
Generate M3U Playlist / build (push) Successful in 1m21s
108 lines
No EOL
3 KiB
YAML
108 lines
No EOL
3 KiB
YAML
name: Generate M3U Playlist
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --local user.email "actions@forgejo.plainrock127.xyz"
|
|
git config --local user.name "IPTV Playlist Bot"
|
|
|
|
- name: Debug File Structure
|
|
run: |
|
|
echo "=== Root Directory ==="
|
|
ls -la
|
|
echo ""
|
|
echo "=== Scripts Directory ==="
|
|
ls -la scripts/
|
|
echo ""
|
|
echo "=== Check for Import File ==="
|
|
if [ -f bulk_import.m3u ]; then
|
|
echo "✅ bulk_import.m3u found in root ($(wc -l < bulk_import.m3u) lines)"
|
|
echo "First 3 lines:"
|
|
head -3 bulk_import.m3u
|
|
else
|
|
echo "❌ bulk_import.m3u not found in root"
|
|
fi
|
|
|
|
if [ -f channels.txt ]; then
|
|
echo "✅ channels.txt found ($(du -h channels.txt | cut -f1))"
|
|
else
|
|
echo "❌ channels.txt not found"
|
|
fi
|
|
|
|
- name: Setup Directories
|
|
run: |
|
|
mkdir -p config
|
|
mkdir -p backups
|
|
mkdir -p reports
|
|
|
|
# Create scripts/__init__.py if missing
|
|
if [ ! -f scripts/__init__.py ]; then
|
|
echo '# Scripts package' > scripts/__init__.py
|
|
fi
|
|
|
|
- name: Run Playlist Generation
|
|
run: |
|
|
echo "=== Running playlist generation ==="
|
|
echo "Current directory: $(pwd)"
|
|
echo "Available files:"
|
|
ls -la
|
|
|
|
# Run from root directory, not scripts directory
|
|
python scripts/generate_playlist.py
|
|
|
|
- name: Check Results
|
|
run: |
|
|
echo "=== Final Results ==="
|
|
ls -la
|
|
|
|
if [ -f playlist.m3u ]; then
|
|
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
|
echo "✅ playlist.m3u generated with $CHANNEL_COUNT channels"
|
|
echo "File size: $(du -h playlist.m3u | cut -f1)"
|
|
echo "First 5 lines:"
|
|
head -5 playlist.m3u
|
|
else
|
|
echo "❌ playlist.m3u not generated"
|
|
fi
|
|
|
|
if [ -f playlist_update.log ]; then
|
|
echo "=== Log content (last 30 lines) ==="
|
|
tail -30 playlist_update.log
|
|
else
|
|
echo "❌ No log file found"
|
|
fi
|
|
|
|
if [ -f channels.txt ]; then
|
|
echo "=== channels.txt status ==="
|
|
echo "Size: $(du -h channels.txt | cut -f1)"
|
|
echo "Lines: $(wc -l < channels.txt)"
|
|
fi
|
|
|
|
- name: Commit Changes
|
|
run: |
|
|
git add .
|
|
if ! git diff --staged --quiet; then
|
|
CHANNEL_COUNT="0"
|
|
if [ -f playlist.m3u ]; then
|
|
CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
|
fi
|
|
git commit -m "Updated playlist: $CHANNEL_COUNT channels"
|
|
git push
|
|
fi |