Merge pull request #2839 from lbryio/file_analysis_join_path

use `os.path.join()` instead of string addition when searching for file analysis binaries
This commit is contained in:
Lex Berezhny 2020-03-03 10:48:06 -05:00 committed by GitHub
commit 3d4938c0e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,8 +23,10 @@ class VideoFileAnalyzer:
async def _execute(self, command, arguments): async def _execute(self, command, arguments):
args = shlex.split(arguments) args = shlex.split(arguments)
process = await asyncio.create_subprocess_exec(self._conf.ffmpeg_folder + command, *args, process = await asyncio.create_subprocess_exec(
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) os.path.join(self._conf.ffmpeg_folder, command), *args,
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await process.communicate() # returns when the streams are closed stdout, stderr = await process.communicate() # returns when the streams are closed
return stdout.decode(errors='replace') + stderr.decode(errors='replace'), process.returncode return stdout.decode(errors='replace') + stderr.decode(errors='replace'), process.returncode
@ -45,7 +47,7 @@ class VideoFileAnalyzer:
return return
await self._verify_executable("ffprobe") await self._verify_executable("ffprobe")
version = await self._verify_executable("ffmpeg") version = await self._verify_executable("ffmpeg")
self._which = shutil.which(f"{self._conf.ffmpeg_folder}ffmpeg") self._which = shutil.which("ffmpeg")
self._ffmpeg_installed = True self._ffmpeg_installed = True
log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which) log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which)