mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] adds filtering based on provider
This commit is contained in:
@@ -174,8 +174,6 @@ button:active {
|
||||
const { Providers } = require('./manifest');
|
||||
|
||||
function landingTemplate(manifest, providers = [], realDebridApiKey = '') {
|
||||
console.log(providers);
|
||||
console.log(realDebridApiKey);
|
||||
const background = manifest.background || 'https://dl.strem.io/addon-background.jpg';
|
||||
const logo = manifest.logo || 'https://dl.strem.io/addon-logo.png';
|
||||
const contactHTML = manifest.contactEmail ?
|
||||
@@ -254,7 +252,7 @@ function landingTemplate(manifest, providers = [], realDebridApiKey = '') {
|
||||
const providersValue = $('#iProviders').val().join(',');
|
||||
const realDebridValue = $('#iRealDebrid').val();
|
||||
const providers = providersValue && providersValue.length ? 'providers=' + providersValue : '';
|
||||
const realDebrid = realDebridValue && realDebridValue.length ? 'realrebrid='+realDebridValue : '';
|
||||
const realDebrid = realDebridValue && realDebridValue.length ? 'realdebrid=' + realDebridValue : '';
|
||||
const configurationValue = [providers, realDebrid].filter(value => value.length).join('|');
|
||||
const configuration = configurationValue && configurationValue.length ? '/' + configurationValue : '';
|
||||
installLink.href = 'stremio://' + window.location.host + configuration + '/manifest.json';
|
||||
|
||||
@@ -6,10 +6,10 @@ const Providers = [
|
||||
'HorribleSubs'
|
||||
];
|
||||
|
||||
function manifest(providers, realDebridApiKey) {
|
||||
function manifest({ providers, realdebrid } = {}) {
|
||||
const providersList = Array.isArray(providers) && providers.map(provider => getProvider(provider)) || Providers;
|
||||
const providersDesc = providers && providers.length ? 'Enabled providers -' : 'Currently supports';
|
||||
const realDebridDesc = realDebridApiKey ? ' and RealdDebrid enabled' : '';
|
||||
const realDebridDesc = realdebrid ? ' and RealDebrid enabled' : '';
|
||||
return {
|
||||
id: 'com.stremio.torrentio.addon',
|
||||
version: '0.0.1-beta',
|
||||
|
||||
@@ -10,6 +10,16 @@ function toStreamInfo(record) {
|
||||
return seriesStream(record);
|
||||
}
|
||||
|
||||
function sanitizeStreamInfo(stream) {
|
||||
if (stream.filters) {
|
||||
delete stream.filters;
|
||||
}
|
||||
if (stream.fileIdx === undefined || stream.fileIdx === null) {
|
||||
delete stream.fileIdx;
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
function movieStream(record) {
|
||||
const titleInfo = titleParser.parse(record.title);
|
||||
const sameInfo = record.title === record.torrent.title;
|
||||
@@ -28,6 +38,12 @@ function movieStream(record) {
|
||||
name: `${ADDON_NAME}\n${record.torrent.provider}`,
|
||||
title: title,
|
||||
infoHash: record.infoHash,
|
||||
fileIdx: record.fileIndex,
|
||||
filters: {
|
||||
quality: titleInfo.resolution || record.torrent.resolution || titleInfo.source,
|
||||
seeders: record.torrent.seeders,
|
||||
uploadDate: new Date(record.torrent.uploadDate)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,6 +71,11 @@ function seriesStream(record) {
|
||||
title: title,
|
||||
infoHash: record.infoHash,
|
||||
fileIdx: record.fileIndex,
|
||||
filters: {
|
||||
quality: tInfo.resolution || eInfo.resolution || record.torrent.resolution || tInfo.source || eInfo.source,
|
||||
seeders: record.torrent.seeders,
|
||||
uploadDate: new Date(record.torrent.uploadDate)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,4 +85,4 @@ function joinDetailParts(parts, prefix = '', delimiter = ' ') {
|
||||
return filtered.length > 0 ? `${prefix}${filtered}` : undefined;
|
||||
}
|
||||
|
||||
module.exports = { toStreamInfo };
|
||||
module.exports = { toStreamInfo, sanitizeStreamInfo };
|
||||
|
||||
Reference in New Issue
Block a user