-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(feed): optimize podcast feed generation and update metadata
- Modify episode item building to fetch episode data on-demand - Update podcast feed metadata (explicit flag and block parameter) - Adjust documentation build command in Makefile - Add .idea/caches to gitignore
- Loading branch information
Showing
5 changed files
with
14 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,10 +52,11 @@ async def build_episode_chapters(episode: Episode) -> list[EpisodeChapter]: | |
for index_point in episode.index_points | ||
] | ||
|
||
async def build_episode_item(self, episode: Episode, series_data: PodcastSeries) -> Item | None: | ||
async def build_episode_item(self, episode_id: str, series_data: PodcastSeries) -> Item | None: | ||
"""Build a :class:`rfeed.rfeed.Item` for an episode.""" | ||
|
||
_LOGGER.debug("Building episode item: %s", episode.episode_id) | ||
_LOGGER.debug("Building episode item: %s", episode_id) | ||
episode = await self.api.get_episode(series_data.id, episode_id) | ||
manifest = await self.api.get_playback_manifest(episode.episode_id, podcast=True) | ||
episode_file = manifest.playable.assets[0] or None | ||
if episode_file is None: # pragma: no cover | ||
|
@@ -65,7 +66,7 @@ async def build_episode_item(self, episode: Episode, series_data: PodcastSeries) | |
_LOGGER.debug("File stat: %s", file_stat) | ||
|
||
extensions = [] | ||
if episode.index_points: # pragma: no cover | ||
if episode.index_points: | ||
chapters_url = f"{self.base_url}/{series_data.id}/{episode.episode_id}/chapters.json" | ||
extensions.append(PodcastChapters(chapters_url, "application/json+chapters")) | ||
|
||
|
@@ -142,7 +143,8 @@ async def build_podcast_rss(self, podcast_id: str, limit: int | None = None) -> | |
author="NRK", | ||
# subtitle=(description[:255] + '..') if len(description) > 255 else description, | ||
summary=podcast.series.titles.subtitle, | ||
explicit="clean", | ||
block=True, | ||
explicit=False, | ||
owner=iTunesOwner( | ||
name="NRK", | ||
email="[email protected]", | ||
|
@@ -153,7 +155,7 @@ async def build_podcast_rss(self, podcast_id: str, limit: int | None = None) -> | |
*extensions, | ||
], | ||
items=[ | ||
await self.build_episode_item(episode, series_data=podcast.series) for episode in episodes | ||
await self.build_episode_item(episode.episode_id, series_data=podcast.series) for episode in episodes | ||
], | ||
**feed_attrs, | ||
) |