(self, req, user)
Add / remove chapters according to the client's request
Add / remove chapters according to the client's request
Add / remove chapters according to the client s request
def update_chapters(self, req, user):
        """Add / remove chapters according to the client's request"""
        podcast = Podcast.objects.get_or_create_for_url(podcast_url).object
        episode = Episode.objects.get_or_create_for_url(podcast, episode_url).object

        # add chapters
        for chapter_data in req.get("chapters_add", []):
            chapter = self.parse_new(user, chapter_data)
            chapter.save()

        # remove chapters
        for chapter_data in req.get("chapters_remove", []):
            start, end = self.parse_rem(chapter_data)
            Chapter.objects.filter(
                user=user, episode=episode, start=start, end=end
            ).delete()
def update_chapters ( self , req , user ) : podcast = Podcast . objects . get_or_create_for_url ( podcast_url ) . object episode = Episode . objects . get_or_create_for_url ( podcast , episode_url ) . object # add chapters for chapter_data in req . get ( "chapters_add" , [ ] ) : chapter = self . parse_new ( user , chapter_data ) chapter . save ( ) # remove chapters for chapter_data in req . get ( "chapters_remove" , [ ] ) : start , end = self . parse_rem ( chapter_data ) Chapter . objects . filter ( user = user , episode = episode , start = start , end = end ) . delete ( )