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[] = [];
|
let res: MediaTypeModel[] = [];
|
||||||
for (const api of this.apis) {
|
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);
|
const apiRes = await api.searchByTitle(query);
|
||||||
res = res.concat(apiRes);
|
res = res.concat(apiRes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export default class MediaDbPlugin extends Plugin {
|
||||||
*/
|
*/
|
||||||
async createLinkWithSearchModal(): Promise<void> {
|
async createLinkWithSearchModal(): Promise<void> {
|
||||||
const apiSearchResults: MediaTypeModel[] = await this.modalHelper.openAdvancedSearchModal({}, async advancedSearchModalData => {
|
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) {
|
if (!apiSearchResults) {
|
||||||
|
|
@ -218,7 +218,7 @@ export default class MediaDbPlugin extends Plugin {
|
||||||
|
|
||||||
async createEntryWithAdvancedSearchModal(): Promise<void> {
|
async createEntryWithAdvancedSearchModal(): Promise<void> {
|
||||||
const apiSearchResults: MediaTypeModel[] = await this.modalHelper.openAdvancedSearchModal({}, async advancedSearchModalData => {
|
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) {
|
if (!apiSearchResults) {
|
||||||
|
|
@ -570,7 +570,7 @@ export default class MediaDbPlugin extends Plugin {
|
||||||
|
|
||||||
let results: MediaTypeModel[] = [];
|
let results: MediaTypeModel[] = [];
|
||||||
try {
|
try {
|
||||||
results = await this.apiManager.query(title, [selectedAPI], "default");
|
results = await this.apiManager.query(title, [selectedAPI], "");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
erroredFiles.push({ filePath: file.path, error: e.toString() });
|
erroredFiles.push({ filePath: file.path, error: e.toString() });
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
||||||
|
|
||||||
// const apiToggleComponents: Component[] = [];
|
// const apiToggleComponents: Component[] = [];
|
||||||
for (const api of this.plugin.apiManager.apis) {
|
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' });
|
const apiToggleTextWrapper = apiToggleListElementWrapper.createEl('div', { cls: 'media-db-plugin-list-text-wrapper' });
|
||||||
|
|
@ -104,7 +103,6 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
||||||
});
|
});
|
||||||
apiToggleComponentWrapper.appendChild(apiToggleComponent.toggleEl);
|
apiToggleComponentWrapper.appendChild(apiToggleComponent.toggleEl);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
contentEl.createDiv({ cls: 'media-db-plugin-spacer' });
|
contentEl.createDiv({ cls: 'media-db-plugin-spacer' });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,6 @@ export interface MediaDbPluginSettings {
|
||||||
MALAPIseries: boolean;
|
MALAPIseries: boolean;
|
||||||
SteamAPIgame: boolean;
|
SteamAPIgame: boolean;
|
||||||
MobyGamesAPIgame: boolean;
|
MobyGamesAPIgame: boolean;
|
||||||
BoardGameGeekAPIdefault: boolean;
|
|
||||||
MALAPIMangadefault: boolean;
|
|
||||||
MusicBrainzAPIdefault: boolean;
|
|
||||||
OpenLibraryAPIdefault: boolean;
|
|
||||||
WikipediaAPIdefault: boolean;
|
|
||||||
|
|
||||||
movieTemplate: string;
|
movieTemplate: string;
|
||||||
seriesTemplate: string;
|
seriesTemplate: string;
|
||||||
|
|
@ -88,11 +83,6 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
||||||
MALAPImovie: true,
|
MALAPImovie: true,
|
||||||
SteamAPIgame: true,
|
SteamAPIgame: true,
|
||||||
MobyGamesAPIgame: true,
|
MobyGamesAPIgame: true,
|
||||||
BoardGameGeekAPIdefault: true,
|
|
||||||
MALAPIMangadefault: true,
|
|
||||||
MusicBrainzAPIdefault: true,
|
|
||||||
OpenLibraryAPIdefault: true,
|
|
||||||
WikipediaAPIdefault: true,
|
|
||||||
|
|
||||||
movieTemplate: '',
|
movieTemplate: '',
|
||||||
seriesTemplate: '',
|
seriesTemplate: '',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue