Skip to main content

PodcastIndexNamespace

\Benecaster\Feed\Namespaces\PodcastIndexNamespace

Class Free

The feed handler for the Podcasting 2.0 (podcast:) namespace, prefix podcast, URI https://podcastindex.org/namespace/1.0. The plugin registers it at boot. It implements TierAwareFeedNamespaceInterface, so the feed compiler calls channel_tags_for_tier() for the channel and plain episode_tags() for each item. It reads show and episode settings itself, builds an array of tag data, passes the array through a filter, and renders whatever the filter returns.

Channel tags: podcast:guid, podcast:locked (with the owner email when set), podcast:funding, one podcast:block per blocked platform, one podcast:txt per entry, podcast:license, podcast:medium (always; podcast when the show never chose one), podcast:updateFrequency (with rrule and complete attributes), one podcast:trailer per trailer episode the requesting tier can already receive, and a podcast:person with role host when the show has a host name. There is no channel-level podcast:image, because show artwork is stored as a bare URL with no dimensions or type to describe.

Item tags: podcast:transcript, one podcast:soundbite per soundbite, one podcast:person per credit, one podcast:image per size of the episode’s artwork attachment (largest first, with episode artwork only and no fallback to show artwork), podcast:episode when the episode has a number, podcast:season (with the season’s display name) when the show has seasons enabled, and podcast:chapters when a chapters entry is present in the tag array.

To change or add tags from code, use the two tag-array filters, benecaster_feed_podcast_channel_tags and benecaster_feed_podcast_episode_tags. The renderer only understands the array keys it already knows; to emit a tag in another namespace, register your own handler through benecaster_feed_namespaces.

Constructor Dependencies

Type Description
\Benecaster\ListenerSupport\Settings Supplies the show's Listener Support payment URL, used for podcast:funding when the show's funding mode is automatic.
\Benecaster\Episode\EpisodeTypeRepository Maps the show's episode types to iTunes types, to find which episodes count as trailers. Both dependencies have defaults, so the class can be constructed with no arguments.

Methods

Method Visibility Since Description
get_xmlns(): array Public — Returns [ 'podcast' => 'https://podcastindex.org/namespace/1.0' ]. The feed compiler adds the declaration to the RSS root only when the compiled feed contains a <podcast: tag.
channel_tags( int $show_id ): array Public — Channel fragments with no tier context. It calls channel_tags_for_tier() with an empty tier and an empty episode list, so podcast:trailer is left out rather than guessed. The feed compiler does not use this method for this class.
channel_tags_for_tier( int $show_id, string $tier_slug, array $available_episode_ids ): array Public — Builds the channel tag array from the show's settings, runs it through benecaster_feed_podcast_channel_tags (arguments: the array and the show ID), and renders it to XML fragments. Trailers are chosen only from $available_episode_ids, the episodes this tier may receive: an empty list produces no trailers. A trailer is an episode whose type maps to the iTunes type trailer for the show; its media URL is passed through benecaster_episode_audio_url and benecaster_feed_enclosure_url so a download proxy or URL rewrite applies to it. A trailer with no media URL is skipped. The show's default file is advertised, not a per-tier audio variant.
episode_tags( int $episode_id, int $show_id ): array Public — Builds the item tag array from the episode and show settings, runs it through benecaster_feed_podcast_episode_tags (arguments: the array, the episode ID, the show ID), and renders it to XML fragments. The filter receives no tier. The person list is the show's host first, then credits supplied by add-ons through benecaster_podcast2_episode_auto_feed_credits (never stored on the episode), then credits saved on the episode.

Hooks Fired

Notes

A tag-array callback can only affect tags the renderer knows: guid, locked, funding, block, txt, license, medium, update_frequency, trailers and host at channel level, and transcript, soundbites, feed_credits, images, episode, season and chapters at item level. Other keys are ignored.

podcast:funding takes its URL from Listener Support when the funding mode is automatic, from the stored URL when it is custom, and from the stored URL when no mode was ever saved. When Listener Support is off or has no payment URL in automatic mode, the tag is omitted.

The trailer list is bounded by the episode IDs passed in and never runs its own search for episodes. A channel tag that names an episode exposes that episode's media URL to every recipient of the feed.