Skip to content

Commit 12ebebc

Browse files
committed
2 parents 292dcf5 + a685d82 commit 12ebebc

File tree

7 files changed

+33
-7
lines changed

7 files changed

+33
-7
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
## Obsidian Media DB Plugin
22

3-
A plugin that can query multiple APIs for movies, series, anime, manga, books, games, music and wiki articles, and import them into your vault.
3+
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.
44

55
### Features
66

77
#### Search by Title
88

9-
Search a movie, series, anime, game, music release or wiki article by its name across multiple APIs.
9+
Search a movie, series, anime, manga, book, comic, game, music release or wiki articles by its name across multiple APIs.
1010

1111
#### Search by ID
1212

@@ -162,9 +162,11 @@ Now you select the result you want and the plugin will cast it's magic and creat
162162
- you can find this ID in the URL
163163
- e.g. for "Factorio" the URL looks like this `https://store.steampowered.com/app/427520/Factorio/` so the ID is `427520`
164164
- [Open Library](https://openlibrary.org)
165-
- 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
166-
- e.g. for "Fantastic Mr. Fox" the URL looks like this `https://openlibrary.org/works/OL45804W` so the ID is `/works/OL45804W`
167-
- This URL is located near the top of the page above the title, see `An edition of Fantastic Mr Fox (1970) `
165+
- 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
166+
- e.g. for "Fantastic Mr. Fox" the "/works/" URL looks like this `https://openlibrary.org/works/OL45804W` so the ID is `/works/OL45804W`
167+
- This URL is located near the top of the page above the title, see `An edition of Fantastic Mr Fox (1970) `
168+
- 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`
169+
- This URL is located in the editions section`
168170
- [Moby Games](https://www.mobygames.com)
169171
- you can find this ID in the URL
170172
- e.g. for "Bioshock 2" the URL looks like this `https://www.mobygames.com/game/45089/bioshock-2/` so the ID is `45089`

src/api/apis/MALAPI.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export class MALAPI extends APIModel {
145145
image: result.images?.jpg?.image_url,
146146

147147
released: true,
148+
ageRating: result.rating,
148149
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat),
149150
streamingServices: result.streaming?.map(x => x.name).filter(isTruthy),
150151

@@ -174,6 +175,7 @@ export class MALAPI extends APIModel {
174175
image: result.images?.jpg?.image_url,
175176

176177
released: true,
178+
ageRating: result.rating,
177179
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat),
178180
streamingServices: result.streaming?.map(x => x.name).filter(isTruthy),
179181

@@ -203,6 +205,7 @@ export class MALAPI extends APIModel {
203205
image: result.images?.jpg?.image_url,
204206

205207
released: true,
208+
ageRating: result.rating,
206209
airedFrom: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat),
207210
airedTo: this.plugin.dateFormatter.format(result.aired?.to, this.apiDateFormat),
208211
airing: result.airing,

src/api/apis/MusicBrainzAPI.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ interface IdResponse {
7575

7676
export class MusicBrainzAPI extends APIModel {
7777
plugin: MediaDbPlugin;
78+
apiDateFormat: string = 'YYYY-MM-DD';
7879

7980
constructor(plugin: MediaDbPlugin) {
8081
super();
@@ -117,10 +118,11 @@ export class MusicBrainzAPI extends APIModel {
117118
title: result.title,
118119
englishTitle: result.title,
119120
year: new Date(result['first-release-date']).getFullYear().toString(),
121+
releaseDate: this.plugin.dateFormatter.format(result['first-release-date'], this.apiDateFormat) ?? 'unknown',
120122
dataSource: this.apiName,
121123
url: 'https://musicbrainz.org/release-group/' + result.id,
122124
id: result.id,
123-
image: 'https://coverartarchive.org/release-group/' + result.id + '/front',
125+
image: 'https://coverartarchive.org/release-group/' + result.id + '/front-500.jpg',
124126

125127
artists: result['artist-credit'].map(a => a.name),
126128
subType: result['primary-type'],
@@ -153,10 +155,11 @@ export class MusicBrainzAPI extends APIModel {
153155
title: result.title,
154156
englishTitle: result.title,
155157
year: new Date(result['first-release-date']).getFullYear().toString(),
158+
releaseDate: this.plugin.dateFormatter.format(result['first-release-date'], this.apiDateFormat) ?? 'unknown',
156159
dataSource: this.apiName,
157160
url: 'https://musicbrainz.org/release-group/' + result.id,
158161
id: result.id,
159-
image: 'https://coverartarchive.org/release-group/' + result.id + '/front',
162+
image: 'https://coverartarchive.org/release-group/' + result.id + '/front-500.jpg',
160163

161164
artists: result['artist-credit'].map(a => a.name),
162165
genres: result.genres.map(g => g.name),

src/api/apis/OMDbAPI.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ export class OMDbAPI extends APIModel {
229229
image: result.Poster.replace('_SX300', '_SX600'),
230230

231231
released: true,
232+
country: result.Country?.split(', '),
233+
boxOffice: result.BoxOffice,
234+
ageRating: result.Rated,
232235
premiere: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat),
233236

234237
userData: {
@@ -258,6 +261,8 @@ export class OMDbAPI extends APIModel {
258261
image: result.Poster.replace('_SX300', '_SX600'),
259262

260263
released: true,
264+
country: result.Country?.split(', '),
265+
ageRating: result.Rated,
261266
airedFrom: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat),
262267

263268
userData: {

src/models/MovieModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export class MovieModel extends MediaTypeModel {
1717
image: string;
1818

1919
released: boolean;
20+
country: string[];
21+
boxOffice: string;
22+
ageRating: string;
2023
streamingServices: string[];
2124
premiere: string;
2225

@@ -40,6 +43,9 @@ export class MovieModel extends MediaTypeModel {
4043
this.image = '';
4144

4245
this.released = false;
46+
this.country = [];
47+
this.boxOffice = '';
48+
this.ageRating = '';
4349
this.streamingServices = [];
4450
this.premiere = '';
4551

src/models/MusicReleaseModel.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class MusicReleaseModel extends MediaTypeModel {
1010
artists: string[];
1111
image: string;
1212
rating: number;
13+
releaseDate: string;
1314

1415
userData: {
1516
personalRating: number;
@@ -22,6 +23,8 @@ export class MusicReleaseModel extends MediaTypeModel {
2223
this.artists = [];
2324
this.image = '';
2425
this.rating = 0;
26+
this.releaseDate = '';
27+
2528
this.userData = {
2629
personalRating: 0,
2730
};

src/models/SeriesModel.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export class SeriesModel extends MediaTypeModel {
1717
image: string;
1818

1919
released: boolean;
20+
country: string[];
21+
ageRating: string;
2022
streamingServices: string[];
2123
airing: boolean;
2224
airedFrom: string;
@@ -42,6 +44,8 @@ export class SeriesModel extends MediaTypeModel {
4244
this.image = '';
4345

4446
this.released = false;
47+
this.country = [];
48+
this.ageRating = '';
4549
this.streamingServices = [];
4650
this.airing = false;
4751
this.airedFrom = '';

0 commit comments

Comments
 (0)