prep for release

This commit is contained in:
Moritz Jung 2024-06-02 20:05:51 +02:00
parent fac8abf701
commit bf33e7567c
8 changed files with 113 additions and 6026 deletions

2
.gitignore vendored
View file

@ -34,3 +34,5 @@ exampleVault/.obsidian/*
exampleVault/.obsidian/plugins/* exampleVault/.obsidian/plugins/*
exampleVault/.obsidian/plugins/obsidian-media-db-plugin/* exampleVault/.obsidian/plugins/obsidian-media-db-plugin/*
!exampleVault/.obsidian/plugins/obsidian-media-db-plugin/.hotreload !exampleVault/.obsidian/plugins/obsidian-media-db-plugin/.hotreload
exampleVault/Media DB/*

View file

@ -6,5 +6,6 @@
"description": "A plugin that can query multiple APIs for movies, series, anime, games, music and wiki articles, and import them into your vault.", "description": "A plugin that can query multiple APIs for movies, series, anime, games, music and wiki articles, and import them into your vault.",
"author": "Moritz Jung", "author": "Moritz Jung",
"authorUrl": "https://www.moritzjung.dev", "authorUrl": "https://www.moritzjung.dev",
"fundingUrl": "https://github.com/sponsors/mProjectsCode",
"isDesktopOnly": false "isDesktopOnly": false
} }

5912
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -18,14 +18,15 @@ export abstract class APIModel {
abstract getById(id: string): Promise<MediaTypeModel>; abstract getById(id: string): Promise<MediaTypeModel>;
hasType(type: MediaType): boolean { hasType(_type: MediaType): boolean {
if ( // if (
this.types.contains(type) && // this.types.contains(type) &&
(Boolean((this.plugin.settings.apiToggle as any)?.[this.apiName]?.[type]) === true || (this.plugin.settings.apiToggle as any)?.[this.apiName]?.[type] === undefined) // (Boolean((this.plugin.settings.apiToggle as any)?.[this.apiName]?.[type]) === true || (this.plugin.settings.apiToggle as any)?.[this.apiName]?.[type] === undefined)
) { // ) {
// return true;
// }
return true; return true;
} }
}
hasTypeOverlap(types: MediaType[]): boolean { hasTypeOverlap(types: MediaType[]): boolean {
for (const type of types) { for (const type of types) {

View file

@ -143,7 +143,6 @@ export class OMDbAPI extends APIModel {
onlineRating: Number.parseFloat(result.imdbRating ?? 0), onlineRating: Number.parseFloat(result.imdbRating ?? 0),
actors: result.Actors?.split(', ') ?? [], actors: result.Actors?.split(', ') ?? [],
image: result.Poster ?? '', image: result.Poster ?? '',
plot: result.Plot ?? '',
released: true, released: true,
streamingServices: [], streamingServices: [],
@ -176,7 +175,6 @@ export class OMDbAPI extends APIModel {
onlineRating: Number.parseFloat(result.imdbRating ?? 0), onlineRating: Number.parseFloat(result.imdbRating ?? 0),
actors: result.Actors?.split(', ') ?? [], actors: result.Actors?.split(', ') ?? [],
image: result.Poster ?? '', image: result.Poster ?? '',
plot: result.Plot ?? '',
released: true, released: true,
streamingServices: [], streamingServices: [],

View file

@ -12,7 +12,6 @@ export class MovieModel extends MediaTypeModel {
onlineRating: number; onlineRating: number;
actors: string[]; actors: string[];
image: string; image: string;
plot: string;
released: boolean; released: boolean;
streamingServices: string[]; streamingServices: string[];
@ -36,7 +35,6 @@ export class MovieModel extends MediaTypeModel {
this.onlineRating = undefined; this.onlineRating = undefined;
this.actors = undefined; this.actors = undefined;
this.image = undefined; this.image = undefined;
this.plot = undefined;
this.released = undefined; this.released = undefined;
this.streamingServices = undefined; this.streamingServices = undefined;

View file

@ -21,7 +21,6 @@ export class SeriesModel extends MediaTypeModel {
onlineRating: number; onlineRating: number;
actors: string[]; actors: string[];
image: string; image: string;
plot: string;
released: boolean; released: boolean;
streamingServices: string[]; streamingServices: string[];
@ -47,7 +46,6 @@ export class SeriesModel extends MediaTypeModel {
this.onlineRating = undefined; this.onlineRating = undefined;
this.actors = undefined; this.actors = undefined;
this.image = undefined; this.image = undefined;
this.plot = undefined;
this.released = undefined; this.released = undefined;
this.streamingServices = undefined; this.streamingServices = undefined;

View file

@ -18,23 +18,24 @@ export interface MediaDbPluginSettings {
openNoteInNewTab: boolean; openNoteInNewTab: boolean;
useDefaultFrontMatter: boolean; useDefaultFrontMatter: boolean;
enableTemplaterIntegration: boolean; enableTemplaterIntegration: boolean;
apiToggle: { // TODO: disabled for now, as i currently don't have the time to fix this from the original PR that introduced it (#133)
OMDbAPI: { // apiToggle: {
movie: boolean; // OMDbAPI: {
series: boolean; // movie: boolean;
game: boolean; // series: boolean;
}; // game: boolean;
MALAPI: { // };
movie: boolean; // MALAPI: {
series: boolean; // movie: boolean;
}; // series: boolean;
SteamAPI: { // };
game: boolean; // SteamAPI: {
}; // game: boolean;
MobyGamesAPI: { // };
game: boolean; // MobyGamesAPI: {
}; // game: boolean;
}; // };
// };
movieTemplate: string; movieTemplate: string;
seriesTemplate: string; seriesTemplate: string;
mangaTemplate: string; mangaTemplate: string;
@ -83,23 +84,23 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
openNoteInNewTab: true, openNoteInNewTab: true,
useDefaultFrontMatter: true, useDefaultFrontMatter: true,
enableTemplaterIntegration: false, enableTemplaterIntegration: false,
apiToggle: { // apiToggle: {
OMDbAPI: { // OMDbAPI: {
movie: true, // movie: true,
series: true, // series: true,
game: true, // game: true,
}, // },
MALAPI: { // MALAPI: {
movie: true, // movie: true,
series: true, // series: true,
}, // },
SteamAPI: { // SteamAPI: {
game: true, // game: true,
}, // },
MobyGamesAPI: { // MobyGamesAPI: {
game: true, // game: true,
}, // },
}, // },
movieTemplate: '', movieTemplate: '',
seriesTemplate: '', seriesTemplate: '',
mangaTemplate: '', mangaTemplate: '',
@ -280,73 +281,73 @@ export class MediaDbSettingTab extends PluginSettingTab {
}); });
}); });
containerEl.createEl('h3', { text: 'APIs Per Media Type' }); // containerEl.createEl('h3', { text: 'APIs Per Media Type' });
containerEl.createEl('h5', { text: 'Movies' }); // containerEl.createEl('h5', { text: 'Movies' });
new Setting(containerEl) // new Setting(containerEl)
.setName('OMDb API') // .setName('OMDb API')
.setDesc('Use OMDb API for movies.') // .setDesc('Use OMDb API for movies.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.movie).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.movie).onChange(data => {
this.plugin.settings.apiToggle.OMDbAPI.movie = data; // this.plugin.settings.apiToggle.OMDbAPI.movie = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
new Setting(containerEl) // new Setting(containerEl)
.setName('MAL API') // .setName('MAL API')
.setDesc('Use MAL API for movies.') // .setDesc('Use MAL API for movies.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.MALAPI.movie).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.MALAPI.movie).onChange(data => {
this.plugin.settings.apiToggle.MALAPI.movie = data; // this.plugin.settings.apiToggle.MALAPI.movie = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
containerEl.createEl('h5', { text: 'Series' }); // containerEl.createEl('h5', { text: 'Series' });
new Setting(containerEl) // new Setting(containerEl)
.setName('OMDb API') // .setName('OMDb API')
.setDesc('Use OMDb API for series.') // .setDesc('Use OMDb API for series.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.series).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.series).onChange(data => {
this.plugin.settings.apiToggle.OMDbAPI.series = data; // this.plugin.settings.apiToggle.OMDbAPI.series = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
new Setting(containerEl) // new Setting(containerEl)
.setName('MAL API') // .setName('MAL API')
.setDesc('Use MAL API for series.') // .setDesc('Use MAL API for series.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.MALAPI.series).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.MALAPI.series).onChange(data => {
this.plugin.settings.apiToggle.MALAPI.series = data; // this.plugin.settings.apiToggle.MALAPI.series = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
containerEl.createEl('h5', { text: 'Games' }); // containerEl.createEl('h5', { text: 'Games' });
new Setting(containerEl) // new Setting(containerEl)
.setName('OMDb API') // .setName('OMDb API')
.setDesc('Use OMDb API for games.') // .setDesc('Use OMDb API for games.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.game).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.game).onChange(data => {
this.plugin.settings.apiToggle.OMDbAPI.game = data; // this.plugin.settings.apiToggle.OMDbAPI.game = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
new Setting(containerEl) // new Setting(containerEl)
.setName('Steam API') // .setName('Steam API')
.setDesc('Use OMDb API for games.') // .setDesc('Use OMDb API for games.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.SteamAPI.game).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.SteamAPI.game).onChange(data => {
this.plugin.settings.apiToggle.SteamAPI.game = data; // this.plugin.settings.apiToggle.SteamAPI.game = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
new Setting(containerEl) // new Setting(containerEl)
.setName('MobyGames API') // .setName('MobyGames API')
.setDesc('Use MobyGames API for games.') // .setDesc('Use MobyGames API for games.')
.addToggle(cb => { // .addToggle(cb => {
cb.setValue(this.plugin.settings.apiToggle.MobyGamesAPI.game).onChange(data => { // cb.setValue(this.plugin.settings.apiToggle.MobyGamesAPI.game).onChange(data => {
this.plugin.settings.apiToggle.MobyGamesAPI.game = data; // this.plugin.settings.apiToggle.MobyGamesAPI.game = data;
void this.plugin.saveSettings(); // void this.plugin.saveSettings();
}); // });
}); // });
containerEl.createEl('h3', { text: 'New File Location' }); containerEl.createEl('h3', { text: 'New File Location' });
// region new file location // region new file location