From 1619ccf0f771da40fe64dd60142b412be4667d59 Mon Sep 17 00:00:00 2001 From: Batorian Date: Sun, 25 Aug 2024 23:04:37 +0200 Subject: [PATCH 1/5] novel-updates-rating: add rating to novels --- src/plugins/english/novelupdates.ts | 10 +++++++++- src/types/plugin.ts | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/english/novelupdates.ts b/src/plugins/english/novelupdates.ts index a61062103..b0195d2b6 100644 --- a/src/plugins/english/novelupdates.ts +++ b/src/plugins/english/novelupdates.ts @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin'; class NovelUpdates implements Plugin.PluginBase { id = 'novelupdates'; name = 'Novel Updates'; - version = '0.7.4'; + version = '0.8.0'; icon = 'src/en/novelupdates/icon.png'; customCSS = 'src/en/novelupdates/customCSS.css'; site = 'https://www.novelupdates.com/'; @@ -139,6 +139,14 @@ class NovelUpdates implements Plugin.PluginBase { novel.summary = summary + `\n\nType: ${type}`; + const rating = loadedCheerio('.seriesother .uvotes') + .text() + .match(/(\d+\.\d+) \/ \d+\.\d+/)?.[1]; + + if (rating) { + novel.rating = parseFloat(rating); + } + const chapter: Plugin.ChapterItem[] = []; const novelId = loadedCheerio('input#mypostid').attr('value')!; diff --git a/src/types/plugin.ts b/src/types/plugin.ts index 83d456ef5..2a59fba20 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -1,5 +1,7 @@ import { FilterToValues, Filters } from '@libs/filterInputs'; +import { util } from 'protobufjs'; export namespace Plugin { + import float = util.float; export type ChapterItem = { name: string; path: string; @@ -30,6 +32,7 @@ export namespace Plugin { author?: string; artist?: string; status?: string; + rating?: number; chapters?: ChapterItem[]; } & NovelItem; From f82c11a34217968b470a2974e9b9493bb6295ad4 Mon Sep 17 00:00:00 2001 From: Batorian Date: Sun, 25 Aug 2024 23:57:17 +0200 Subject: [PATCH 2/5] novel-updates-rating: update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b61cc3175..0b005a6d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lnreader-plugins", - "version": "3.0.0", + "version": "3.0.1", "description": "Plugins repo for LNReader", "main": "index.js", "type": "module", From 14b90b397f054d2c96105b2624adfcf23ce79689 Mon Sep 17 00:00:00 2001 From: Batorian Date: Mon, 26 Aug 2024 17:59:16 +0200 Subject: [PATCH 3/5] novel-updates-rating: revert version --- package.json | 2 +- src/types/plugin.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b005a6d9..b61cc3175 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lnreader-plugins", - "version": "3.0.1", + "version": "3.0.0", "description": "Plugins repo for LNReader", "main": "index.js", "type": "module", diff --git a/src/types/plugin.ts b/src/types/plugin.ts index 2a59fba20..1b96402a4 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -32,6 +32,7 @@ export namespace Plugin { author?: string; artist?: string; status?: string; + /** Rating out of 5 as float */ rating?: number; chapters?: ChapterItem[]; } & NovelItem; From 87a32eb495d105ad993d7d5f8a2914d363055003 Mon Sep 17 00:00:00 2001 From: Batorian Date: Mon, 26 Aug 2024 18:01:09 +0200 Subject: [PATCH 4/5] novel-updates-rating: edit imports --- src/types/plugin.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/types/plugin.ts b/src/types/plugin.ts index 1b96402a4..477a01734 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -1,7 +1,5 @@ import { FilterToValues, Filters } from '@libs/filterInputs'; -import { util } from 'protobufjs'; export namespace Plugin { - import float = util.float; export type ChapterItem = { name: string; path: string; From f612eca1ebed4bb5bd073979f778ad603146a367 Mon Sep 17 00:00:00 2001 From: Batorian Date: Tue, 27 Aug 2024 20:43:46 +0200 Subject: [PATCH 5/5] novel-updates-rating: update plugins version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b61cc3175..ce52a2048 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lnreader-plugins", - "version": "3.0.0", + "version": "3.1.0", "description": "Plugins repo for LNReader", "main": "index.js", "type": "module",