obsidian-media-db-sync/src/models/MovieModel.ts
Conor Meyers 39017bfa82 Add more detail to search results
Adds getSummary to the MediaTypeModel.ts abstract class, which allows individual models to give more detail to better allow people to pick the right result
2022-08-23 16:10:14 +01:00

50 lines
865 B
TypeScript

import {MediaTypeModel} from './MediaTypeModel';
import {mediaDbTag} from '../utils/Utils';
import {MediaType} from '../utils/MediaType';
export class MovieModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
genres: string[];
producer: string;
duration: string;
onlineRating: number;
image: string;
released: boolean;
premiere: string;
userData: {
watched: boolean;
lastWatched: string;
personalRating: number;
};
constructor(obj: any = {}) {
super();
Object.assign(this, obj);
this.type = this.getMediaType();
}
getTags(): string[] {
return [mediaDbTag, 'tv', 'movie'];
}
getMediaType(): MediaType {
return MediaType.Movie;
}
getSummary(): string {
return this.englishTitle + ' (' + this.year + ')';
}
}