def _get_all_posters(poster_list, size): poster_files = [] for i,poster in enumerate(poster_list): show_images_retrieved(i, len(poster_list)) poster_url = poster.geturl(size) poster_files.append(download_file(poster_url, 'temp')) return poster_files
def _get_all_posters(location): ''' download all available posters that share series with the one at location return number of available posters ''' if not location: return 0 baseurl = '/'.join(location.split('/')[:-1]) filename = location.split('/')[-1] basename, ext = filename.split('.') seriesno, posterno = basename.split('-') poster_files = [] i = 1 try: while True: location = baseurl + '/' + seriesno + '-' + str(i) + '.' + ext poster_files.append(download_file(location, 'temp')) show_images_retrieved(i) i = i + 1 except urllib2.HTTPError as e: pass return poster_files