def download_poster(self, size, destination, choose): ''' download associated movie poster size: w92, w154, w185, w342, w500, or original see http://help.themoviedb.org/kb/api/configuration name: name to save it as ''' if choose: print 'Creating image selection palette(s)...' posters = _get_all_posters(self.posters, size) poster_qty = len(posters) if poster_qty <= 1: print 'No palette created,', poster_qty, 'image(s) available' return download_file(self.poster.geturl(size), destination) draw_mosaic(posters) choice = get_input('Choose an image to use for movie poster: ', '(^$)|(^(Q|q)$)|(^\d{1,2}$)', 1, poster_qty) if re.match('^(Q|q)$', choice): exit() if not choice: poster_url = self.poster.geturl(size) else: poster_url = self.posters[int(choice)-1].geturl(size) else: poster_url = self.poster.geturl(size) image = download_file(poster_url, destination) if destination == 'temp': return image is_reduced = reduce_size(destination, 90) if is_reduced: notify('warning', 'image quality reduced and useless data removed for ' + os.path.splitext(os.path.basename(destination))[0], sys.stderr)
def _save_poster(location, destination, basename, max_size): # If there is no art, carry on if not location: notify('warning', 'no image available for ' + basename) return download_file(location, destination) is_reduced = reduce_size(destination, max_size) if is_reduced: notify('warning', 'image quality reduced and useless data removed for ' + basename, sys.stderr)