Skip to content

receivers

import_podcast_on_create

import_podcast_on_create(
    sender, instance, created, *args, **kwargs
)

When a podcast is created, schedule it for importing of feed data.

Source code in src/podcast_analyzer/receivers.py
@receiver(post_save, sender=Podcast)
def import_podcast_on_create(sender, instance, created, *args, **kwargs):  # noqa: ARG001
    """
    When a podcast is created, schedule it for importing of feed data.
    """
    logger.debug("Checking to see if this is a new podcast...")
    if created:
        logger.debug(
            f"New podcast created! Adding a task to fetch "
            f"feed data from {instance.rss_feed}"
        )
        async_task(async_refresh_feed, podcast_id=instance.id)