diff --git a/main.ts b/main.ts index d1f0f69..a28280a 100644 --- a/main.ts +++ b/main.ts @@ -230,7 +230,10 @@ export default class Moviegrabber extends Plugin { return; } - let title = await this.FillTemplate(this.settings.FilenameTemplate, itemData); + let titleTemplate = type == 'movie' + ? this.settings.FilenameTemplateMovie + : this.settings.FilenameTemplateSeries; + let title = await this.FillTemplate(titleTemplate, itemData); title = title == '' ? item.Title : title; let path = `${dir}${title.replace(/[/\\?%*:|"<>]/g, '')}.md` diff --git a/manifest.json b/manifest.json index 78b7f69..22f6ca5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "moviegrabber", "name": "Moviegrabber", - "version": "1.1.12", + "version": "1.1.13", "minAppVersion": "0.15.0", "description": "Grab movie data from public APIs and transform it into notes that can be used with dataview and properties", "author": "Superschnizel", diff --git a/src/MoviegrabberSettings.ts b/src/MoviegrabberSettings.ts index 2771f85..b5f7542 100644 --- a/src/MoviegrabberSettings.ts +++ b/src/MoviegrabberSettings.ts @@ -14,7 +14,8 @@ export interface MoviegrabberSettings { SeriesTemplatePath: string; PlotLength: string; - FilenameTemplate: string; + FilenameTemplateMovie: string; + FilenameTemplateSeries: string; } export const DEFAULT_SETTINGS: MoviegrabberSettings = { @@ -26,7 +27,8 @@ export const DEFAULT_SETTINGS: MoviegrabberSettings = { MovieTemplatePath: '', SeriesTemplatePath: '', PlotLength: 'short', - FilenameTemplate: '{{Title}}' + FilenameTemplateMovie: '{{Title}}', + FilenameTemplateSeries: '{{Title}}' } export const DEFAULT_TEMPLATE: string = "---\n"+ @@ -168,13 +170,24 @@ export class MoviegrabberSettingTab extends PluginSettingTab { })); new Setting(containerEl) - .setName('Filename Template') + .setName('Movie filename template') .setDesc('Template used for the filename of Movienotes. Used same template tags as other files.') .addText(text => text .setPlaceholder('') - .setValue(this.plugin.settings.FilenameTemplate) + .setValue(this.plugin.settings.FilenameTemplateMovie) .onChange(async (value) => { - this.plugin.settings.FilenameTemplate = value; + this.plugin.settings.FilenameTemplateMovie = value; + await this.plugin.saveSettings(); + })); + + new Setting(containerEl) + .setName('Series filename template') + .setDesc('Template used for the filename of Movienotes. Used same template tags as other files.') + .addText(text => text + .setPlaceholder('') + .setValue(this.plugin.settings.FilenameTemplateSeries) + .onChange(async (value) => { + this.plugin.settings.FilenameTemplateSeries = value; await this.plugin.saveSettings(); })); }