def feedparsertest(self,url):
     '''
     
     '''
     
     import feedparser_mod
             
     d = feedparser_mod.parse(url)
     return d
    def sotf_rss_station(self,url,star=0,count=10):
        '''
        
        '''

        import feedparser_mod   # import modified feedparser.py with sotf namespace support
        from time import strptime, strftime
        
        e = {}
        error = 0
        
        try:
            d = feedparser_mod.parse(url)
        except:
            error = 1
        if error != 1:
            e['bozo'] = d['bozo']
            e['station_title'] = d['feed']['title']
            e['station_language'] = d['feed']['language']
            e['station_description'] = d['feed']['tagline']
            e['station_url'] = d['feed']['link']
            e['station_publisher_name'] = d['feed']['publisher_detail']['name']
            e['station_publisher_email'] = d['feed']['publisher_detail']['email']
            e['entries'] = []
            for entry in d['entries']:
                f = {}
                f['title'] = entry['title']
                f['episode_title'] = entry['sotf_episodetitle']
                f['episode_sequence'] = entry['sotf_episodesequence']
                f['programme_description'] = entry['summary']
                f['programme_link'] = entry['link']
                if entry['sotf_broadcastdate'] == '':
                    f['broadcast_date'] = ''
                else:
                    # strip TZ from time and reformat it to the timeformat set by Site Propertiesin ZMI
                    f['broadcast_date'] = strftime(self.portal_properties.site_properties.getProperty('localLongTimeFormat'), strptime(entry['sotf_broadcastdate'][:-3], '%Y-%m-%d %H:%M:%S'))
                f['mediafiles'] = []
                for mediafile in entry['sotf_mediafiles']:
                    g = {}
                    g['type'] = mediafile['type']
                    g['url'] = mediafile['url']
                    g['bitrate'] = mediafile['bitrate']
                    g['format'] = mediafile['format']
                    g['image'] = mediafile['image']
                    f['mediafiles'].append(g)
                e['entries'].append(f)
        
        return e, error