def process(self, count=-1): failedTasks = []; c = 0; while (len(self)>0): if ((count>0 and c==count)): break; task = self.pop(); if (type(task) is PodcastSyncTaskEpisodePush): print "Performing push operation to " + task.syncDestination.serviceName + ": " + task.metaData.title; print "Downloading podcast file..." fileDownloader = FileDownloader(task.metaData.enclosureURL); #Download the podcast file (ie mp3) fn, file_extension = os.path.splitext(task.metaData.enclosureURL) filename = fileDownloader.downloadToTempFile(file_extension); task.localFilename = filename; print "File Downloaded. Applying tags to file..." audio = mutagen.File(filename, easy=True) audio['title'] = task.metaData.title; audio['artist'] = task.metaData.parentPodcast.author; audio['album'] = task.metaData.parentPodcast.title; audio.save(); print "Pushing to Destination..." songID = task.syncDestination.pushEpisode(task); task.owningPodFastPodcast.addPushedEpisode(songID, task.metaData.getHashedGUID(),task.syncDestination) if (type(task) is PodcastSyncTaskEpisodePull): task.syncDestination.pullEpisode(task); c += 1; return failedTasks;
def downloadArtworkImage(self): if (self.image is None or self.imageDataFile is not None): return; print "Downloading Artwork..."; fileDownloader = FileDownloader(self.image); filename, file_extension = os.path.splitext(self.image) filename = fileDownloader.downloadToTempFile(file_extension) self.imageDataFile = filename;