Skip to content

admin

AnalysisGroupAdmin

Bases: ModelAdmin

Admin for analysis group objects.

ArtUpdateAdmin

Bases: ModelAdmin

Admin for art update log

EpisodeAdmin

Bases: ModelAdmin

Admin for podcast episodes.

ItunesCategoryAdmin

Bases: ModelAdmin

Admin for iTunes Categories

PersonAdmin

Bases: ModelAdmin

Admin for detected persons.

PodcastAdmin

Bases: ModelAdmin

Admin for podcast records.

check_for_new_episodes

check_for_new_episodes(request, queryset)

Refreshes the feed metadata and checks for any new episodes.

Source code in src/podcast_analyzer/admin.py
@admin.action(description="Get new episodes")
def check_for_new_episodes(self, request, queryset):
    """
    Refreshes the feed metadata and checks for any new episodes.
    """
    new_episodes, feeds_refreshed = self.feed_update(
        request, queryset, update_existing_episodes=False
    )
    self.message_user(
        request,
        ngettext("%d feed refreshed.", "%d feeds refreshed.", feeds_refreshed)
        % feeds_refreshed,
        messages.SUCCESS,
    )
    self.message_user(
        request,
        ngettext("%d episode added.", "%d episodes added.", new_episodes)
        % new_episodes,
        messages.SUCCESS,
    )

feed_update

feed_update(
    request: HttpRequest,
    queryset: QuerySet[Podcast],
    *,
    update_existing_episodes: bool = False
) -> tuple[int, int]

Does a refresh of a list of feeds, ignoring any episodes already imported.

Source code in src/podcast_analyzer/admin.py
def feed_update(
    self,
    request: HttpRequest,
    queryset: QuerySet[Podcast],
    *,
    update_existing_episodes: bool = False,
) -> tuple[int, int]:
    """
    Does a refresh of a list of feeds, ignoring any episodes already
    imported.
    """
    episodes_touched: int = 0
    feeds_refreshed: int = 0
    for instance in queryset:
        try:
            eps_updated: int = instance.refresh_feed(
                update_existing_episodes=update_existing_episodes
            )
            episodes_touched += eps_updated
            feeds_refreshed += 1
        except FeedFetchError:  # no cov
            self.message_user(
                request,
                f"Feed for {instance.title} is unreachable.",
                messages.ERROR,
            )
        except FeedParseError as fpe:  # no cov
            self.message_user(
                request,
                f"Parsing feed for {instance.title} resulted in error: {fpe}",
                messages.ERROR,
            )
    return episodes_touched, feeds_refreshed

refresh_all_episodes

refresh_all_episodes(request, queryset)

Refreshes the feed metadata, checks for new episodes, and updates EVERY existing episode with new data.

Source code in src/podcast_analyzer/admin.py
@admin.action(description="Update feed and all episodes.")
def refresh_all_episodes(self, request, queryset):
    """
    Refreshes the feed metadata, checks for new episodes, and updates
    EVERY existing episode with new data.
    """
    episodes_touched, feeds_refreshed = self.feed_update(
        request, queryset, update_existing_episodes=True
    )
    self.message_user(
        request,
        ngettext("%d feed refreshed.", "%d feeds refreshed.", feeds_refreshed)
        % feeds_refreshed,
        messages.SUCCESS,
    )
    self.message_user(
        request,
        ngettext(
            "%d episode added/refreshed.",
            "%d episodes added/refreshed.",
            episodes_touched,
        )
        % episodes_touched,
        messages.SUCCESS,
    )

SeasonAdmin

Bases: ModelAdmin

Admin for podcast seasons.