Reinstated check if file already exists
Plugin will no longer download a poster if it already exists, to avoid unnecessary downloads and in case the user has modified the saved image themselves
This commit is contained in:
parent
62e0f20634
commit
970432dcfb
2 changed files with 6 additions and 3 deletions
|
|
@ -37,6 +37,7 @@ Available variables that can be used in template tags are the same variables fro
|
|||
I also published my own templates [here](https://github.com/mProjectsCode/obsidian-media-db-templates).
|
||||
|
||||
#### Download poster images
|
||||
|
||||
Allows you to automatically download the poster images for a new media, ensuring offline access. The images are saved as `type_title (year)` e.g. `movie_The Perfect Storm (2000)` with a user chosen save location.
|
||||
|
||||
#### Metadata field customization
|
||||
|
|
|
|||
|
|
@ -327,8 +327,10 @@ export default class MediaDbPlugin extends Plugin {
|
|||
await this.app.vault.createFolder(this.settings.imageFolder);
|
||||
}
|
||||
|
||||
if (!this.app.vault.getAbstractFileByPath(imagepath)) {
|
||||
const response = await requestUrl({ url: imageurl, method: 'GET' });
|
||||
await this.app.vault.createBinary(imagepath, response.arrayBuffer);
|
||||
}
|
||||
|
||||
// Update model to use local image path
|
||||
mediaTypeModel.image = `[[${imagepath}]]`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue