mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-04-21 11:01:55 +00:00
[addon] compare size with delta instead of equality
This commit is contained in:
parent
c2389cd9e9
commit
940954bb19
1 changed files with 2 additions and 2 deletions
|
|
@ -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, ' ')]),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue