Let helpers.generate_*_thumbnail raise FileNotFoundError.
This commit is contained in:
		
							parent
							
								
									8fdbd49f70
								
							
						
					
					
						commit
						0ccfa74709
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -156,6 +156,8 @@ def fit_into_bounds(image_width, image_height, frame_width, frame_height): | ||||||
|     return (new_width, new_height) |     return (new_width, new_height) | ||||||
| 
 | 
 | ||||||
| def generate_image_thumbnail(filepath, width, height): | def generate_image_thumbnail(filepath, width, height): | ||||||
|  |     if not os.path.isfile(filepath): | ||||||
|  |         raise FileNotFoundError(filepath) | ||||||
|     image = PIL.Image.open(filepath) |     image = PIL.Image.open(filepath) | ||||||
|     (image_width, image_height) = image.size |     (image_width, image_height) = image.size | ||||||
|     (new_width, new_height) = fit_into_bounds( |     (new_width, new_height) = fit_into_bounds( | ||||||
|  | @ -183,6 +185,8 @@ def generate_image_thumbnail(filepath, width, height): | ||||||
|     return image |     return image | ||||||
| 
 | 
 | ||||||
| def generate_video_thumbnail(filepath, outfile, width, height, **special): | def generate_video_thumbnail(filepath, outfile, width, height, **special): | ||||||
|  |     if not os.path.isfile(filepath): | ||||||
|  |         raise FileNotFoundError(filepath) | ||||||
|     probe = constants.ffmpeg.probe(filepath) |     probe = constants.ffmpeg.probe(filepath) | ||||||
|     if not probe.video: |     if not probe.video: | ||||||
|         return False |         return False | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue