AkbarTheGreat / cszb-scoreboard

Free scoreboard for competitive improv matches
Apache License 2.0
3 stars 0 forks source link

Have the Image Library poll for changes to the library root. #40

Open AkbarTheGreat opened 1 year ago

AkbarTheGreat commented 1 year ago

Now that the image library has a concept of a root directory, we could have it look for new files in that directory at startup, if it exists. This would simplify the use case where a user just drops files into that directory and expects them to show up without any additional effort.

BrBill commented 6 months ago

Is the library a tree or a single directory? Would this have to keep track of a very large number of files in some situations? Would a refresh button be simpler?

AkbarTheGreat commented 6 months ago

So the current setup is to add all images by hand, there's no automation for finding images at all currently, so whatever system does stuff will have to look at the filesystem and make some choices regardless of if it's a refresh button or a thing that happens at startup.

The data structure is here, and doesn't use too much crazy Protobuf magic so it's probably intuitive to read, but in case it's not, the library object holds a string that represents the root of the library and a list of library entries, each entry contains information about that given image. The Boston file structure is a tree, so I'd support traversing into directories**, but a flat structure would just be a trivial case of traversal.

** Likely directory traversal will be run with a maximum depth rather than an actual cycle detection, in case of linked directories, because cycle detection can be difficult and I don't know if I have the time to dedicate to that

BrBill commented 6 months ago

Good point about recursion; I suppose you could just ignore links if you wanted to just avoid the chances of looped recursion, but Linux and MacOS users might not like having the option to use links taken away. Windows users might use them too, but most likely don't even know hard or soft links are possible.

BrBill commented 6 months ago

JANIS refreshes by either double-clicking the image library count (old versions) or by clicking on a little refresh icon (newer versions), for whatever that info is worth. I am starting to grow leery of me talking about my own program here, as it sounds a bit vain and braggy; I hope that it comes across more as what I've learned in the journey, but if I sound arrogant let me know.