mvysny / photocloud-frame-slideshow

Android Digital Photo Frame
https://www.android-photo-frame.eu
15 stars 1 forks source link

Improve randomization of the stream #56

Closed mvysny closed 6 years ago

mvysny commented 6 years ago

To avoid OutOfMemory errors, the stream crawler will only fetch 100 files and then block until the files has been shown. However, if you have a folder with 1000+ photos, the crawler will block until the whole folder is enumerated and all images are shown, only then it moves further to the next folder. During that time, PhotoCloud is perceived as being "stuck" in one directory.

This definitely hinders the randomization order since if there are more folders with 1000+ photos, a true randomization engine should alternate between photos in all of those folders.

There are multiple possibilities on how to tackle this:

  1. One solution would be to crawl everything, fetch unlimited number of files and store the file list into a local SQLite database, thus saving memory.
  2. Modify the algorithm so that it would remember more than one dir at a time, and would return files from all of those dirs. However, if those dirs are large, that would cause OOM, so this is probably not the way to go.

I will probably go with 1. since it's the easiest one.

mvysny commented 6 years ago

Implemented the database-based randomization in 1.10.5

Brun059 commented 6 years ago

Thank you, I was just about raise an issue about incomplete randomization - and then saw that you just fixed it with 1.10.5. . As usual, very fast and responsive.

Have a Merry Christmas and a Happy New Year

mvysny commented 6 years ago

Thank you, have a Merry Christmas and a Happy New year too :)

mvysny commented 6 years ago

As explained in #36 , pictures closer towards the root of the file system tend to be shown at the start of the slideshow. That happens because of the way how photos are discovered, and there is nothing we can do about it :(

However, if you give the slideshow a bit of time, it will discover more photos in the background. Thanks to this feature request, there is no limit now, and hence the randomization will improve drastically with every photo discovered.