From 501fbd3114e80556c4c3f06dca8f0efb86248db3 Mon Sep 17 00:00:00 2001 From: Brannon King Date: Fri, 7 Feb 2020 13:27:51 -0700 Subject: [PATCH 1/2] handle strange file metadata --- lbry/file_analysis.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lbry/file_analysis.py b/lbry/file_analysis.py index baf62b499..f6fd0706f 100644 --- a/lbry/file_analysis.py +++ b/lbry/file_analysis.py @@ -25,7 +25,7 @@ class VideoFileAnalyzer: process = await asyncio.create_subprocess_exec(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 - return stdout.decode() + stderr.decode(), process.returncode + return stdout.decode(errors='replace') + stderr.decode(errors='replace'), process.returncode async def _verify_executable(self, name): try: @@ -119,10 +119,9 @@ class VideoFileAnalyzer: return "" result, _ = await self._execute("ffprobe", f'-v debug "{video_file}"') - iterator = re.finditer(r"\s+seeks:(\d+)\s+", result) - for match in iterator: - if int(match.group(1)) != 0: - return "Video stream descriptors are not at the start of the file (the faststart flag was not used)." + match = re.search(r"Before avformat_find_stream_info.+?\s+seeks:(\d+)\s+", result) + if match and int(match.group(1)) != 0: + return "Video stream descriptors are not at the start of the file (the faststart flag was not used)." return "" @staticmethod From e53209e5ae81d550bdc90dca62341e025e10de83 Mon Sep 17 00:00:00 2001 From: Brannon King Date: Fri, 7 Feb 2020 13:29:27 -0700 Subject: [PATCH 2/2] handle early lbrycrd exit in tests --- lbry/wallet/orchstr8/node.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lbry/wallet/orchstr8/node.py b/lbry/wallet/orchstr8/node.py index 24dfb6def..44a190814 100644 --- a/lbry/wallet/orchstr8/node.py +++ b/lbry/wallet/orchstr8/node.py @@ -228,6 +228,7 @@ class BlockchainProcess(asyncio.SubprocessProtocol): def process_exited(self): self.stopped.set() + self.ready.set() class BlockchainNode: @@ -315,6 +316,7 @@ class BlockchainNode: BlockchainProcess, *command ) await self.protocol.ready.wait() + assert not self.protocol.stopped.is_set() async def stop(self, cleanup=True): try: