Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
67825ae135
19 changed files with 1535 additions and 5272 deletions
|
|
@ -7,12 +7,14 @@ import PropertyMappingModelsComponent from './PropertyMappingModelsComponent.sve
|
|||
import { PropertyMapping, PropertyMappingModel, PropertyMappingOption } from './PropertyMapping';
|
||||
import { MEDIA_TYPES } from '../utils/MediaTypeManager';
|
||||
import { MediaTypeModel } from '../models/MediaTypeModel';
|
||||
import { fragWithHTML } from '../utils/Utils';
|
||||
|
||||
export interface MediaDbPluginSettings {
|
||||
OMDbKey: string;
|
||||
sfwFilter: boolean;
|
||||
useCustomYamlStringifier: boolean;
|
||||
templates: boolean;
|
||||
customDateFormat: string;
|
||||
|
||||
movieTemplate: string;
|
||||
seriesTemplate: string;
|
||||
|
|
@ -21,6 +23,7 @@ export interface MediaDbPluginSettings {
|
|||
wikiTemplate: string;
|
||||
musicReleaseTemplate: string;
|
||||
boardgameTemplate: string;
|
||||
bookTemplate: string;
|
||||
|
||||
movieFileNameTemplate: string;
|
||||
seriesFileNameTemplate: string;
|
||||
|
|
@ -29,6 +32,7 @@ export interface MediaDbPluginSettings {
|
|||
wikiFileNameTemplate: string;
|
||||
musicReleaseFileNameTemplate: string;
|
||||
boardgameFileNameTemplate: string;
|
||||
bookFileNameTemplate: string;
|
||||
|
||||
moviePropertyConversionRules: string;
|
||||
seriesPropertyConversionRules: string;
|
||||
|
|
@ -37,6 +41,7 @@ export interface MediaDbPluginSettings {
|
|||
wikiPropertyConversionRules: string;
|
||||
musicReleasePropertyConversionRules: string;
|
||||
boardgamePropertyConversionRules: string;
|
||||
bookPropertyConversionRules: string;
|
||||
|
||||
movieFolder: string;
|
||||
seriesFolder: string;
|
||||
|
|
@ -45,6 +50,7 @@ export interface MediaDbPluginSettings {
|
|||
wikiFolder: string;
|
||||
musicReleaseFolder: string;
|
||||
boardgameFolder: string;
|
||||
bookFolder: string;
|
||||
|
||||
propertyMappingModels: PropertyMappingModel[];
|
||||
}
|
||||
|
|
@ -54,6 +60,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
sfwFilter: true,
|
||||
useCustomYamlStringifier: true,
|
||||
templates: true,
|
||||
customDateFormat: 'L',
|
||||
|
||||
movieTemplate: '',
|
||||
seriesTemplate: '',
|
||||
|
|
@ -62,6 +69,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
wikiTemplate: '',
|
||||
musicReleaseTemplate: '',
|
||||
boardgameTemplate: '',
|
||||
bookTemplate: '',
|
||||
|
||||
movieFileNameTemplate: '{{ title }} ({{ year }})',
|
||||
seriesFileNameTemplate: '{{ title }} ({{ year }})',
|
||||
|
|
@ -70,6 +78,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
wikiFileNameTemplate: '{{ title }}',
|
||||
musicReleaseFileNameTemplate: '{{ title }} (by {{ ENUM:artists }} - {{ year }})',
|
||||
boardgameFileNameTemplate: '{{ title }} ({{ year }})',
|
||||
bookFileNameTemplate: '{{ title }} ({{ year }})',
|
||||
|
||||
moviePropertyConversionRules: '',
|
||||
seriesPropertyConversionRules: '',
|
||||
|
|
@ -78,6 +87,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
wikiPropertyConversionRules: '',
|
||||
musicReleasePropertyConversionRules: '',
|
||||
boardgamePropertyConversionRules: '',
|
||||
bookPropertyConversionRules: '',
|
||||
|
||||
movieFolder: 'Media DB/movies',
|
||||
seriesFolder: 'Media DB/series',
|
||||
|
|
@ -86,6 +96,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
|||
wikiFolder: 'Media DB/wiki',
|
||||
musicReleaseFolder: 'Media DB/music',
|
||||
boardgameFolder: 'Media DB/boardgames',
|
||||
bookFolder: 'Media DB/books',
|
||||
|
||||
propertyMappingModels: [],
|
||||
};
|
||||
|
|
@ -173,11 +184,33 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Date format')
|
||||
.setDesc(
|
||||
fragWithHTML(
|
||||
"Your custom date format. Use <em>'YYYY-MM-DD'</em> for example.<br>" +
|
||||
"For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
|
||||
"Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
|
||||
this.plugin.dateFormatter.getPreview() +
|
||||
'</a></b>'
|
||||
)
|
||||
)
|
||||
.addText(cb => {
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.customDateFormat)
|
||||
.setValue(this.plugin.settings.customDateFormat === DEFAULT_SETTINGS.customDateFormat ? '' : this.plugin.settings.customDateFormat)
|
||||
.onChange(data => {
|
||||
const newDateFormat = data ? data : DEFAULT_SETTINGS.customDateFormat;
|
||||
this.plugin.settings.customDateFormat = newDateFormat;
|
||||
document.getElementById('media-db-dateformat-preview').textContent = this.plugin.dateFormatter.getPreview(newDateFormat); // update preview
|
||||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
containerEl.createEl('h3', { text: 'New File Location' });
|
||||
// region new file location
|
||||
new Setting(containerEl)
|
||||
.setName('Movie Folder')
|
||||
.setDesc('Where newly imported movies should be places.')
|
||||
.setDesc('Where newly imported movies should be placed.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.movieFolder)
|
||||
|
|
@ -190,7 +223,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
|
||||
new Setting(containerEl)
|
||||
.setName('Series Folder')
|
||||
.setDesc('Where newly imported series should be places.')
|
||||
.setDesc('Where newly imported series should be placed.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.seriesFolder)
|
||||
|
|
@ -216,7 +249,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
|
||||
new Setting(containerEl)
|
||||
.setName('Game Folder')
|
||||
.setDesc('Where newly imported games should be places.')
|
||||
.setDesc('Where newly imported games should be placed.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.gameFolder)
|
||||
|
|
@ -229,7 +262,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
|
||||
new Setting(containerEl)
|
||||
.setName('Wiki Folder')
|
||||
.setDesc('Where newly imported wiki articles should be places.')
|
||||
.setDesc('Where newly imported wiki articles should be placed.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.wikiFolder)
|
||||
|
|
@ -242,7 +275,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
|
||||
new Setting(containerEl)
|
||||
.setName('Music Folder')
|
||||
.setDesc('Where newly imported music should be places.')
|
||||
.setDesc('Where newly imported music should be placed.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.musicReleaseFolder)
|
||||
|
|
@ -257,7 +290,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
.setName('Board Game Folder')
|
||||
.setDesc('Where newly imported board games should be places.')
|
||||
.addSearch(cb => {
|
||||
new FileSuggest(this.app, cb.inputEl);
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.boardgameFolder)
|
||||
.setValue(this.plugin.settings.boardgameFolder)
|
||||
.onChange(data => {
|
||||
|
|
@ -265,6 +298,18 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
new Setting(containerEl)
|
||||
.setName('Book Folder')
|
||||
.setDesc('Where newly imported books should be placed.')
|
||||
.addSearch(cb => {
|
||||
new FolderSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.bookFolder)
|
||||
.setValue(this.plugin.settings.bookFolder)
|
||||
.onChange(data => {
|
||||
this.plugin.settings.bookFolder = data;
|
||||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
// endregion
|
||||
|
||||
containerEl.createEl('h3', { text: 'Template Settings' });
|
||||
|
|
@ -359,6 +404,19 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Book template')
|
||||
.setDesc('Template file to be used when creating a new note for a book.')
|
||||
.addSearch(cb => {
|
||||
new FileSuggest(this.app, cb.inputEl);
|
||||
cb.setPlaceholder('Example: bookTemplate.md')
|
||||
.setValue(this.plugin.settings.bookTemplate)
|
||||
.onChange(data => {
|
||||
this.plugin.settings.bookTemplate = data;
|
||||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
// endregion
|
||||
|
||||
containerEl.createEl('h3', { text: 'File Name Settings' });
|
||||
|
|
@ -446,6 +504,18 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Book file name template')
|
||||
.setDesc('Template for the file name used when creating a new note for a book.')
|
||||
.addText(cb => {
|
||||
cb.setPlaceholder(`Example: ${DEFAULT_SETTINGS.bookFileNameTemplate}`)
|
||||
.setValue(this.plugin.settings.bookFileNameTemplate)
|
||||
.onChange(data => {
|
||||
this.plugin.settings.bookFileNameTemplate = data;
|
||||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
// endregion
|
||||
|
||||
// region Property Mappings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue