Update .forgejo/workflows/generate-m3u.yml
Some checks failed
Generate M3U Playlist with Auto-Organization / build-and-organize (push) Has been cancelled
Some checks failed
Generate M3U Playlist with Auto-Organization / build-and-organize (push) Has been cancelled
This commit is contained in:
parent
2ac167ba4a
commit
c916a11f26
1 changed files with 94 additions and 94 deletions
|
@ -10,107 +10,107 @@ jobs:
|
||||||
build-and-organize:
|
build-and-organize:
|
||||||
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: 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: Basic Setup
|
- name: Basic Setup
|
||||||
run: |
|
run: |
|
||||||
echo "Setting up directories..."
|
echo "Setting up directories..."
|
||||||
mkdir -p reports/daily
|
mkdir -p reports/daily
|
||||||
echo "Setup completed"
|
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
|
||||||
echo "Creating empty bulk_import.m3u"
|
echo "Creating empty bulk_import.m3u"
|
||||||
echo '#EXTM3U' > bulk_import.m3u
|
echo '#EXTM3U' > bulk_import.m3u
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Run Playlist Generation
|
|
||||||
run: |
|
|
||||||
echo "Running playlist generation..."
|
|
||||||
if [ -f scripts/generate_playlist.py ]; then
|
|
||||||
python3 scripts/generate_playlist.py
|
|
||||||
echo "Playlist generation completed"
|
|
||||||
else
|
|
||||||
echo "Error: generate_playlist.py not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Simple Report
|
|
||||||
run: |
|
|
||||||
echo "Creating report..."
|
|
||||||
if [ -f playlist.m3u ]; then
|
|
||||||
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
|
||||||
echo "Found $CHANNELS channels in playlist"
|
|
||||||
|
|
||||||
DATE=$(date +%Y%m%d_%H%M%S)
|
|
||||||
REPORT="reports/daily/report_$DATE.md"
|
|
||||||
|
|
||||||
echo "# Playlist Report" > "$REPORT"
|
|
||||||
echo "Generated: $(date)" >> "$REPORT"
|
|
||||||
echo "Channels: $CHANNELS" >> "$REPORT"
|
|
||||||
|
|
||||||
echo "Report created: $REPORT"
|
|
||||||
else
|
|
||||||
echo "No playlist found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Clean Old Reports
|
|
||||||
run: |
|
|
||||||
echo "Cleaning old reports..."
|
|
||||||
cd reports/daily
|
|
||||||
# Count markdown files
|
|
||||||
if ls *.md >/dev/null 2>&1; then
|
|
||||||
COUNT=$(ls *.md | wc -l)
|
|
||||||
echo "Found $COUNT reports"
|
|
||||||
if [ "$COUNT" -gt 3 ]; then
|
|
||||||
echo "Removing excess reports..."
|
|
||||||
ls -t *.md | tail -n +4 | xargs rm -f
|
|
||||||
echo "Cleanup done"
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "No reports to clean"
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
- name: Reset Import File
|
- name: Run Playlist Generation
|
||||||
run: |
|
run: |
|
||||||
echo "Resetting import file..."
|
echo "Running playlist generation..."
|
||||||
echo '#EXTM3U' > bulk_import.m3u
|
if [ -f scripts/generate_playlist.py ]; then
|
||||||
echo "Import file reset"
|
python3 scripts/generate_playlist.py
|
||||||
|
echo "Playlist generation completed"
|
||||||
|
else
|
||||||
|
echo "Error: generate_playlist.py not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Commit Changes
|
- name: Create Simple Report
|
||||||
run: |
|
run: |
|
||||||
echo "Committing changes..."
|
echo "Creating report..."
|
||||||
git add .
|
|
||||||
if git diff --staged --quiet; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
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")
|
||||||
|
echo "Found $CHANNELS channels in playlist"
|
||||||
|
|
||||||
|
DATE=$(date +%Y%m%d_%H%M%S)
|
||||||
|
REPORT="reports/daily/report_$DATE.md"
|
||||||
|
|
||||||
|
echo "# Playlist Report" > "$REPORT"
|
||||||
|
echo "Generated: $(date)" >> "$REPORT"
|
||||||
|
echo "Channels: $CHANNELS" >> "$REPORT"
|
||||||
|
|
||||||
|
echo "Report created: $REPORT"
|
||||||
|
else
|
||||||
|
echo "No playlist found"
|
||||||
fi
|
fi
|
||||||
git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
|
|
||||||
git push
|
|
||||||
echo "Changes committed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Summary
|
- name: Clean Old Reports
|
||||||
run: |
|
run: |
|
||||||
echo "=== WORKFLOW COMPLETE ==="
|
echo "Cleaning old reports..."
|
||||||
if [ -f playlist.m3u ]; then
|
cd reports/daily
|
||||||
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
# Count markdown files
|
||||||
echo "✅ Playlist has $CHANNELS channels"
|
if ls *.md >/dev/null 2>&1; then
|
||||||
fi
|
COUNT=$(ls *.md | wc -l)
|
||||||
echo "✅ Reports updated"
|
echo "Found $COUNT reports"
|
||||||
echo "✅ Repository cleaned"
|
if [ "$COUNT" -gt 3 ]; then
|
||||||
|
echo "Removing excess reports..."
|
||||||
|
ls -t *.md | tail -n +4 | xargs rm -f
|
||||||
|
echo "Cleanup done"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No reports to clean"
|
||||||
|
fi
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
- name: Reset Import File
|
||||||
|
run: |
|
||||||
|
echo "Resetting import file..."
|
||||||
|
echo '#EXTM3U' > bulk_import.m3u
|
||||||
|
echo "Import file reset"
|
||||||
|
|
||||||
|
- name: Commit Changes
|
||||||
|
run: |
|
||||||
|
echo "Committing changes..."
|
||||||
|
git add .
|
||||||
|
if git diff --staged --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
else
|
||||||
|
CHANNELS="0"
|
||||||
|
if [ -f playlist.m3u ]; then
|
||||||
|
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||||
|
fi
|
||||||
|
git commit -m "📺 Updated playlist with $CHANNELS channels - $(date '+%Y-%m-%d %H:%M')"
|
||||||
|
git push
|
||||||
|
echo "Changes committed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Summary
|
||||||
|
run: |
|
||||||
|
echo "=== WORKFLOW COMPLETE ==="
|
||||||
|
if [ -f playlist.m3u ]; then
|
||||||
|
CHANNELS=$(grep -c "^#EXTINF" playlist.m3u || echo "0")
|
||||||
|
echo "✅ Playlist has $CHANNELS channels"
|
||||||
|
fi
|
||||||
|
echo "✅ Reports updated"
|
||||||
|
echo "✅ Repository cleaned"
|
Loading…
Add table
Add a link
Reference in a new issue