Added online rating
This commit is contained in:
parent
03d1c1dc7d
commit
4968c491dc
2 changed files with 4 additions and 3 deletions
|
|
@ -2,8 +2,6 @@ import { APIModel } from '../APIModel';
|
||||||
import { MediaTypeModel } from '../../models/MediaTypeModel';
|
import { MediaTypeModel } from '../../models/MediaTypeModel';
|
||||||
import MediaDbPlugin from '../../main';
|
import MediaDbPlugin from '../../main';
|
||||||
import { BookModel } from 'src/models/BookModel';
|
import { BookModel } from 'src/models/BookModel';
|
||||||
import { requestUrl } from 'obsidian';
|
|
||||||
import { contactEmail, mediaDbVersion, pluginName } from '../../utils/Utils';
|
|
||||||
import { MediaType } from '../../utils/MediaType';
|
import { MediaType } from '../../utils/MediaType';
|
||||||
|
|
||||||
export class OpenLibraryAPI extends APIModel {
|
export class OpenLibraryAPI extends APIModel {
|
||||||
|
|
@ -75,6 +73,7 @@ export class OpenLibraryAPI extends APIModel {
|
||||||
|
|
||||||
author: result.author_name ?? 'unknown',
|
author: result.author_name ?? 'unknown',
|
||||||
pages: result.number_of_pages_median ?? 'unknown',
|
pages: result.number_of_pages_median ?? 'unknown',
|
||||||
|
onlineRating: Number.parseFloat(result.ratings_average.toFixed(2)) ?? 0,
|
||||||
image: `https://covers.openlibrary.org/b/OLID/` + result.cover_edition_key + `-L.jpg` ?? '',
|
image: `https://covers.openlibrary.org/b/OLID/` + result.cover_edition_key + `-L.jpg` ?? '',
|
||||||
|
|
||||||
released: true,
|
released: true,
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@ import { MediaType } from '../utils/MediaType';
|
||||||
|
|
||||||
export class BookModel extends MediaTypeModel {
|
export class BookModel extends MediaTypeModel {
|
||||||
author: string;
|
author: string;
|
||||||
pages: string;
|
pages: number;
|
||||||
image: string;
|
image: string;
|
||||||
|
onlineRating: number;
|
||||||
english_title: string;
|
english_title: string;
|
||||||
|
|
||||||
released: boolean;
|
released: boolean;
|
||||||
|
|
@ -22,6 +23,7 @@ export class BookModel extends MediaTypeModel {
|
||||||
this.author = undefined;
|
this.author = undefined;
|
||||||
this.pages = undefined;
|
this.pages = undefined;
|
||||||
this.image = undefined;
|
this.image = undefined;
|
||||||
|
this.onlineRating = undefined;
|
||||||
|
|
||||||
this.released = undefined;
|
this.released = undefined;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue