obsidian-media-db-sync/src/models/MangaModel.ts
ltctceplrm 57de3d614c Modified the PR by onesvat to add plot to media
I modified synopsis in manga to plot and added the plot in MALapi that also uses the movie model, I did the same thing for series
2023-12-08 03:32:07 +01:00

78 lines
1.5 KiB
TypeScript

import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
export class MangaModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
plot: string;
englishTitle: string;
alternateTitles: string[];
year: string;
dataSource: string;
url: string;
id: string;
genres: string[];
authors: string[];
chapters: number;
volumes: number;
onlineRating: number;
image: string;
released: boolean;
status: string;
publishedFrom: string;
publishedTo: string;
userData: {
watched: boolean;
lastWatched: string;
personalRating: number;
};
constructor(obj: any = {}) {
super();
this.plot = undefined;
this.genres = undefined;
this.authors = undefined;
this.alternateTitles = undefined;
this.chapters = undefined;
this.volumes = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.released = undefined;
this.status = undefined;
this.publishedFrom = undefined;
this.publishedTo = undefined;
this.userData = {
watched: undefined,
lastWatched: undefined,
personalRating: undefined,
};
migrateObject(this, obj, this);
if (!obj.hasOwnProperty('userData')) {
migrateObject(this.userData, obj, this.userData);
}
this.type = this.getMediaType();
}
getTags(): string[] {
return [mediaDbTag, 'manga', 'light-novel'];
}
getMediaType(): MediaType {
return MediaType.Manga;
}
getSummary(): string {
return this.title + ' (' + this.year + ')';
}
}