Beispiel #1
0
 def parse(self):
     """
     Consume the feed.
     """
     feed = feedparser.parse(self.rss_url)
     for entry in feed.entries:
         entry['published_parsed'] = str(entry.get('published_parsed'))
         entry['thumbnail'] = Image.get_smallest_image(entry.media_thumbnail)
         if len(entry.media_content) > 0:
             entry['duration'] = Video.get_duration(entry.media_content[0])
             entry['video_codec'] = Video.get_codec(entry.media_content[0])
             entry['bitrate'] = Video.get_bitrate(entry.media_content[0])
     return feed.entries
Beispiel #2
0
 def test_bad_get_bitrate(self, m_gd):
     m_gd.return_value = 235
     video = self.video.copy()
     video.pop('filesize')
     bitrate = Video.get_bitrate(video)
     self.assertIsNone(bitrate)
Beispiel #3
0
 def test_get_bitrate(self, m_gd):
     m_gd.return_value = 235
     bitrate = Video.get_bitrate(self.video)
     self.assertEqual(bitrate, 140368)