hide ValueError

This commit is contained in:
Brannon King 2020-03-03 17:27:07 -07:00
parent a3294d4a0d
commit e060df5367
2 changed files with 10 additions and 8 deletions

View file

@ -3142,11 +3142,8 @@ class Daemon(metaclass=JSONRPCServerType):
f"Use --allow-duplicate-name flag to override."
)
try:
file_path = await self._video_file_analyzer.verify_or_repair(validate_file, optimize_file, file_path)
except ValueError:
pass # it's not a video file
file_path = await self._video_file_analyzer.verify_or_repair(validate_file, optimize_file,
file_path, ignore_non_video=True)
claim = Claim()
claim.stream.update(file_path=file_path, sd_hash='0' * 96, **kwargs)
tx = await Transaction.claim_create(

View file

@ -47,7 +47,7 @@ class VideoFileAnalyzer:
return
await self._verify_executable("ffprobe")
version = await self._verify_executable("ffmpeg")
self._which = shutil.which("ffmpeg")
self._which = shutil.which(os.path.join(self._conf.ffmpeg_folder, "ffmpeg"))
self._ffmpeg_installed = True
log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which)
@ -286,12 +286,17 @@ class VideoFileAnalyzer:
return scan_data
async def verify_or_repair(self, validate, repair, file_path):
async def verify_or_repair(self, validate, repair, file_path, ignore_non_video=False):
if not validate and not repair:
return file_path
await self._verify_ffmpeg_installed()
scan_data = await self._get_scan_data(validate, file_path)
try:
scan_data = await self._get_scan_data(validate, file_path)
except ValueError:
if ignore_non_video:
return file_path
raise
fast_start_msg = await self._verify_fast_start(scan_data, file_path)
log.debug("Analyzing %s:", file_path)