Update photo url input to photo path/url to be consistent with item covers

This commit is contained in:
advplyr 2022-06-18 12:05:30 -05:00
parent f79b4d44b9
commit 35ab4cb2fe
3 changed files with 22 additions and 23 deletions

View file

@ -4,6 +4,7 @@ const Path = require('path')
const Audnexus = require('../providers/Audnexus')
const { downloadFile } = require('../utils/fileUtils')
const filePerms = require('../utils/filePerms')
class AuthorFinder {
constructor() {
@ -38,7 +39,11 @@ class AuthorFinder {
async saveAuthorImage(authorId, url) {
var authorDir = this.AuthorPath
var relAuthorDir = Path.posix.join('/metadata', 'authors')
await fs.ensureDir(authorDir)
if (!await fs.pathExists(authorDir)) {
await fs.ensureDir(authorDir)
await filePerms.setDefault(authorDir)
}
var imageExtension = url.toLowerCase().split('.').pop()
var ext = imageExtension === 'png' ? 'png' : 'jpg'