示例#1
0
文件: manager.py 项目: matthewg42/mpp
 def load_podcasts(self):
     log.debug('looking for feeds in: %s' % self.config['feed_dir'])
     self.podcasts = []
     for path in glob.glob('%s/*.json' % self.config['feed_dir']):
         podcast = Podcast.from_file(path)
         self.podcasts.append(podcast)
     return len(self.podcasts)
示例#2
0
 def test_save_and_restore(self):
     horse_podcast = Podcast.from_dict(self.feed_dict)
     with tempfile.NamedTemporaryFile(suffix='.json') as f: tmp = f.name
     horse_podcast.save_to_file(tmp)
     restored_podcast = Podcast.from_file(tmp)
     os.unlink(tmp)
     self.assertEqual(horse_podcast.url, restored_podcast.url)
     self.assertEqual(len(horse_podcast.episodes), len(restored_podcast.episodes))