Atelaes / Mynda

An electron based media library
0 stars 0 forks source link

Other problems with artwork downloading #78

Open JohnMTorgerson opened 3 years ago

JohnMTorgerson commented 3 years ago

Currently on line 242 of OmdbHelper.js:

fileName = fileName.replaceAll(/[\*\."/\\\[\]:;\|,]/g, '') + fileExt;

replaceAll is throwing an error (some Stack Overflow thread said Node just doesn't have that function). Since that line isn't in a try block, the error stops OmdbHelper from downloading the artwork, but then MynEditArtwork tries to download it too, through downloadFile() in index.js, which sends a success message that only OmdbHelper.js is listening for now (MynEditArtwork used to), but it probably isn't listening because of the error, and I'm frankly a little confused about how this is all supposed to work. The downloadArt() function in OmdbHelper and the downloadFile() function in index.js seem to be doing basically the same thing (except that they resolve different values on success). MynEditArtwork used to handle all the downloading itself, it would just be alerted when the search results came in and replaced the artwork field with a remote link. That code is all still there, but now the search results also try to download the file?

We can actually just use replace() instead of replaceAll() I think, with a global regex, in that OmdbHelper line, but when I try that, other mysterious errors appear. Search results that should have artwork appear with no artwork, but only sometimes?