def setUp(self): self.podcast = model.PodcastChannel(None) self.podcast.url = 'http://example.com/feed.rss' self.audio_episode = model.PodcastEpisode(self.podcast) self.audio_episode.mime_type = 'audio/mpeg' self.video_episode = model.PodcastEpisode(self.podcast) self.video_episode.mime_type = 'video/mp4'
def get_new_episodes(self, channel, guids): tracks = [] for track in self.playlist.getElementsByTagName('track'): title = self.get_text_contents(track.getElementsByTagName('title')) url = self.get_text_contents( track.getElementsByTagName('location')) if url in guids: continue filesize, filetype, filedate, filename = get_metadata(url) episode = model.PodcastEpisode(channel) episode.update_from_dict({ 'title': title, 'link': '', 'description': '', 'url': url, 'length': int(filesize), 'mimetype': filetype, 'guid': url, 'pubDate': filedate, }) episode.save() tracks.append(episode) return len(tracks)
def get_new_episodes(self, channel, guids): tracks = [t for t in self.sc_user.get_tracks('favorites') \ if t['guid'] not in guids] for track in tracks: episode = model.PodcastEpisode(channel) episode.update_from_dict(track) episode.save() return len(tracks)
def setUp(self): self.podcast = model.PodcastChannel(None) self.episode = model.PodcastEpisode(self.podcast) self.episode.published = self.PUBLISHED_UNIXTIME