コード例 #1
0
ファイル: Cinematerial.py プロジェクト: DavidLekei/movr-api
	def get_poster(self, film_name, imdb_id):
		imageUtils = ImageUtils()
		image_path = '../res/hd_posters/{}.jpg'

		try:
			movie_url = self.search(film_name)
			image_url = self.get_image_url(movie_url)
			image_src = self.get_image_src(image_url)
			imageUtils.write_image_to_file(image_src, image_path.format(imdb_id))
		except Exception as e:
			print('ERROR: Failed to find poster for: ', film_name)
			print(e)
			traceback.print_exc()
コード例 #2
0
ファイル: Cinematerial.py プロジェクト: DavidLekei/movr-api
	def get_posters(self, file):
		imageUtils = ImageUtils()
		image_path = '../res/hd_posters/{}.jpg'
		try:
			movie_list = open(file, 'r', encoding='utf-8')
		except:
			print('Could Not Open File: ', file)
			sys.exit()
		with movie_list:
			print('Reading From File: ', file)
			count = 0
			for movie in movie_list:
				#Assume that the movie only exists once
				try:
					movie_url = self.search(movie)
					image_url = self.get_image_url(movie_url)
					image_src = self.get_image_src(image_url)
					imageUtils.write_image_to_file(image_src, image_path.format(count))
					count = count + 1
				except:
					pass