return binge group for movies

This commit is contained in:
TheBeastLT
2022-03-13 19:36:26 +01:00
parent 29b232318e
commit cd541d68b2
5 changed files with 3638 additions and 40 deletions

View File

@@ -42,10 +42,9 @@ function toStreamInfo(record) {
'', '',
'\n' '\n'
); );
const bingeGroupParts = getBingeGroupParts(record, sameInfo, quality, torrentInfo, fileInfo);
const behaviorHints = { const behaviorHints = {
bingeGroup: sameInfo bingeGroup: joinDetailParts(bingeGroupParts, "torrentio|", "|")
? `torrentio|${quality}|${fileInfo.group}`
: `torrentio|${record.infoHash}`
}; };
return cleanOutputObject({ return cleanOutputObject({
@@ -53,7 +52,7 @@ function toStreamInfo(record) {
title: title, title: title,
infoHash: record.infoHash, infoHash: record.infoHash,
fileIdx: record.fileIndex, fileIdx: record.fileIndex,
behaviorHints: record.torrent.type !== Type.MOVIE ? behaviorHints : null, behaviorHints: behaviorHints,
sources: getSources(record.torrent.trackers, record.infoHash) sources: getSources(record.torrent.trackers, record.infoHash)
}); });
} }
@@ -133,7 +132,22 @@ function getSources(trackersInput, infoHash) {
return null; return null;
} }
const trackers = Array.isArray(trackersInput) ? trackersInput : trackersInput.split(','); const trackers = Array.isArray(trackersInput) ? trackersInput : trackersInput.split(',');
return trackers.map(tracker => `tracker:${tracker}`).concat(`dht:${infoHash}`) return trackers.map(tracker => `tracker:${tracker}`).concat(`dht:${infoHash}`);
}
function getBingeGroupParts(record, sameInfo, quality, torrentInfo, fileInfo) {
if (record.torrent.type === Type.MOVIE) {
const source = torrentInfo.source || fileInfo.source
return [
quality,
source !== quality ? source : undefined,
torrentInfo.codec || fileInfo.codec,
torrentInfo.bitDepth || fileInfo.bitDepth
];
} else if (sameInfo) {
return [quality, fileInfo.group];
}
return [record.infoHash];
} }
function cleanOutputObject(object) { function cleanOutputObject(object) {

3634
addon/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,7 @@
"https-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0",
"magnet-uri": "^6.2.0", "magnet-uri": "^6.2.0",
"named-queue": "^2.2.1", "named-queue": "^2.2.1",
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#8fd87b3bfc7aa04143edcd4f0112868bb77dce0f", "parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#eb390fcfc257950e65ec1b0812bd331765a053c9",
"pg": "^8.7.1", "pg": "^8.7.1",
"pg-hstore": "^2.3.4", "pg-hstore": "^2.3.4",
"premiumize-api": "^1.0.3", "premiumize-api": "^1.0.3",

16
package-lock.json generated
View File

@@ -30,7 +30,7 @@
"nodejs-bing": "^0.1.0", "nodejs-bing": "^0.1.0",
"nyaapi": "^2.3.3", "nyaapi": "^2.3.3",
"parse-torrent": "^6.1.2", "parse-torrent": "^6.1.2",
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#8fd87b3bfc7aa04143edcd4f0112868bb77dce0f", "parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#eb390fcfc257950e65ec1b0812bd331765a053c9",
"pg": "^8.7.1", "pg": "^8.7.1",
"pg-hstore": "^2.3.4", "pg-hstore": "^2.3.4",
"rss-parser": "^3.12.0", "rss-parser": "^3.12.0",
@@ -2420,9 +2420,12 @@
"integrity": "sha1-gR7WR8ARiUXkG7S7veqaLHihcIM=" "integrity": "sha1-gR7WR8ARiUXkG7S7veqaLHihcIM="
}, },
"node_modules/parse-torrent-title": { "node_modules/parse-torrent-title": {
"resolved": "git+ssh://git@github.com/TheBeastLT/parse-torrent-title.git#8fd87b3bfc7aa04143edcd4f0112868bb77dce0f", "version": "1.3.0",
"resolved": "git+ssh://git@github.com/TheBeastLT/parse-torrent-title.git#eb390fcfc257950e65ec1b0812bd331765a053c9",
"integrity": "sha512-flPYfe/dOYzmay2ZP613A1t9SzoIJoZuqvo+/ijg9aTEjxvWbg5sbEZtsHm8qwf7KXfXJ4SjR4hIzLQ2cu/AGA==",
"license": "MIT",
"dependencies": { "dependencies": {
"moment": "2.29.1" "moment": "^2.24.0"
}, },
"engines": { "engines": {
"node": ">=10" "node": ">=10"
@@ -6016,10 +6019,11 @@
} }
}, },
"parse-torrent-title": { "parse-torrent-title": {
"version": "git+ssh://git@github.com/TheBeastLT/parse-torrent-title.git#8fd87b3bfc7aa04143edcd4f0112868bb77dce0f", "version": "git+ssh://git@github.com/TheBeastLT/parse-torrent-title.git#eb390fcfc257950e65ec1b0812bd331765a053c9",
"from": "parse-torrent-title@git://github.com/TheBeastLT/parse-torrent-title.git#8fd87b3bfc7aa04143edcd4f0112868bb77dce0f", "integrity": "sha512-flPYfe/dOYzmay2ZP613A1t9SzoIJoZuqvo+/ijg9aTEjxvWbg5sbEZtsHm8qwf7KXfXJ4SjR4hIzLQ2cu/AGA==",
"from": "parse-torrent-title@git://github.com/TheBeastLT/parse-torrent-title.git#eb390fcfc257950e65ec1b0812bd331765a053c9",
"requires": { "requires": {
"moment": "2.29.1" "moment": "^2.24.0"
} }
}, },
"parse5": { "parse5": {

View File

@@ -29,7 +29,7 @@
"nodejs-bing": "^0.1.0", "nodejs-bing": "^0.1.0",
"nyaapi": "^2.3.3", "nyaapi": "^2.3.3",
"parse-torrent": "^6.1.2", "parse-torrent": "^6.1.2",
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#8fd87b3bfc7aa04143edcd4f0112868bb77dce0f", "parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#eb390fcfc257950e65ec1b0812bd331765a053c9",
"pg": "^8.7.1", "pg": "^8.7.1",
"pg-hstore": "^2.3.4", "pg-hstore": "^2.3.4",
"rss-parser": "^3.12.0", "rss-parser": "^3.12.0",