Add linter and minor bug fixes (#107)

This commit is contained in:
Simon Lecoq
2021-02-05 23:45:48 +01:00
committed by GitHub
parent 61e2f6e1a1
commit 882a93dea5
74 changed files with 1544 additions and 712 deletions

View File

@@ -1,5 +1,5 @@
//Setup
export default async function ({login, data, queries, imports, q, account}, {enabled = false} = {}) {
export default async function({login, data, queries, imports, q, account}, {enabled = false} = {}) {
//Plugin execution
try {
//Check if plugin is enabled and requirements are met
@@ -31,7 +31,7 @@
//Format and save results
for (const {name, entries} of lists) {
//Format results
const list = await Promise.all(entries.map(async media => await format({media, imports})))
const list = await Promise.all(entries.map(media => format({media, imports})))
result.lists[type][name.toLocaleLowerCase()] = shuffle ? imports.shuffle(list) : list
//Limit results
if (limit > 0) {
@@ -131,7 +131,7 @@
}
}
/** Media formatter */
/**Media formatter */
async function format({media, imports}) {
const {progress, score:userScore, media:{title, description, status, startDate:{year:release}, genres, averageScore, episodes, chapters, type, coverImage:{medium:artwork}}} = media
return {
@@ -140,6 +140,6 @@
description:description.replace(/<br\s*\\?>/g, " "),
scores:{user:userScore, community:averageScore},
released:type === "ANIME" ? episodes : chapters,
artwork:artwork ? await imports.imgb64(artwork) : "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg=="
artwork:artwork ? await imports.imgb64(artwork) : "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
}
}

View File

@@ -28,6 +28,7 @@ inputs:
type: array
format: comma-separated
default: favorites
example: favorites, watching, characters
values:
- favorites # Favorites animes and mangas (depending on plugin_anilist_medias values)
- watching # Animes in your watching list