JohnCoates / Aerial

Apple TV Aerial Screensaver for Mac
MIT License
20.77k stars 1.05k forks source link

Avoid showing the same videos between runs #1275

Open jamesreprise opened 1 year ago

jamesreprise commented 1 year ago

General troubleshooting tips

Before logging an issue please check that:

If none of this fixes your issue, tell us about the problem you are experiencing or the feature you'd like to request.

Required information

In order to help us sort your issue, we ask that you provide the following information:

If appropriate, please enable Debug mode and Log to disk in Advanced tab and replicate your bug, then attach the AerialLog.txt file (You can access this file through the Advanced tab).

Description of issue / Feature request

Currently, it seems that the video shown when the screensaver is started are picked by creating a playlist, filtering out by user preferences and then picking the first from the .shuffled() list. After using Aerial for a little while, I still haven't seen some videos on my list while having seen others multiple times in a day. Note that this is not repeated videos within a single playlist.

I can think of two approaches that would remedy the problem:

  1. Keep the same playlist between screensaver sessions. A set of videos is already generated, so Aerial could keep running through that playlist between runs. This would involve some logic to invalidate the playlist when the set of acceptable videos changes due to user settings or cache-related reasons.
  2. Store a timestamp for each video according to when it was shown. Storing these times locally allows you to keep generating new playlists in line with the current approach, but would require a little extra logic to sort the videos by least recently seen and to actually store and retrieve this data as needed. However, it would mean that the list of videos would endlessly repeat itself with no randomness at all. Perhaps we could cut off the most recent 20-30% of videos and then shuffle to maintain some variety?

I think the second approach would be easier to implement. I would be willing to have a go at making a PR if there is support for it.

glouel commented 1 year ago

Hey @jamesreprise

Can you make sure that in Time, you didn't enable to show different videos at different time of the day ? That does restrict stuff a lot.

Also, it will shuffle only from what's cached, so if you keep a smallish cache (say 5 GB), and enable all videos, you'll definitely have that impression of rotating the same and not seeing some.

I can see those things being more of an issue that shuffle always shuffling the same way ? Seems a bit weird.

jamesreprise commented 1 year ago

Unfortunately my settings are to play anything at random and I have an unlimited cache, see below.

I think this is some form of https://en.wikipedia.org/wiki/Birthday_problem, where it's surprisingly likely to see the same video first across only a few playlists despite the fact that I have ~90 videos in my rotation.

Let me know if you think either of the approaches I gave are viable for Aerial and something you would have the time to review.

image image
glouel commented 1 year ago

Hey again

I'm surprised to hear it's that bad, as I don't think I've heard complaints that weren't related to those two things I cited. Also some videos are really similar which doesn't help.

Anyway, regarding the possible approaches : 1) I don't think that one is really workable. There's not just "one" playlist, if you have multiple screens in some configurations you'll have multiple playlists, and those monitors may not be constant, so that would be a huge mess to entertain (+ your playlist would become 4 playlists if I restrict videos by time... or 2 with Light Mode/Dark Mode... so many options) 2) I can see some merit to keeping some form of last played date in general, but finding the right mix is going to be extremely highly subjective (and adding one more slider for that seems a bit extreme, says the guy who already added sooo manyyyy "how many people can possibly use that" feature as I have a hard time saying no ;)).

In general, I kinda have plans to add - at some point - playlist support, because it's been requested, but it has the same issues as 1), the multiple monitors situations with independent videos makes it a mess (and sadly you can't really share a list without doing weird stuff, as on some macOS versions you aren't sharing the same process between those AerialViews).

I kinda think that playlist support would fix your need without messing with shuffling, but messing with shuffling is likely a lot easier.

I'll think about it for a bit !