|
|
|
@ -162,6 +162,59 @@ module.exports.Search = class Search
|
|
|
|
|
}
|
|
|
|
|
return this.results
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* SLOWER
|
|
|
|
|
* @returns {Array<Results>}
|
|
|
|
|
* @typedef {Object} Results
|
|
|
|
|
* @property {Array<Manga>} Results
|
|
|
|
|
* @property {Scanlator} scanlator
|
|
|
|
|
* @typedef {Object} Manga
|
|
|
|
|
* @property {String} link - Manga Link
|
|
|
|
|
* @property {String} title - Manga Title
|
|
|
|
|
* @property {String} img - Image Link
|
|
|
|
|
* @property {Array<String>} tags - Manga Tags
|
|
|
|
|
* @typedef {String} Scanlator
|
|
|
|
|
* @pattern /^[\w-]+-scans$/
|
|
|
|
|
*/
|
|
|
|
|
async searchExtraInfo()
|
|
|
|
|
{
|
|
|
|
|
await this.initialized;
|
|
|
|
|
if(this.Modules.length==0) return
|
|
|
|
|
for(const module of this.Modules)
|
|
|
|
|
{
|
|
|
|
|
const auxModule = new module()
|
|
|
|
|
if(!this.scanlator || this.scanlator == auxModule.scanlator )
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var results = await auxModule.Search(this.ss);
|
|
|
|
|
//TODO: Defaults for missing info from the modules;
|
|
|
|
|
// console.log('Lib: Search: search method: result:', result);
|
|
|
|
|
for(let i = 0; i<results.length; i++)
|
|
|
|
|
{
|
|
|
|
|
const manga = await auxModule.GetManga(results[i].link, results[i].title);
|
|
|
|
|
results[i]['tags'] = manga.tags;
|
|
|
|
|
results[i]['description'] = manga.description;
|
|
|
|
|
}
|
|
|
|
|
results.sort((a, b) => {
|
|
|
|
|
if (a.title.toUpperCase() < b.title.toUpperCase()) return -1;
|
|
|
|
|
else return 1;
|
|
|
|
|
});
|
|
|
|
|
for(var i = 0; i< results.length; i++)
|
|
|
|
|
{
|
|
|
|
|
results[i]['Status'] = results[i].status;
|
|
|
|
|
}
|
|
|
|
|
this.results.push({
|
|
|
|
|
Results:results,
|
|
|
|
|
scanlator:auxModule.scanlator
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (error)
|
|
|
|
|
{
|
|
|
|
|
console.error('Lib: Module Errored:', auxModule.scanlator, 'Error:', error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this.results
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
module.exports.SearchByTag = class SearchByTag
|
|
|
|
|