Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Some pictures are displayed multiples times a day - How are the images selected to be shown? #138

Closed
hajo62 opened this issue Mar 4, 2024 · 18 comments
Labels
enhancement New feature or request

Comments

@hajo62
Copy link

hajo62 commented Mar 4, 2024

I wonder, how you randomise the displayed images and if it is the intended use, that roughly 15-20% images are displayed more than once a day although there are more than enough images not displayed.

In numbers:
Yesterday I had 486 images in the +/- 3 day range found by your algo.
251 images had been displayed but only
207 uniq images.

I assume, you fill a list and randomly pick images from that list?

If so, might be filling a list, once randomise the order of that list and than pick images one by one be an idea to avoid twice (or more times) displaying the same image be an idea? When reaching the end of the list, just start at the beginning or do a new randomisation.

Caveat: I have no idea if such a list is hold on the server or in the browser a client side? If on server side, all clients would display the images in the same order.

@RouHim
Copy link
Owner

RouHim commented Mar 4, 2024

That is exactly what I do. I randomize on server side and the web client receives this list. The client then iterates the randomized list one by one.

@hajo62
Copy link
Author

hajo62 commented Mar 4, 2024

Hhm,
strange. I see several images more than once a day...

this-week-in-past  | [2024-03-04T16:35:44Z DEBUG this_week_in_past::resource_endpoint] Resource: ImageResource { id: "ab369b96f6fb5c733a3c2ce2a14371c9", path: "/resources/2020/2020.03/20200301_202524.jpg", content_type: "image/jpeg", name: "20200301_202524.jpg", content_length: 3014679, last_modified: 2020-03-01T19:25:24, taken: Some(2020-03-01T20:25:24), location: Some(GeoLocation { latitude: 47.131153, longitude: 10.0831 }), orientation: None }
this-week-in-past  | [2024-03-04T17:17:08Z DEBUG this_week_in_past::resource_endpoint] Resource: ImageResource { id: "ab369b96f6fb5c733a3c2ce2a14371c9", path: "/resources/2020/2020.03/20200301_202524.jpg", content_type: "image/jpeg", name: "20200301_202524.jpg", content_length: 3014679, last_modified: 2020-03-01T19:25:24, taken: Some(2020-03-01T20:25:24), location: Some(GeoLocation { latitude: 47.131153, longitude: 10.0831 }), orientation: None }

I produce the numbers on the logs with:

docker-compose logs this-week-in-past | sed -e 's/Z DEBUG.*path:/] |/g' -e 's/, content_type.*taken: / | taken: /g' -e 's/, location.*//g' | grep `date "+%Y-%m-%d"` | grep taken | awk -F '|' '{print $2,$4,$3}' | grep -e "..........T........" | cut -d '"' -f2 | sort |  uniq | wc -l

Remove uniq for total number of displayed images.

@RouHim
Copy link
Owner

RouHim commented Mar 5, 2024

I think what breaks the random factor is the value of REFRESH_INTERVAL. Every time this is reached, a new random list is generated.

@hajo62
Copy link
Author

hajo62 commented Mar 5, 2024

Is it necessary to generate a new list every time?

What about having a kind of hash or time stamp for the server side list and regenerate the client side list only if that hash has changed or the time stamp is younger that on client side.

@RouHim
Copy link
Owner

RouHim commented Mar 5, 2024

Thats the way how to client ensures to get new images from the server side. If this does not fit your needs, you could just turn up the interval. This should fix the issue.
It is designed this way, as always, to keep it maximum simple :)

(Just keep in mind that turning up the interval, might increase the detection latency for new images)

@hajo62
Copy link
Author

hajo62 commented Mar 5, 2024

(Just keep in mind that turning up the interval, might increase the detection latency for new images)

Had that in mind. Therefore I think you've chosen a good default value and increasing that value would just start later with showing duplicates.

But nevertheless and without knowledge of how you realised your project: If it is possible to fetch a time stamp for the server side images list, an additional compare should make the design not too complicated.

@RouHim
Copy link
Owner

RouHim commented Mar 5, 2024

Yeah I know, but I'm basically always out of time, thus if things are not really broken I most likely will not touch them :D
Nevertheless I'm happy for any PR ;)

@hajo62 hajo62 changed the title QUESTION: How are the images selected to be shown? Enhancement: Some pictures are displayed multiples times a day - How are the images selected to be shown? Mar 5, 2024
@hajo62
Copy link
Author

hajo62 commented Mar 5, 2024

It's okay to reuse this question as an RFE?

Solving this might be good for a rainy day...

By the way: Love that app and found wrong or missing meta data in very old fotos.

@RouHim
Copy link
Owner

RouHim commented Mar 5, 2024

Great to hear, yeah sure, go for it!

@RouHim RouHim added the enhancement New feature or request label Mar 5, 2024
@hajo62
Copy link
Author

hajo62 commented Mar 15, 2024

Solving this might be good for a rainy day...

Looks like there are some rainy days ahead 🤣
image

OFFTOPIC:
I assume, you run your Home Assistant (as well as this-week-in-past) on docker?
If so, do you have a sensor or similar, which shows docker images, which have an update available?

@RouHim
Copy link
Owner

RouHim commented Mar 15, 2024

I'm provisioning my local infrastructure at home via truenas scale. But maybe this is what you are looking for:
https://github.com/containrrr/watchtower

@RouHim RouHim changed the title Enhancement: Some pictures are displayed multiples times a day - How are the images selected to be shown? [FEATURE] Some pictures are displayed multiples times a day - How are the images selected to be shown? Apr 11, 2024
@hajo62
Copy link
Author

hajo62 commented May 23, 2024

I think what breaks the random factor is the value of REFRESH_INTERVAL

Not sure, if that works.
Changed the url to ... which I understand as 12 h till refresh, but still have lots of duplicates within this interval.
http://<url>?WEATHER_ENABLED=false&REFRESH_INTERVAL=720

I did the refresh manually in the morning and i.e. today I have roughly 15% duplicates.

@hajo62
Copy link
Author

hajo62 commented Sep 4, 2024

Regarding your suggestion to go with longer refresh intervals: I assume, that the refresh isn't the cause.
Although, I've set the interval to 12h, some images are displayed often a day. Here stripped log parts...

 [2024-09-04T08:36:06]   taken: Some(2007-09-01T18:16:56)  "/resources/.../Picture 095.jpg" 
 [2024-09-04T14:04:32]   taken: Some(2007-09-01T18:16:56)  "/resources/.../Picture 095.jpg" 
 [2024-09-04T14:36:32]   taken: Some(2007-09-01T18:16:56)  "/resources/.../Picture 095.jpg" 
 [2024-09-04T15:26:32]   taken: Some(2007-09-01T18:16:56)  "/resources/.../Picture 095.jpg" 

or

 [2024-09-04T06:32:35]   taken: Some(2007-09-01T12:35:51)  "/resources/.../Picture 013.jpg" 
 [2024-09-04T14:28:32]   taken: Some(2007-09-01T12:35:51)  "/resources/.../Picture 013.jpg" 
 [2024-09-04T15:56:34]   taken: Some(2007-09-01T12:35:51)  "/resources/.../Picture 013.jpg" 

@RouHim
Copy link
Owner

RouHim commented Sep 4, 2024

That's Ok, when there are to less images to fill the 12 hours. Then there are images that will be shown multiple times, because the slideshow restarts automatically at the beginning.

@hajo62
Copy link
Author

hajo62 commented Sep 4, 2024

I thought so, too, but: The app found about 250 images, each displayed 2 mins, which should be enough for more than 8 hours.
And the images repeated after roughly 6h, 30 min and again 50 mins.

@joe128
Copy link

joe128 commented Sep 6, 2024

I noticed the problem when RANDOM SLIDESHOW is enabled. Then a new random image is fetched for each “slideshowTick”.
I think it would be better in this case if "all resources" were loaded and played.
For my use case I create a set of images for an event (e.g. a birthday) that has taken place on different days (greater than +/- 3 days) over the years, which makes the RANDOM SLIDESHOW config necessary.

@RouHim
Copy link
Owner

RouHim commented Sep 13, 2024

Please, if you think you have found an issue:

  1. Make your issue reproducible with the smallest possible set of data
  2. If you think you REALLY found an issue: Create an issue
  3. Share your data / config / steps to reproduce with me (Also possible via email)

If you need space to discuss, please do it here: https://github.com/RouHim/this-week-in-past/discussions/

@hajo62 Same goes for #148

I don't want to sound rude, but it's like always. This is a hobby project that I'm doing besides family / work, so I have not much time. That's why I need your help if you have found a bug.

@joe128 I'm pretty sure the random config is pretty buggy. So if you found something, please follow step 1-3 ;)

Thanks

@RouHim RouHim closed this as completed Sep 13, 2024
@hajo62
Copy link
Author

hajo62 commented Sep 13, 2024

3. Also possible via email

Where do I find your mail address to send test data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants