(self, parsed_episode)
updates "episode" with the data from "parsed_episode"
updates "episode" with the data from "parsed_episode"
updates episode with the data from parsed_episode
def update_episode(self, parsed_episode):
        """updates "episode" with the data from "parsed_episode" """

        # TODO: check if there have been any changes, to
        # avoid unnecessary updates
        self.episode.guid = to_maxlength(
            Episode, "guid", parsed_episode.get("guid") or self.episode.guid
        )

        self.episode.description = (
            parsed_episode.get("description") or self.episode.description
        )

        self.episode.subtitle = parsed_episode.get("subtitle") or self.episode.subtitle

        self.episode.content = (
            parsed_episode.get("content")
            or parsed_episode.get("description")
            or self.episode.content
        )

        self.episode.link = to_maxlength(
            Episode, "link", parsed_episode.get("link") or self.episode.link
        )

        self.episode.released = (
            datetime.utcfromtimestamp(parsed_episode.get("released"))
            if parsed_episode.get("released")
            else self.episode.released
        )

        self.episode.author = to_maxlength(
            Episode, "author", parsed_episode.get("author") or self.episode.author
        )

        self.episode.duration = parsed_episode.get("duration") or self.episode.duration

        self.episode.filesize = parsed_episode["files"][0]["filesize"]

        self.episode.language = (
            parsed_episode.get("language")
            or self.episode.language
            or self.podcast.language
        )

        mimetypes = [f["mimetype"] for f in parsed_episode.get("files", [])]
        self.episode.mimetypes = ",".join(list(set(filter(None, mimetypes))))

        self.episode.flattr_url = to_maxlength(
            Episode,
            "flattr_url",
            parsed_episode.get("flattr") or self.episode.flattr_url,
        )

        self.episode.license = parsed_episode.get("license") or self.episode.license

        self.episode.title = to_maxlength(
            Episode,
            "title",
            parsed_episode.get("title")
            or self.episode.title
            or file_basename_no_extension(self.episode.url),
        )

        self.episode.last_update = datetime.utcnow()
        self.episode.save()

        parsed_urls = list(
            chain.from_iterable(
                f.get("urls", []) for f in parsed_episode.get("files", [])
            )
        )
        self.episode.add_missing_urls(parsed_urls)
def update_episode ( self , parsed_episode ) : # TODO: check if there have been any changes, to # avoid unnecessary updates self . episode . guid = to_maxlength ( Episode , "guid" , parsed_episode . get ( "guid" ) or self . episode . guid ) self . episode . description = ( parsed_episode . get ( "description" ) or self . episode . description ) self . episode . subtitle = parsed_episode . get ( "subtitle" ) or self . episode . subtitle self . episode . content = ( parsed_episode . get ( "content" ) or parsed_episode . get ( "description" ) or self . episode . content ) self . episode . link = to_maxlength ( Episode , "link" , parsed_episode . get ( "link" ) or self . episode . link ) self . episode . released = ( datetime . utcfromtimestamp ( parsed_episode . get ( "released" ) ) if parsed_episode . get ( "released" ) else self . episode . released ) self . episode . author = to_maxlength ( Episode , "author" , parsed_episode . get ( "author" ) or self . episode . author ) self . episode . duration = parsed_episode . get ( "duration" ) or self . episode . duration self . episode . filesize = parsed_episode [ "files" ] [ 0 ] [ "filesize" ] self . episode . language = ( parsed_episode . get ( "language" ) or self . episode . language or self . podcast . language ) mimetypes = [ f [ "mimetype" ] for f in parsed_episode . get ( "files" , [ ] ) ] self . episode . mimetypes = "," . join ( list ( set ( filter ( None , mimetypes ) ) ) ) self . episode . flattr_url = to_maxlength ( Episode , "flattr_url" , parsed_episode . get ( "flattr" ) or self . episode . flattr_url , ) self . episode . license = parsed_episode . get ( "license" ) or self . episode . license self . episode . title = to_maxlength ( Episode , "title" , parsed_episode . get ( "title" ) or self . episode . title or file_basename_no_extension ( self . episode . url ) , ) self . episode . last_update = datetime . utcnow ( ) self . episode . save ( ) parsed_urls = list ( chain . from_iterable ( f . get ( "urls" , [ ] ) for f in parsed_episode . get ( "files" , [ ] ) ) ) self . episode . add_missing_urls ( parsed_urls )