audio streaming app plyr.fm

fix: add manual upload-audio workflow, fix grep -c bug (#883)

- new upload-audio.yml: workflow_dispatch with form fields for title,
album, tags, and optional track deletion before upload
- fix grep -c in status-maintenance upload job: grep returns exit code 1
on no match, causing "|| echo 0" to append a second "0" line.
use "|| true" instead so grep's "0" output is preserved as-is

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

authored by zzstoatzz.io

Claude Opus 4.6 and committed by
GitHub
3644e46c b3a57234

+77 -1
+3 -1
.github/workflows/status-maintenance.yml
··· 288 288 YEAR=$(date +%Y) 289 289 290 290 # count how many "plyr.fm update - {date}" tracks exist for today 291 - TODAY_COUNT=$(echo "$EXISTING" | grep -c "plyr.fm update - $TODAY" || echo "0") 291 + # grep -c returns exit code 1 on no match, so default to 0 292 + TODAY_COUNT=$(echo "$EXISTING" | grep -c "plyr.fm update - $TODAY" || true) 293 + TODAY_COUNT=${TODAY_COUNT:-0} 292 294 293 295 if [ "$TODAY_COUNT" -gt 0 ]; then 294 296 # already have one today, add episode number
+74
.github/workflows/upload-audio.yml
··· 1 + # manual audio upload to plyr.fm 2 + # 3 + # uploads the most recent update.wav from the repo root to plyr.fm 4 + # via the plyrfm CLI. uses the plyr.fm bot account. 5 + # 6 + # required secrets: 7 + # PLYR_BOT_TOKEN - plyr.fm developer token 8 + 9 + name: upload audio 10 + 11 + on: 12 + workflow_dispatch: 13 + inputs: 14 + title: 15 + description: "track title" 16 + required: true 17 + type: string 18 + album: 19 + description: "album name (default: current year)" 20 + required: false 21 + type: string 22 + tags: 23 + description: "comma-separated tags (default: ai)" 24 + required: false 25 + type: string 26 + default: "ai" 27 + delete_track_id: 28 + description: "track ID to delete before uploading (optional)" 29 + required: false 30 + type: string 31 + 32 + jobs: 33 + upload: 34 + runs-on: ubuntu-latest 35 + 36 + steps: 37 + - uses: actions/checkout@v4 38 + 39 + - uses: astral-sh/setup-uv@v4 40 + 41 + - name: Delete old track (if requested) 42 + if: inputs.delete_track_id != '' 43 + run: | 44 + echo "Deleting track ${{ inputs.delete_track_id }}..." 45 + uv run --with plyrfm -- plyrfm delete "${{ inputs.delete_track_id }}" --yes 46 + env: 47 + PLYR_TOKEN: ${{ secrets.PLYR_BOT_TOKEN }} 48 + 49 + - name: Upload audio to plyr.fm 50 + run: | 51 + if [ ! -f update.wav ]; then 52 + echo "::error::No update.wav found at repo root" 53 + exit 1 54 + fi 55 + 56 + ALBUM="${{ inputs.album }}" 57 + ALBUM=${ALBUM:-$(date +%Y)} 58 + 59 + TAGS="${{ inputs.tags }}" 60 + TAG_ARGS="" 61 + if [ -n "$TAGS" ]; then 62 + IFS=',' read -ra TAG_ARRAY <<< "$TAGS" 63 + for tag in "${TAG_ARRAY[@]}"; do 64 + TAG_ARGS="$TAG_ARGS -t $(echo "$tag" | xargs)" 65 + done 66 + fi 67 + 68 + echo "Uploading: ${{ inputs.title }}" 69 + echo "Album: $ALBUM" 70 + echo "Tags: $TAGS" 71 + 72 + eval uv run --with plyrfm -- plyrfm upload update.wav '"${{ inputs.title }}"' --album '"$ALBUM"' $TAG_ARGS 73 + env: 74 + PLYR_TOKEN: ${{ secrets.PLYR_BOT_TOKEN }}