mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-04 03:27:14 -05:00 
			
		
		
		
	Prevent the scanner from running on non-video files
This commit is contained in:
		
							parent
							
								
									5acd231292
								
							
						
					
					
						commit
						bb716ab6b6
					
				@ -41,9 +41,15 @@ class Scanner:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@log_errors
 | 
						@log_errors
 | 
				
			||||||
	async def identify(self, path: Path):
 | 
						async def identify(self, path: Path):
 | 
				
			||||||
		if await self.is_registered(path):
 | 
					 | 
				
			||||||
			return
 | 
					 | 
				
			||||||
		raw = guessit(path, "--episode-prefer-number")
 | 
							raw = guessit(path, "--episode-prefer-number")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (
 | 
				
			||||||
 | 
								not "mimetype" in raw
 | 
				
			||||||
 | 
								or not raw["mimetype"].startswith("video")
 | 
				
			||||||
 | 
								or await self.is_registered(path)
 | 
				
			||||||
 | 
							):
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		logging.info("Identied %s: %s", path, raw)
 | 
							logging.info("Identied %s: %s", path, raw)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# TODO: Add collections support
 | 
							# TODO: Add collections support
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user