Revise Lua to fix images.js included in images.js
The issue was that # was in the filename for multiple images. Removing that from the filename of all files in the source folder resolved it.
Original post:
Hi, for some reason, images.js is being listed inside images.js. I'm not sure what is causing this or why - could be that I use a symbolic link in Windows to populate the images folder? - but this results in the slideshow attempting to open images.js as an image even though .js isn't listed as an acceptable file format in BrowserImageSlideshow.html (const imageExtensions). The result is that, of my 49 images, one in 50 of the slideshow items is broken.
I was able to resolve it by updating both RefreshImagesW.cmd and SlideshowSettings.lua so they each exclude .js files. Might be a little messy, but I'm not a programmer, just someone who knows just enough about using StackExchange to be dangerous 😄
In RefreshImagesW.cmd, I updated line 2 to say:
dir images /b | findstr /v /i "\.js$" >> images/images.js
When I found this wasn't enough, I did some digging, and updated line 275 in SlideshowSettings.lua to say:
local files = assert(io.popen('dir "'.. script_path() .. 'images/' ..'" /b' .. ' | findstr /v /i "' .. '\\.js$' .. '"'))
Now running RefreshImagesW.cmd successfully ignores images.js and leaves it out of the list in images.js, and the same goes for when opening OBS and letting the lua run. I'm not sure if anyone else is running into this, but I don't think it would hurt to exclude images.js anyway.
Correction: with it set to Random mode, I'm still getting broken images. Only seems to happen when it doubles back to images it's already displayed. For example, this is the sort of behavior I'm getting:
- ...
- image 5 (successful)
- image 29 (successful)
- image 14 (successful)
- image 33 (successful)
- image 14 (fades in correctly, then once the fade-in animation is complete, it immediately flips to a broken state)
- image 7 (successful)
- ...
I'm not sure at this point what could be causing it
Final correction: The issue was that # was in the filename for multiple images. Removing that resolved it. I'll update the original post accordingly.
for some reason, images.js is being listed inside images.js
This is intended behaviour when a list of all files within the /images folder is generated, but it should be safely ignored later when this list is parsed in javascript.
You've already figured it out, but yeah I believe the # symbol causes problems when used in a filename. Additionally it is a special symbol for URL's, and since the slideshow images are loaded via URL (even though they are locally stored), the symbol probably also causes unintended behaviour there
Cheers (and sorry for the late reply)