diff --git a/README.md b/README.md index dd48ea0..536c900 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ ## Obsidian Media DB Plugin -A plugin that can query multiple APIs for movies, series, anime, manga, books, games, music and wiki articles, and import them into your vault. +A plugin that can query multiple APIs for movies, series, anime, manga, books, comics, games, music and wiki articles, and import them into your vault. ### Features #### Search by Title -Search a movie, series, anime, game, music release or wiki article by its name across multiple APIs. +Search a movie, series, anime, manga, book, comic, game, music release or wiki articles by its name across multiple APIs. #### Search by ID @@ -162,9 +162,11 @@ Now you select the result you want and the plugin will cast it's magic and creat - you can find this ID in the URL - e.g. for "Factorio" the URL looks like this `https://store.steampowered.com/app/427520/Factorio/` so the ID is `427520` - [Open Library](https://openlibrary.org) - - The ID you need is the "work" ID and not the "book" ID, it needs to start with `/works/`. You can find this ID in the URL - - e.g. for "Fantastic Mr. Fox" the URL looks like this `https://openlibrary.org/works/OL45804W` so the ID is `/works/OL45804W` - - This URL is located near the top of the page above the title, see `An edition of Fantastic Mr Fox (1970) ` + - The ID can either be the "/work/" ID, the "/book/" ID, or the "/isbn/" ID it needs to start with `/works/`. You can find this ID in the URL + - e.g. for "Fantastic Mr. Fox" the "/works/" URL looks like this `https://openlibrary.org/works/OL45804W` so the ID is `/works/OL45804W` + - This URL is located near the top of the page above the title, see `An edition of Fantastic Mr Fox (1970) ` + - For a specific edition of "Fantastic Mr. Fox" the "/books/" URL looks like this `https://openlibrary.org/books/OL3567303M/` so the ID is `/books/OL3567303M` + - This URL is located in the editions section` - [Moby Games](https://www.mobygames.com) - you can find this ID in the URL - e.g. for "Bioshock 2" the URL looks like this `https://www.mobygames.com/game/45089/bioshock-2/` so the ID is `45089` diff --git a/src/api/apis/MALAPI.ts b/src/api/apis/MALAPI.ts index 6309a90..5ac2cf9 100644 --- a/src/api/apis/MALAPI.ts +++ b/src/api/apis/MALAPI.ts @@ -145,6 +145,7 @@ export class MALAPI extends APIModel { image: result.images?.jpg?.image_url, released: true, + ageRating: result.rating, premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat), streamingServices: result.streaming?.map(x => x.name).filter(isTruthy), @@ -174,6 +175,7 @@ export class MALAPI extends APIModel { image: result.images?.jpg?.image_url, released: true, + ageRating: result.rating, premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat), streamingServices: result.streaming?.map(x => x.name).filter(isTruthy), @@ -203,6 +205,7 @@ export class MALAPI extends APIModel { image: result.images?.jpg?.image_url, released: true, + ageRating: result.rating, airedFrom: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat), airedTo: this.plugin.dateFormatter.format(result.aired?.to, this.apiDateFormat), airing: result.airing, diff --git a/src/api/apis/MusicBrainzAPI.ts b/src/api/apis/MusicBrainzAPI.ts index 902a4f1..b567560 100644 --- a/src/api/apis/MusicBrainzAPI.ts +++ b/src/api/apis/MusicBrainzAPI.ts @@ -75,6 +75,7 @@ interface IdResponse { export class MusicBrainzAPI extends APIModel { plugin: MediaDbPlugin; + apiDateFormat: string = 'YYYY-MM-DD'; constructor(plugin: MediaDbPlugin) { super(); @@ -117,10 +118,11 @@ export class MusicBrainzAPI extends APIModel { title: result.title, englishTitle: result.title, year: new Date(result['first-release-date']).getFullYear().toString(), + releaseDate: this.plugin.dateFormatter.format(result['first-release-date'], this.apiDateFormat) ?? 'unknown', dataSource: this.apiName, url: 'https://musicbrainz.org/release-group/' + result.id, id: result.id, - image: 'https://coverartarchive.org/release-group/' + result.id + '/front', + image: 'https://coverartarchive.org/release-group/' + result.id + '/front-500.jpg', artists: result['artist-credit'].map(a => a.name), subType: result['primary-type'], @@ -153,10 +155,11 @@ export class MusicBrainzAPI extends APIModel { title: result.title, englishTitle: result.title, year: new Date(result['first-release-date']).getFullYear().toString(), + releaseDate: this.plugin.dateFormatter.format(result['first-release-date'], this.apiDateFormat) ?? 'unknown', dataSource: this.apiName, url: 'https://musicbrainz.org/release-group/' + result.id, id: result.id, - image: 'https://coverartarchive.org/release-group/' + result.id + '/front', + image: 'https://coverartarchive.org/release-group/' + result.id + '/front-500.jpg', artists: result['artist-credit'].map(a => a.name), genres: result.genres.map(g => g.name), diff --git a/src/api/apis/OMDbAPI.ts b/src/api/apis/OMDbAPI.ts index 3cac8f9..48e2b9c 100644 --- a/src/api/apis/OMDbAPI.ts +++ b/src/api/apis/OMDbAPI.ts @@ -229,6 +229,9 @@ export class OMDbAPI extends APIModel { image: result.Poster.replace('_SX300', '_SX600'), released: true, + country: result.Country?.split(', '), + boxOffice: result.BoxOffice, + ageRating: result.Rated, premiere: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat), userData: { @@ -258,6 +261,8 @@ export class OMDbAPI extends APIModel { image: result.Poster.replace('_SX300', '_SX600'), released: true, + country: result.Country?.split(', '), + ageRating: result.Rated, airedFrom: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat), userData: { diff --git a/src/models/MovieModel.ts b/src/models/MovieModel.ts index 75652ca..c91c2d4 100644 --- a/src/models/MovieModel.ts +++ b/src/models/MovieModel.ts @@ -17,6 +17,9 @@ export class MovieModel extends MediaTypeModel { image: string; released: boolean; + country: string[]; + boxOffice: string; + ageRating: string; streamingServices: string[]; premiere: string; @@ -40,6 +43,9 @@ export class MovieModel extends MediaTypeModel { this.image = ''; this.released = false; + this.country = []; + this.boxOffice = ''; + this.ageRating = ''; this.streamingServices = []; this.premiere = ''; diff --git a/src/models/MusicReleaseModel.ts b/src/models/MusicReleaseModel.ts index 8f2e6b9..900f233 100644 --- a/src/models/MusicReleaseModel.ts +++ b/src/models/MusicReleaseModel.ts @@ -10,6 +10,7 @@ export class MusicReleaseModel extends MediaTypeModel { artists: string[]; image: string; rating: number; + releaseDate: string; userData: { personalRating: number; @@ -22,6 +23,8 @@ export class MusicReleaseModel extends MediaTypeModel { this.artists = []; this.image = ''; this.rating = 0; + this.releaseDate = ''; + this.userData = { personalRating: 0, }; diff --git a/src/models/SeriesModel.ts b/src/models/SeriesModel.ts index a49f618..4489629 100644 --- a/src/models/SeriesModel.ts +++ b/src/models/SeriesModel.ts @@ -17,6 +17,8 @@ export class SeriesModel extends MediaTypeModel { image: string; released: boolean; + country: string[]; + ageRating: string; streamingServices: string[]; airing: boolean; airedFrom: string; @@ -42,6 +44,8 @@ export class SeriesModel extends MediaTypeModel { this.image = ''; this.released = false; + this.country = []; + this.ageRating = ''; this.streamingServices = []; this.airing = false; this.airedFrom = '';