Added Meiden van Holland and Vurig Vlaanderen.
This commit is contained in:
25
src/media.js
25
src/media.js
@@ -163,7 +163,7 @@ function toBaseSource(rawSource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (rawSource.match(/.m3u8$/)) {
|
||||
if (new URL(rawSource).pathname.match(/.m3u8$/)) {
|
||||
return {
|
||||
src: rawSource,
|
||||
stream: rawSource,
|
||||
@@ -175,6 +175,12 @@ function toBaseSource(rawSource) {
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof rawSource === 'function') {
|
||||
return {
|
||||
defer: rawSource,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -266,12 +272,12 @@ async function findSourceDuplicates(baseMedias) {
|
||||
.filter(Boolean);
|
||||
|
||||
const extractUrls = baseMedias
|
||||
.map((baseMedia) => baseMedia.sources.map((source) => source.url))
|
||||
.map((baseMedia) => baseMedia.sources.map((source) => source.extract))
|
||||
.flat()
|
||||
.filter(Boolean);
|
||||
|
||||
const [existingSourceMedia, existingExtractMedia] = await Promise.all([
|
||||
// my try to check thousands of URLs at once, don't pass all of them to a single query
|
||||
// may try to check thousands of URLs at once, don't pass all of them to a single query
|
||||
chunk(sourceUrls).reduce(async (chain, sourceUrlsChunk) => {
|
||||
const accUrls = await chain;
|
||||
const existingUrls = await knex('media').whereIn('source', sourceUrlsChunk);
|
||||
@@ -344,6 +350,17 @@ async function findHashDuplicates(medias) {
|
||||
}
|
||||
|
||||
async function extractSource(baseSource, { existingExtractMediaByUrl }) {
|
||||
if (typeof baseSource.defer === 'function') {
|
||||
const src = await baseSource.defer();
|
||||
|
||||
console.log('DEFERED', src);
|
||||
|
||||
return {
|
||||
...baseSource,
|
||||
...toBaseSource(src),
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof baseSource.extract !== 'function' || !baseSource.url) {
|
||||
return baseSource;
|
||||
}
|
||||
@@ -365,7 +382,7 @@ async function extractSource(baseSource, { existingExtractMediaByUrl }) {
|
||||
|
||||
return {
|
||||
...baseSource,
|
||||
src,
|
||||
...toBaseSource(src),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user