Update .forgejo/workflows/generate-m3u.yml
Some checks failed
Generate M3U Playlist with Auto-Organization / build-and-organize (push) Has been cancelled

This commit is contained in:
stoney420 2025-06-29 05:45:01 +02:00
parent 50ef0402c6
commit f7079b8779

View file

@ -12,24 +12,22 @@ jobs:
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- 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 "IPTV Playlist Bot" git config --local user.name "IPTV Playlist Bot"
- name: Setup Python Environment - name: Set up Python 3.10
run: | uses: actions/setup-python@v5
echo "Setting up Python environment..." with:
python3 --version python-version: '3.10'
echo "Setting up directories..."
mkdir -p reports/daily reports/logs backups config
echo "Setup completed"
- name: Check Import File - name: Check Import File
run: | run: |
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)
echo "Found bulk_import.m3u with $LINES lines" echo "Found bulk_import.m3u with $LINES lines"
else else
@ -40,7 +38,8 @@ jobs:
- name: Verify Scripts Directory - name: Verify Scripts Directory
run: | run: |
echo "Checking scripts directory..." echo "Checking scripts directory..."
if [ -d scripts ]; then if [ -d scripts ];
then
echo "Scripts directory exists" echo "Scripts directory exists"
ls -la scripts/ ls -la scripts/
else else
@ -50,11 +49,12 @@ jobs:
- name: Run Playlist Generation - name: Run Playlist Generation
run: | run: |
set -x # Enable debug output
echo "Running playlist generation..." echo "Running playlist generation..."
cd scripts if [ -f scripts/generate_playlist.py ];
if [ -f generate_playlist.py ]; then then
echo "Found generate_playlist.py, executing..." echo "Found generate_playlist.py, executing..."
python3 generate_playlist.py python3 scripts/generate_playlist.py
echo "Playlist generation completed" echo "Playlist generation completed"
else else
echo "Error: generate_playlist.py not found" echo "Error: generate_playlist.py not found"
@ -64,7 +64,8 @@ jobs:
- name: Create Simple Report - name: Create Simple Report
run: | run: |
echo "Creating report..." echo "Creating 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 "Found $CHANNELS channels in playlist" echo "Found $CHANNELS channels in playlist"
@ -84,10 +85,12 @@ jobs:
run: | run: |
echo "Cleaning old reports..." echo "Cleaning old reports..."
cd reports/daily cd reports/daily
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 3 ]; then if [ "$COUNT" -gt 3 ];
then
echo "Removing excess reports..." echo "Removing excess reports..."
ls -t *.md | tail -n +4 | xargs rm -f ls -t *.md | tail -n +4 | xargs rm -f
echo "Cleanup done" echo "Cleanup done"
@ -107,11 +110,13 @@ jobs:
run: | run: |
echo "Committing changes..." echo "Committing changes..."
git add . git add .
if git diff --staged --quiet; then if git diff --staged --quiet;
then
echo "No changes to commit" echo "No changes to commit"
else else
CHANNELS="0" CHANNELS="0"
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')" git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
@ -122,7 +127,8 @@ jobs:
- name: Summary - name: Summary
run: | run: |
echo "=== WORKFLOW COMPLETE ===" echo "=== WORKFLOW COMPLETE ==="
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"
fi fi