(self, rss_feed)
return rss_feed
Extend an RSS feed root with set itunes fields.

        :returns: The feed root element.
Extend an RSS feed root with set itunes fields.
Extend an RSS feed root with set itunes fields .
def extend_rss(self, rss_feed):
        '''Extend an RSS feed root with set itunes fields.

        :returns: The feed root element.
        '''
        ITUNES_NS = 'http://www.itunes.com/dtds/podcast-1.0.dtd'
        channel = rss_feed[0]

        if self.__itunes_author:
            author = xml_elem('{%s}author' % ITUNES_NS, channel)
            author.text = self.__itunes_author

        if self.__itunes_block is not None:
            block = xml_elem('{%s}block' % ITUNES_NS, channel)
            block.text = 'yes' if self.__itunes_block else 'no'

        for c in self.__itunes_category or []:
            if not c.get('cat'):
                continue
            category = channel.find(
                    '{%s}category[@text="%s"]' % (ITUNES_NS, c.get('cat')))
            if category is None:
                category = xml_elem('{%s}category' % ITUNES_NS, channel)
                category.attrib['text'] = c.get('cat')

            if c.get('sub'):
                subcategory = xml_elem('{%s}category' % ITUNES_NS, category)
                subcategory.attrib['text'] = c.get('sub')

        if self.__itunes_image:
            image = xml_elem('{%s}image' % ITUNES_NS, channel)
            image.attrib['href'] = self.__itunes_image

        if self.__itunes_explicit in ('yes', 'no', 'clean'):
            explicit = xml_elem('{%s}explicit' % ITUNES_NS, channel)
            explicit.text = self.__itunes_explicit

        if self.__itunes_complete in ('yes', 'no'):
            complete = xml_elem('{%s}complete' % ITUNES_NS, channel)
            complete.text = self.__itunes_complete

        if self.__itunes_new_feed_url:
            new_feed_url = xml_elem('{%s}new-feed-url' % ITUNES_NS, channel)
            new_feed_url.text = self.__itunes_new_feed_url

        if self.__itunes_owner:
            owner = xml_elem('{%s}owner' % ITUNES_NS, channel)
            owner_name = xml_elem('{%s}name' % ITUNES_NS, owner)
            owner_name.text = self.__itunes_owner.get('name')
            owner_email = xml_elem('{%s}email' % ITUNES_NS, owner)
            owner_email.text = self.__itunes_owner.get('email')

        if self.__itunes_subtitle:
            subtitle = xml_elem('{%s}subtitle' % ITUNES_NS, channel)
            subtitle.text = self.__itunes_subtitle

        if self.__itunes_summary:
            summary = xml_elem('{%s}summary' % ITUNES_NS, channel)
            summary.text = self.__itunes_summary

        return rss_feed
def extend_rss ( self , rss_feed ) : ITUNES_NS = 'http://www.itunes.com/dtds/podcast-1.0.dtd' channel = rss_feed [ 0 ] if self . __itunes_author : author = xml_elem ( '{%s}author' % ITUNES_NS , channel ) author . text = self . __itunes_author if self . __itunes_block is not None : block = xml_elem ( '{%s}block' % ITUNES_NS , channel ) block . text = 'yes' if self . __itunes_block else 'no' for c in self . __itunes_category or [ ] : if not c . get ( 'cat' ) : continue category = channel . find ( '{%s}category[@text="%s"]' % ( ITUNES_NS , c . get ( 'cat' ) ) ) if category is None : category = xml_elem ( '{%s}category' % ITUNES_NS , channel ) category . attrib [ 'text' ] = c . get ( 'cat' ) if c . get ( 'sub' ) : subcategory = xml_elem ( '{%s}category' % ITUNES_NS , category ) subcategory . attrib [ 'text' ] = c . get ( 'sub' ) if self . __itunes_image : image = xml_elem ( '{%s}image' % ITUNES_NS , channel ) image . attrib [ 'href' ] = self . __itunes_image if self . __itunes_explicit in ( 'yes' , 'no' , 'clean' ) : explicit = xml_elem ( '{%s}explicit' % ITUNES_NS , channel ) explicit . text = self . __itunes_explicit if self . __itunes_complete in ( 'yes' , 'no' ) : complete = xml_elem ( '{%s}complete' % ITUNES_NS , channel ) complete . text = self . __itunes_complete if self . __itunes_new_feed_url : new_feed_url = xml_elem ( '{%s}new-feed-url' % ITUNES_NS , channel ) new_feed_url . text = self . __itunes_new_feed_url if self . __itunes_owner : owner = xml_elem ( '{%s}owner' % ITUNES_NS , channel ) owner_name = xml_elem ( '{%s}name' % ITUNES_NS , owner ) owner_name . text = self . __itunes_owner . get ( 'name' ) owner_email = xml_elem ( '{%s}email' % ITUNES_NS , owner ) owner_email . text = self . __itunes_owner . get ( 'email' ) if self . __itunes_subtitle : subtitle = xml_elem ( '{%s}subtitle' % ITUNES_NS , channel ) subtitle . text = self . __itunes_subtitle if self . __itunes_summary : summary = xml_elem ( '{%s}summary' % ITUNES_NS , channel ) summary . text = self . __itunes_summary return rss_feed