@@ -19,7 +19,23 @@ export interface MediaDbPluginSettings {
1919 openNoteInNewTab : boolean ;
2020 useDefaultFrontMatter : boolean ;
2121 enableTemplaterIntegration : boolean ;
22-
22+ apiToggle : {
23+ OMDbAPI : {
24+ movie : boolean ;
25+ series : boolean ;
26+ game : boolean ;
27+ } ,
28+ MALAPI : {
29+ movie : boolean ;
30+ series : boolean ;
31+ } ,
32+ SteamAPI : {
33+ game : boolean ;
34+ } ,
35+ MobyGamesAPI : {
36+ game : boolean ;
37+ }
38+ } ,
2339 movieTemplate : string ;
2440 seriesTemplate : string ;
2541 mangaTemplate : string ;
@@ -69,7 +85,23 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
6985 openNoteInNewTab : true ,
7086 useDefaultFrontMatter : true ,
7187 enableTemplaterIntegration : false ,
72-
88+ apiToggle : {
89+ OMDbAPI : {
90+ movie : true ,
91+ series : true ,
92+ game : true ,
93+ } ,
94+ MALAPI : {
95+ movie : true ,
96+ series : true ,
97+ } ,
98+ SteamAPI : {
99+ game : true ,
100+ } ,
101+ MobyGamesAPI : {
102+ game : true ,
103+ }
104+ } ,
73105 movieTemplate : '' ,
74106 seriesTemplate : '' ,
75107 mangaTemplate : '' ,
@@ -209,10 +241,10 @@ export class MediaDbSettingTab extends PluginSettingTab {
209241 . setDesc (
210242 fragWithHTML (
211243 "Your custom date format. Use <em>'YYYY-MM-DD'</em> for example.<br>" +
212- "For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
213- "Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
214- this . plugin . dateFormatter . getPreview ( ) +
215- '</a></b>' ,
244+ "For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
245+ "Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
246+ this . plugin . dateFormatter . getPreview ( ) +
247+ '</a></b>' ,
216248 ) ,
217249 )
218250 . addText ( cb => {
@@ -260,6 +292,75 @@ export class MediaDbSettingTab extends PluginSettingTab {
260292 } ) ;
261293 } ) ;
262294
295+
296+ containerEl . createEl ( 'h3' , { text : 'APIs Per Media Type' } ) ;
297+ containerEl . createEl ( 'h5' , { text : 'Movies' } ) ;
298+ new Setting ( containerEl )
299+ . setName ( 'OMDb API' )
300+ . setDesc ( 'Use OMDb API for movies.' )
301+ . addToggle ( cb => {
302+ cb . setValue ( this . plugin . settings . apiToggle . OMDbAPI . movie ) . onChange ( data => {
303+ this . plugin . settings . apiToggle . OMDbAPI . movie = data ;
304+ this . plugin . saveSettings ( ) ;
305+ } ) ;
306+ } ) ;
307+ new Setting ( containerEl )
308+ . setName ( 'MAL API' )
309+ . setDesc ( 'Use MAL API for movies.' )
310+ . addToggle ( cb => {
311+ cb . setValue ( this . plugin . settings . apiToggle . MALAPI . movie ) . onChange ( data => {
312+ this . plugin . settings . apiToggle . MALAPI . movie = data ;
313+ this . plugin . saveSettings ( ) ;
314+ } ) ;
315+ } ) ;
316+ containerEl . createEl ( 'h5' , { text : 'Series' } ) ;
317+ new Setting ( containerEl )
318+ . setName ( 'OMDb API' )
319+ . setDesc ( 'Use OMDb API for series.' )
320+ . addToggle ( cb => {
321+ cb . setValue ( this . plugin . settings . apiToggle . OMDbAPI . series ) . onChange ( data => {
322+ this . plugin . settings . apiToggle . OMDbAPI . series = data ;
323+ this . plugin . saveSettings ( ) ;
324+ } ) ;
325+ } ) ;
326+ new Setting ( containerEl )
327+ . setName ( 'MAL API' )
328+ . setDesc ( 'Use MAL API for series.' )
329+ . addToggle ( cb => {
330+ cb . setValue ( this . plugin . settings . apiToggle . MALAPI . series ) . onChange ( data => {
331+ this . plugin . settings . apiToggle . MALAPI . series = data ;
332+ this . plugin . saveSettings ( ) ;
333+ } ) ;
334+ } ) ;
335+ containerEl . createEl ( 'h5' , { text : 'Games' } ) ;
336+ new Setting ( containerEl )
337+ . setName ( 'OMDb API' )
338+ . setDesc ( 'Use OMDb API for games.' )
339+ . addToggle ( cb => {
340+ cb . setValue ( this . plugin . settings . apiToggle . OMDbAPI . game ) . onChange ( data => {
341+ this . plugin . settings . apiToggle . OMDbAPI . game = data ;
342+ this . plugin . saveSettings ( ) ;
343+ } ) ;
344+ } ) ;
345+ new Setting ( containerEl )
346+ . setName ( 'Steam API' )
347+ . setDesc ( 'Use OMDb API for games.' )
348+ . addToggle ( cb => {
349+ cb . setValue ( this . plugin . settings . apiToggle . SteamAPI . game ) . onChange ( data => {
350+ this . plugin . settings . apiToggle . SteamAPI . game = data ;
351+ this . plugin . saveSettings ( ) ;
352+ } ) ;
353+ } ) ;
354+ new Setting ( containerEl )
355+ . setName ( 'MobyGames API' )
356+ . setDesc ( 'Use MobyGames API for games.' )
357+ . addToggle ( cb => {
358+ cb . setValue ( this . plugin . settings . apiToggle . MobyGamesAPI . game ) . onChange ( data => {
359+ this . plugin . settings . apiToggle . MobyGamesAPI . game = data ;
360+ this . plugin . saveSettings ( ) ;
361+ } ) ;
362+ } ) ;
363+
263364 containerEl . createEl ( 'h3' , { text : 'New File Location' } ) ;
264365 // region new file location
265366 new Setting ( containerEl )
0 commit comments