From 3bc8da509d4dd903ce1efc7a7e6d33b1e11aa8b5 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Wed, 15 Apr 2020 12:32:21 +0200 Subject: [PATCH] [addon] excludes resolution from cam/ts sources --- addon/lib/streamInfo.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addon/lib/streamInfo.js b/addon/lib/streamInfo.js index 1b3c385..656b6a9 100644 --- a/addon/lib/streamInfo.js +++ b/addon/lib/streamInfo.js @@ -21,13 +21,7 @@ function toStreamInfo(record) { const name = joinDetailParts( [ joinDetailParts([ADDON_NAME]), - joinDetailParts([ - fileInfo.resolution || - torrentInfo.resolution || - record.torrent.resolution || - fileInfo.source || - torrentInfo.source - ]) + joinDetailParts([getQuality(record, fileInfo, torrentInfo)]) ], '', '\n' @@ -41,6 +35,15 @@ function toStreamInfo(record) { }; } +function getQuality(record, fileInfo, torrentInfo) { + const resolution = fileInfo.resolution || torrentInfo.resolution || record.torrent.resolution; + const source = fileInfo.source || torrentInfo.source; + if (['CAM', 'TeleSync'].includes(source)) { + return source; + } + return resolution || source; +} + function joinDetailParts(parts, prefix = '', delimiter = ' ') { const filtered = parts.filter((part) => part !== undefined && part !== null).join(delimiter);