dustymethod / BrowserImageSlideshow

A browser-based slideshow for OBS
The Unlicense
36 stars 5 forks source link

Revise Lua to fix images.js included in images.js #8

Open amphyvi opened 1 month ago

amphyvi commented 1 month ago

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.

amphyvi commented 3 weeks ago

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:

I'm not sure at this point what could be causing it

amphyvi commented 3 weeks ago

Final correction: The issue was that # was in the filename for multiple images. Removing that resolved it. I'll update the original post accordingly.