generated from tpl/obsidian-sample-plugin
Reorganize settings and add read books organizing
This commit is contained in:
parent
5a492f558c
commit
3d3e62e1ba
|
@ -70,6 +70,14 @@ export class LogReadingFinishedCommand extends EditorCheckCommand {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.settings.organizeReadBooks) {
|
||||||
|
// @ts-expect-error Moment is provided by Obsidian
|
||||||
|
const datePath = moment().format("YYYY/MMMM");
|
||||||
|
const newPath = `${this.settings.readBooksFolder}/${datePath}/${file.name}`;
|
||||||
|
|
||||||
|
await this.app.vault.rename(file, newPath);
|
||||||
|
}
|
||||||
|
|
||||||
new Notice("Reading finished for " + fileName);
|
new Notice("Reading finished for " + fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="obt-settings">
|
<div class="obt-settings">
|
||||||
<Header title="General Settings" />
|
<Header title="Folder Settings" />
|
||||||
<FolderSuggestItem
|
<FolderSuggestItem
|
||||||
{app}
|
{app}
|
||||||
id="book-folder"
|
id="book-folder"
|
||||||
|
@ -33,6 +33,20 @@
|
||||||
description="Select the folder where book entries are stored."
|
description="Select the folder where book entries are stored."
|
||||||
bind:value={$settings.bookFolder}
|
bind:value={$settings.bookFolder}
|
||||||
/>
|
/>
|
||||||
|
<FolderSuggestItem
|
||||||
|
{app}
|
||||||
|
id="tbr-folder"
|
||||||
|
name="To Be Read Folder"
|
||||||
|
description="Select the folder to use for To Be Read entries"
|
||||||
|
bind:value={$settings.tbrFolder}
|
||||||
|
/>
|
||||||
|
<FolderSuggestItem
|
||||||
|
{app}
|
||||||
|
id="read-folder"
|
||||||
|
name="Read Books Folder"
|
||||||
|
description="Select the folder to use for Read entries."
|
||||||
|
bind:value={$settings.tbrFolder}
|
||||||
|
/>
|
||||||
<ToggleItem
|
<ToggleItem
|
||||||
id="organize-read-books"
|
id="organize-read-books"
|
||||||
name="Organize Read Books"
|
name="Organize Read Books"
|
||||||
|
@ -47,13 +61,6 @@
|
||||||
description="Select the template file to use for new book entries."
|
description="Select the template file to use for new book entries."
|
||||||
bind:value={$settings.templateFile}
|
bind:value={$settings.templateFile}
|
||||||
/>
|
/>
|
||||||
<FolderSuggestItem
|
|
||||||
{app}
|
|
||||||
id="tbr-folder"
|
|
||||||
name="To Be Read Folder"
|
|
||||||
description="Select the folder to use for To Be Read entries"
|
|
||||||
bind:value={$settings.tbrFolder}
|
|
||||||
/>
|
|
||||||
<TextInputItem
|
<TextInputItem
|
||||||
id="file-name-format"
|
id="file-name-format"
|
||||||
name="File name Format"
|
name="File name Format"
|
||||||
|
@ -94,7 +101,7 @@
|
||||||
{app}
|
{app}
|
||||||
id="status-field"
|
id="status-field"
|
||||||
name="Status Field"
|
name="Status Field"
|
||||||
description="Select the folder to use for To Be Read entries."
|
description="Select the field to use for reading status."
|
||||||
bind:value={$settings.statusProperty}
|
bind:value={$settings.statusProperty}
|
||||||
accepts={["text"]}
|
accepts={["text"]}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
export interface BookTrackerSettings {
|
export interface BookTrackerSettings {
|
||||||
bookFolder: string;
|
bookFolder: string;
|
||||||
|
tbrFolder: string;
|
||||||
|
readBooksFolder: string;
|
||||||
organizeReadBooks: boolean;
|
organizeReadBooks: boolean;
|
||||||
templateFile: string;
|
templateFile: string;
|
||||||
tbrFolder: string;
|
|
||||||
fileNameFormat: string;
|
fileNameFormat: string;
|
||||||
downloadCovers: boolean;
|
downloadCovers: boolean;
|
||||||
coverFolder: string;
|
coverFolder: string;
|
||||||
|
@ -18,9 +19,10 @@ export interface BookTrackerSettings {
|
||||||
|
|
||||||
export const DEFAULT_SETTINGS: BookTrackerSettings = {
|
export const DEFAULT_SETTINGS: BookTrackerSettings = {
|
||||||
bookFolder: "books",
|
bookFolder: "books",
|
||||||
|
tbrFolder: "books/tbr",
|
||||||
|
readBooksFolder: "books/read",
|
||||||
organizeReadBooks: true,
|
organizeReadBooks: true,
|
||||||
templateFile: "",
|
templateFile: "",
|
||||||
tbrFolder: "books/tbr",
|
|
||||||
fileNameFormat: "{{title}} - {{authors}}",
|
fileNameFormat: "{{title}} - {{authors}}",
|
||||||
downloadCovers: false,
|
downloadCovers: false,
|
||||||
coverFolder: "images/covers",
|
coverFolder: "images/covers",
|
||||||
|
|
Loading…
Reference in New Issue