generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support both playing local files and writing notes & creating timestamps on local files.
- Loading branch information
Showing
9 changed files
with
131 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { StoreController } from 'src/types/StoreController'; | ||
import { Playlist } from 'src/types/Playlist'; | ||
import { LOCAL_FILES_SETTINGS } from 'src/constants'; | ||
import { IPodNotes } from 'src/types/IPodNotes'; | ||
import { Writable } from 'svelte/store'; | ||
|
||
export class LocalFilesController extends StoreController<Playlist> { | ||
private plugin: IPodNotes; | ||
|
||
constructor(store: Writable<Playlist>, plugin: IPodNotes) { | ||
super(store) | ||
this.plugin = plugin; | ||
} | ||
|
||
protected onChange(value: Playlist) { | ||
this.plugin.settings.localFiles = { | ||
...value, | ||
// To ensure we always keep the correct playlist name | ||
...LOCAL_FILES_SETTINGS | ||
}; | ||
|
||
this.plugin.saveSettings(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { TFile } from "obsidian"; | ||
|
||
export async function createUrlObjectFromFilePath(filePath: string) { | ||
const file = app.vault.getAbstractFileByPath(filePath); | ||
if (!file || !(file instanceof TFile)) return ''; | ||
|
||
const binary = await app.vault.readBinary(file); | ||
|
||
return URL.createObjectURL(new Blob([binary], { type: "audio/mpeg" })); | ||
} |