Beispiel #1
0
 def testShowInfo(self):
     show_info = get_show_info('theflownsky')
     self.pprinter.pprint(show_info) # pretty print the result
     self.assertEquals('k-9b89823b4508200f', show_info['show_id'])
     
     show_info = get_show_info('notesfromthevault')
     self.pprinter.pprint(show_info)
     self.assertEquals('k-27813e6f24530266', show_info['show_id'])
     
     show_info = get_show_info('irondragons')
     self.pprinter.pprint(show_info)
     self.assertEquals('k-e76e81ee69d5d413', show_info['show_id'])
def createEpisodesFromRows(chapterList):
  
    # Loop through the rows
    for row in chapterList:
        foundTitle = getTitle(row['BookID'])
        
        if (foundTitle != None):
            print "Found Title %s" % foundTitle.slug
            # Create an episode object in the database based on the current chapter row
            episode = Episode.objects.create (
                id=row['ID'],
                name=row['Title'].replace('\\', ''),
                title=foundTitle,
                sequence=row['Sequence'],
                description=row['ShowNotes'].replace('\\', '').replace('à', 'a'),
                url=row['Filename'],
                filesize=row['Length'],
                length=0,
                status=1,
                deleted=False,
                date_created=row['DateCreated'],
                date_updated=row['DateUpdated']
            )
            print "episode:",
            print episode.name,
            print ": ",
            print episode.title.slug
            if not episode.title.libsyn_show_id and episode.url:
                print "URL: " + episode.url
                urlTokens = episode.url.split("/")
                host, libsynSlug = urlTokens[2:4]
                if host == 'media.podiobooks.com' and libsynSlug:
                    show_info = libsyn_utils.get_show_info(libsynSlug)
                    if show_info:
                        episode.title.libsyn_show_id = show_info['show_id']
                        episode.title.save()
                        print "LibsynShowId:" + episode.title.libsyn_show_id
        else:
            "Could not find TitleID#%s" % row['BookID']