def test_update_episode(self): title = update_episode_from_libsyn_rss.update_episode_from_libsyn_rss('http://shadowmagic.podiobooks.libsynpro.com/rss') self.assertEquals(title.slug, 'shadowmagic') self.assertEquals(title.episodes.all().count(), 31) for episode in title.episodes.all(): print ("Duration: {0}\n".format(episode.duration)) self.assertEquals(title.episodes.get(sequence=1).duration, '15:24') self.assertEquals(title.episodes.get(sequence=23).duration, '22:36')
def test_update_episode(self): title = update_episode_from_libsyn_rss.update_episode_from_libsyn_rss( 'http://shadowmagic.podiobooks.libsynpro.com/rss') self.assertEquals(title.slug, 'shadowmagic') self.assertEquals(title.episodes.all().count(), 31) for episode in title.episodes.all(): print("Duration: {0}\n".format(episode.duration)) self.assertEquals(title.episodes.get(sequence=1).duration, '15:24') self.assertEquals(title.episodes.get(sequence=23).duration, '22:36')
def handle(self, **options): """Updates Episode Durations""" titles_to_update = Title.objects.filter(episodes__duration="45:00").exclude(libsyn_slug__isnull=True, libsyn_slug="").distinct() for title in titles_to_update: if title.libsyn_slug: updated_title = update_episode_from_libsyn_rss("http://{0}.podiobooks.libsynpro.com/rss".format(title.libsyn_slug)) if updated_title: self.stdout.write("{0} Updated".format(updated_title.slug)) else: self.stdout.write("{0} ERROR".format(title.slug)) else: self.stdout.write("{0} No Libsyn Slug".format(title.slug)) self.stdout.write('Complete\n')
def handle(self, **options): """Updates Episode Durations""" titles_to_update = Title.objects.filter( episodes__duration="45:00").exclude(libsyn_slug__isnull=True, libsyn_slug="").distinct() for title in titles_to_update: if title.libsyn_slug: updated_title = update_episode_from_libsyn_rss( "http://{0}.podiobooks.libsynpro.com/rss".format( title.libsyn_slug)) if updated_title: self.stdout.write("{0} Updated".format(updated_title.slug)) else: self.stdout.write("{0} ERROR".format(title.slug)) else: self.stdout.write("{0} No Libsyn Slug".format(title.slug)) self.stdout.write('Complete\n')