diff --git a/README.md b/README.md index 79dd6f8..dd48ea0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main.ts b/src/main.ts index 8240617..6128cd4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -327,9 +327,11 @@ export default class MediaDbPlugin extends Plugin { await this.app.vault.createFolder(this.settings.imageFolder); } - const response = await requestUrl({ url: imageurl, method: 'GET' }); - await this.app.vault.createBinary(imagepath, response.arrayBuffer); - + 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}]]`; } catch (e) {