Skip to content

feat(feed): allow opus/ogg enclosure MIME override - #971

Merged
mxpv merged 2 commits into
mxpv:mainfrom
m-try1:feat/opus-ogg-enclosure-mime
Nov 25, 2026
Merged

mxpv merged 2 commits into
mxpv:mainfrom
m-try1:feat/opus-ogg-enclosure-mime

Conversation

@m-try1

@m-try1 m-try1 commented Nov 24, 2026

Copy link
Copy Markdown

Motivation

When publishing .opus or .ogg audio feeds in Podsync:

  • format = "audio" emits type="audio/mpeg" on <enclosure>, causing podcast clients to misidentify .opus/.ogg audio files.
  • format = "custom" with extension = "opus" or "ogg" has no corresponding itunes.EnclosureType constant in github.com/eduncan911/podcast (which only defines m4a, m4v, mp4, mp3, mov, pdf, and epub), so EnclosureFromExtension returns -1.

Changes

  • pkg/feed/xml.go:
    • Added enclosureMIMEOverrides mapping normalized custom extensions "opus" and "ogg" to "audio/ogg".
    • In Build, when feed.Format == model.FormatCustom and cfg.CustomFormat.Extension matches enclosureMIMEOverrides, pass a valid placeholder itunes.M4A to satisfy eduncan911/podcast validation in p.AddItem(item) and then set p.Items[n-1].Enclosure.TypeFormatted = mimeOverride ("audio/ogg").
  • pkg/feed/xml_test.go:
    • Added TestBuildXMLOpusEnclosure covering both .Opus (mixed case with leading dot) and ogg custom extensions, verifying URL normalization, Enclosure.TypeFormatted == "audio/ogg", and the rendered <enclosure ... type="audio/ogg"> XML output.
  • CLAUDE.md:
    • Documented that custom_format.extension enclosure MIME mapping includes opus and ogg (published as audio/ogg).

Default Behavior & Compatibility

  • Fully non-breaking and opt-in: only affects feeds explicitly configured with format = "custom" and custom_format.extension set to opus or ogg (case-insensitive, with or without a leading .).
  • All existing configurations and default enclosure MIME types (audio -> audio/mpeg, video -> video/mp4, and existing custom_format.extension mappings) remain completely unchanged.

Verification

Verified locally with golang:1.26 (go1.26.11 linux/amd64):

  • go test -v ./pkg/feed/... — PASS (TestBuildXMLOpusEnclosure/opus and TestBuildXMLOpusEnclosure/ogg passed; ok github.com/mxpv/podsync/pkg/feed)
  • go test ./... — PASS (all packages passed)
  • go build ./... — PASS

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T23:51:40.445022Z a826ac5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mxpv
mxpv merged commit f332a8c into mxpv:main Nov 25, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants