fix miruro
This commit is contained in:
1 parent
7c58cec433
commit
f502283d6c
3 files changed
+26
-10
No files matched your search
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "Nuvio Providers",
|
"name": "Nuvio Providers",
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"scrapers": [
|
"scrapers": [
|
||||||
{
|
{
|
||||||
"id": "miruro",
|
"id": "miruro",
|
||||||
"name": "Miruro",
|
"name": "Miruro",
|
||||||
"description": "Anime streams from Miruro with subbed and dubbed sources.",
|
"description": "Anime streams from Miruro with subbed and dubbed sources.",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"author": "Jānis L",
|
"author": "Jānis L",
|
||||||
"supportedTypes": [
|
"supportedTypes": [
|
||||||
"movie",
|
"movie",
|
||||||
|
|||||||
+11
-4
@@ -558,6 +558,12 @@ function asNumber(value) {
|
|||||||
const number = Number(value);
|
const number = Number(value);
|
||||||
return Number.isFinite(number) ? number : null;
|
return Number.isFinite(number) ? number : null;
|
||||||
}
|
}
|
||||||
|
function asArray(value) {
|
||||||
|
if (value == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return Array.isArray(value) ? value : [value];
|
||||||
|
}
|
||||||
function parseIdentifier(value) {
|
function parseIdentifier(value) {
|
||||||
const id = String(value || "").trim();
|
const id = String(value || "").trim();
|
||||||
if (/^tt\d+$/i.test(id)) {
|
if (/^tt\d+$/i.test(id)) {
|
||||||
@@ -571,11 +577,12 @@ function parseIdentifier(value) {
|
|||||||
function recordMatchesIdentifier(record, identifier, mediaType) {
|
function recordMatchesIdentifier(record, identifier, mediaType) {
|
||||||
const expectedType = mediaType === "movie" ? "movie" : "tv";
|
const expectedType = mediaType === "movie" ? "movie" : "tv";
|
||||||
if (identifier.service === "imdb") {
|
if (identifier.service === "imdb") {
|
||||||
const imdbMatches = (record.imdb_id || []).some((id) => String(id).toLowerCase() === identifier.value);
|
const imdbMatches = asArray(record.imdb_id).some((id) => String(id).toLowerCase() === identifier.value);
|
||||||
const typeMatches = (record.tmdb_id || []).length === 0 || (record.tmdb_id || []).some((mapping) => mapping.type === expectedType);
|
const tmdbMappings = asArray(record.tmdb_id);
|
||||||
|
const typeMatches = tmdbMappings.length === 0 || tmdbMappings.some((mapping) => mapping.type === expectedType);
|
||||||
return imdbMatches && typeMatches;
|
return imdbMatches && typeMatches;
|
||||||
}
|
}
|
||||||
return (record.tmdb_id || []).some((mapping) => String(mapping.id) === identifier.value && mapping.type === expectedType);
|
return asArray(record.tmdb_id).some((mapping) => String(mapping.id) === identifier.value && mapping.type === expectedType);
|
||||||
}
|
}
|
||||||
function getAniListIds(records, identifier, mediaType) {
|
function getAniListIds(records, identifier, mediaType) {
|
||||||
const ids = [];
|
const ids = [];
|
||||||
@@ -584,7 +591,7 @@ function getAniListIds(records, identifier, mediaType) {
|
|||||||
if (!recordMatchesIdentifier(record, identifier, mediaType)) {
|
if (!recordMatchesIdentifier(record, identifier, mediaType)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (const id of record.anilist_id || []) {
|
for (const id of asArray(record.anilist_id)) {
|
||||||
const numericId = asNumber(id);
|
const numericId = asNumber(id);
|
||||||
if (numericId && !ids.includes(numericId)) {
|
if (numericId && !ids.includes(numericId)) {
|
||||||
ids.push(numericId);
|
ids.push(numericId);
|
||||||
|
|||||||
+13
-4
@@ -24,6 +24,14 @@ function asNumber(value) {
|
|||||||
return Number.isFinite(number) ? number : null;
|
return Number.isFinite(number) ? number : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asArray(value) {
|
||||||
|
if (value == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.isArray(value) ? value : [value];
|
||||||
|
}
|
||||||
|
|
||||||
function parseIdentifier(value) {
|
function parseIdentifier(value) {
|
||||||
const id = String(value || '').trim();
|
const id = String(value || '').trim();
|
||||||
|
|
||||||
@@ -42,17 +50,18 @@ function recordMatchesIdentifier(record, identifier, mediaType) {
|
|||||||
const expectedType = mediaType === 'movie' ? 'movie' : 'tv';
|
const expectedType = mediaType === 'movie' ? 'movie' : 'tv';
|
||||||
|
|
||||||
if (identifier.service === 'imdb') {
|
if (identifier.service === 'imdb') {
|
||||||
const imdbMatches = (record.imdb_id || []).some((id) => (
|
const imdbMatches = asArray(record.imdb_id).some((id) => (
|
||||||
String(id).toLowerCase() === identifier.value
|
String(id).toLowerCase() === identifier.value
|
||||||
));
|
));
|
||||||
const typeMatches = (record.tmdb_id || []).length === 0 || (record.tmdb_id || []).some((mapping) => (
|
const tmdbMappings = asArray(record.tmdb_id);
|
||||||
|
const typeMatches = tmdbMappings.length === 0 || tmdbMappings.some((mapping) => (
|
||||||
mapping.type === expectedType
|
mapping.type === expectedType
|
||||||
));
|
));
|
||||||
|
|
||||||
return imdbMatches && typeMatches;
|
return imdbMatches && typeMatches;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (record.tmdb_id || []).some((mapping) => (
|
return asArray(record.tmdb_id).some((mapping) => (
|
||||||
String(mapping.id) === identifier.value && mapping.type === expectedType
|
String(mapping.id) === identifier.value && mapping.type === expectedType
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -70,7 +79,7 @@ function getAniListIds(records, identifier, mediaType) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const id of record.anilist_id || []) {
|
for (const id of asArray(record.anilist_id)) {
|
||||||
const numericId = asNumber(id);
|
const numericId = asNumber(id);
|
||||||
|
|
||||||
if (numericId && !ids.includes(numericId)) {
|
if (numericId && !ids.includes(numericId)) {
|
||||||
|
|||||||
Reference in new issue
Block a user