Removed "default" setting and only check if media type is false or not
This commit is contained in:
parent
0157c0adf9
commit
675a0f7659
4 changed files with 5 additions and 17 deletions
|
|
@ -23,7 +23,7 @@ export class APIManager {
|
|||
|
||||
let res: MediaTypeModel[] = [];
|
||||
for (const api of this.apis) {
|
||||
if (apisToQuery.contains(api.apiName) && (this.plugin.settings[[api.apiName, mediaType].filter(s => s).join('') as keyof typeof this.plugin.settings] || this.plugin.settings[[api.apiName, "default"].filter(s => s).join('') as keyof typeof this.plugin.settings])) {
|
||||
if (apisToQuery.contains(api.apiName) && !(this.plugin.settings[[api.apiName, mediaType].filter(s => s).join('') as keyof typeof this.plugin.settings] === false)) {
|
||||
const apiRes = await api.searchByTitle(query);
|
||||
res = res.concat(apiRes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
*/
|
||||
async createLinkWithSearchModal(): Promise<void> {
|
||||
const apiSearchResults: MediaTypeModel[] = await this.modalHelper.openAdvancedSearchModal({}, async advancedSearchModalData => {
|
||||
return await this.apiManager.query(advancedSearchModalData.query, advancedSearchModalData.apis, "default");
|
||||
return await this.apiManager.query(advancedSearchModalData.query, advancedSearchModalData.apis, "");
|
||||
});
|
||||
|
||||
if (!apiSearchResults) {
|
||||
|
|
@ -218,7 +218,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
|
||||
async createEntryWithAdvancedSearchModal(): Promise<void> {
|
||||
const apiSearchResults: MediaTypeModel[] = await this.modalHelper.openAdvancedSearchModal({}, async advancedSearchModalData => {
|
||||
return await this.apiManager.query(advancedSearchModalData.query, advancedSearchModalData.apis, "default");
|
||||
return await this.apiManager.query(advancedSearchModalData.query, advancedSearchModalData.apis, "");
|
||||
});
|
||||
|
||||
if (!apiSearchResults) {
|
||||
|
|
@ -570,7 +570,7 @@ export default class MediaDbPlugin extends Plugin {
|
|||
|
||||
let results: MediaTypeModel[] = [];
|
||||
try {
|
||||
results = await this.apiManager.query(title, [selectedAPI], "default");
|
||||
results = await this.apiManager.query(title, [selectedAPI], "");
|
||||
} catch (e) {
|
||||
erroredFiles.push({ filePath: file.path, error: e.toString() });
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
|||
|
||||
// const apiToggleComponents: Component[] = [];
|
||||
for (const api of this.plugin.apiManager.apis) {
|
||||
if (this.plugin.settings[[api.apiName, "default"].filter(s => s).join('') as keyof typeof this.plugin.settings] || this.plugin.settings[[api.apiName, "game"].filter(s => s).join('') as keyof typeof this.plugin.settings] || this.plugin.settings[[api.apiName, "series"].filter(s => s).join('') as keyof typeof this.plugin.settings] || this.plugin.settings[[api.apiName, "movie"].filter(s => s).join('') as keyof typeof this.plugin.settings]) {
|
||||
const apiToggleListElementWrapper = contentEl.createEl('div', { cls: 'media-db-plugin-list-wrapper' });
|
||||
const apiToggleListElementWrapper = contentEl.createEl('div', { cls: 'media-db-plugin-list-wrapper' });
|
||||
|
||||
const apiToggleTextWrapper = apiToggleListElementWrapper.createEl('div', { cls: 'media-db-plugin-list-text-wrapper' });
|
||||
apiToggleTextWrapper.createEl('span', { text: api.apiName, cls: 'media-db-plugin-list-text' });
|
||||
|
|
@ -104,7 +103,6 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
|||
});
|
||||
apiToggleComponentWrapper.appendChild(apiToggleComponent.toggleEl);
|
||||
}
|
||||
}
|
||||
|
||||
contentEl.createDiv({ cls: 'media-db-plugin-spacer' });
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ export interface MediaDbPluginSettings {
|
|||
MALAPIseries: boolean;
|
||||
SteamAPIgame: boolean;
|
||||
MobyGamesAPIgame: boolean;
|
||||
BoardGameGeekAPIdefault: boolean;
|
||||
MALAPIMangadefault: boolean;
|
||||
MusicBrainzAPIdefault: boolean;
|
||||
OpenLibraryAPIdefault: boolean;
|
||||
WikipediaAPIdefault: boolean;
|
||||
|
||||
movieTemplate: string;
|
||||
seriesTemplate: string;
|
||||
|
|
@ -88,11 +83,6 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
MALAPImovie: true,
|
||||
SteamAPIgame: true,
|
||||
MobyGamesAPIgame: true,
|
||||
BoardGameGeekAPIdefault: true,
|
||||
MALAPIMangadefault: true,
|
||||
MusicBrainzAPIdefault: true,
|
||||
OpenLibraryAPIdefault: true,
|
||||
WikipediaAPIdefault: true,
|
||||
|
||||
movieTemplate: '',
|
||||
seriesTemplate: '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue