From 05c97669f8f1ccfe2a117398abe13eee4a6efe46 Mon Sep 17 00:00:00 2001 From: viarotel Date: Thu, 7 Nov 2024 15:16:02 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E2=9E=96=20Remove=20redundant=20comme?= =?UTF-8?q?nts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/exposes/scrcpy/helper.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/electron/exposes/scrcpy/helper.js b/electron/exposes/scrcpy/helper.js index c47bdad..3a8cf4c 100644 --- a/electron/exposes/scrcpy/helper.js +++ b/electron/exposes/scrcpy/helper.js @@ -69,31 +69,25 @@ export function parseScrcpyCodecList(rawText) { audio: [], } - // 分行处理 const lines = rawText.split('\n') - // 遍历每一行 for (const line of lines) { const trimmedLine = line.trim() - // 跳过空行和不包含编码器信息的行 if (!trimmedLine || !trimmedLine.startsWith('--')) { continue } - // 提取所有的键值对 const pairs = trimmedLine.match(/--[\w-]+=[\w.-]+/g) if (!pairs || pairs.length < 2) continue - // 将键值对转换为对象 const info = pairs.reduce((acc, pair) => { const [key, value] = pair.substring(2).split('=') acc[key] = value return acc }, {}) - // 根据键名判断类型并保存数据 if (info['video-codec'] && info['video-encoder']) { result.video.push({ type: 'video', @@ -110,7 +104,6 @@ export function parseScrcpyCodecList(rawText) { } } - // 验证结果是否为空 if (result.video.length === 0 && result.audio.length === 0) { throw new Error('No valid codec information found in the log content') }