def addPodcastByFile(self, _path): try: _url = os.path.normpath(_path) rss = RSS20.RSS20(self.mConfig[self.STR_showError]) rssBody = rss.getRSSObject(Podcast.f_fileToString(_url, self.mConfig[self.STR_showError])) name = Podcast.getCastNameByRSS(rssBody) except (KeyboardInterrupt, SystemExit): raise except: raise self.addPodcast(name, _path)
def addPodcastByURL(self, _url): name = "" try: rss = RSS20.RSS20(self.mConfig[self.STR_showError]) rssString, isRSSstringOK = Podcast.f_urlToString(_url, self.mConfig[self.STR_showError]) if isRSSstringOK: rssBody = rss.getRSSObject(rssString) name = Podcast.getCastNameByRSS(rssBody) except (KeyboardInterrupt, SystemExit): raise except: raise if isRSSstringOK: self.addPodcast(name, _url)
def test_Title(self): castTitle = "das ARD radiofeature" castName = Podcast.getCastNameByRSS(self.rssBody) self.assertEqual(castTitle, castName)