mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] compare size with delta instead of equality
This commit is contained in:
@@ -3,13 +3,13 @@ const { Type } = require('./types');
|
|||||||
const { mapLanguages } = require('./languages');
|
const { mapLanguages } = require('./languages');
|
||||||
|
|
||||||
const ADDON_NAME = 'Torrentio';
|
const ADDON_NAME = 'Torrentio';
|
||||||
|
const SIZE_DELTA = 0.02;
|
||||||
const UNKNOWN_SIZE = 300000000;
|
const UNKNOWN_SIZE = 300000000;
|
||||||
|
|
||||||
function toStreamInfo(record) {
|
function toStreamInfo(record) {
|
||||||
const torrentInfo = titleParser.parse(record.torrent.title);
|
const torrentInfo = titleParser.parse(record.torrent.title);
|
||||||
const fileInfo = titleParser.parse(record.title);
|
const fileInfo = titleParser.parse(record.title);
|
||||||
const sameInfo = !Number.isInteger(record.fileIndex)
|
const sameInfo = !Number.isInteger(record.fileIndex) || Math.abs(record.size / record.torrent.size - 1) < SIZE_DELTA;
|
||||||
|| record.size !== UNKNOWN_SIZE && record.size === record.torrent.size;
|
|
||||||
const title = joinDetailParts(
|
const title = joinDetailParts(
|
||||||
[
|
[
|
||||||
joinDetailParts([record.torrent.title.replace(/[, ]+/g, ' ')]),
|
joinDetailParts([record.torrent.title.replace(/[, ]+/g, ' ')]),
|
||||||
|
|||||||
Reference in New Issue
Block a user