JohnCoates / Aerial

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

Feature request : Old cached video aren't deleted #532

Closed Joan closed 5 years ago

Joan commented 6 years ago

Hi!

Did not find any info about this anywhere else: I cached all videos from a previous version (maybe 1.2), and just updated to 1.4 (which still displays 1.2 in the settings pane btw edit: System prefs relaunch fixed it). I cached everything again, but now I have several version of the same videos:

old: comp_C007_C011_08244D_001_v01_6M_HB_tag0
new: comp_CH_C007_C011_PSNK_v02_SDR_PS_FINAL_20180709_SDR_2K_AVC

old: comp_LA_A009_C009_t9_6M_tag0
new: comp_LA_A009_C009_PSNK_v02_SDR_PS_FINAL_20180709_SDR_2K_AVC

old: comp_C002_C005_0818SC_001_v01_6M_HB_tag0
new: comp_CH_C002_C005_PSNK_v05_SDR_PS_FINAL_20180709_SDR_2K_AVC

Etc.

Aren't the old version supposed to be deleted? Or are they still used in a way?

And since I had the opportunity to compare, most of the new video are… worst than the originals (but I suppose it's on Apple side and it's definitely subjective):

sans-titre---1

And should have say this first, but thanks so much for this stunning screensaver project! ❤️

glouel commented 6 years ago

First, still displays 1.2, please close System Preferences and open it again, this should fix it. This seems to be a bug with Swift screensavers on MacOS that aren't getting their resources completely reloaded properly on upgrading.

So, with 1.4, we use the most recent video version available (we look for them in tvos12, tvos11 and tvos10 JSONs in that order). Whether those are better or not is subjective indeed, they are more color saturated and sometimes recropped. Some are slightly less blocky too. But they are aligned in "quality" with the other video formats (HEVC 1080p and 4K) so it makes more sense for us to use the same versions independent of video format.

As of right now, we don't purge the old files, though I'll mark this as something to look at for next version !

SeanMSmith commented 6 years ago

Personally, I would prefer that old videos not be purged, at least not automatically or by default. Time Machine does not back up files in (~)/Library/Caches, and if ever Apple remove any Aerial videos from their servers, then if Aerial purges them, they may be gone for good.

(For example, if Apple had removed the 4K version of Dubai Night Two from their servers when they removed it from the tvOS 11 JSON - which was a strange thing to do, considering that video was the first one of two that Apple showed at the tvOS 11 Keynote showing off the new 4K Aerials! - then those of us who had previously cached it would not be able to fall back upon it.)

A reasonable solution might be to add a control to Aerial's Cache panel that the user can manually invoke to move unwanted versions of similar videos to the trash, perhaps with a message to review them before emptying the trash, cautioning that they will not have been backed up by Time Machine.

glouel commented 6 years ago

@SeanMSmith for sure, never ever delete anything behind the user's back.

As part of the enhancements to the cache panel (at the very list, show how big the cache currently is), I was thinking of adding maybe some sort of menu where there would be some purging options :

There are many considerations that comes with each of these, so it's not exactly a straightforward implementation. All would come with a confirmation prompt I think, some sort of list to review is a good idea although UI wise, since we're already in a sheet, slightly unsure how that would present itself (I guess a modal box). I do like the move to trash idea a lot !

WebVeteran commented 6 years ago

I was interested in adding this folder to my Plex library. Purging unused videos would be great = delete anything other than the "best available format" for each video enabled.

Can this be done inherently by deleting the entire cache manually and rebuild it? If I "Download Now" will it only grab the "best available format" for each video enabled?

Or how can we do so manually in the meantime?

glouel commented 6 years ago

Yes, it only downloads the "best available format", whatever method you use. So delete manually the videos (you can keep the 4K by filtering in finder and removing the rest, those aren't duped, but you can delete everything if you have bandwidth) and redownload -> you'll get a completely deduped directory with only best versions available.

If you use the "Download All" in the menu (below the video list in main pane), you'll see the individual videos getting downloaded as the list updates itself ;)

WebVeteran commented 6 years ago

What I found confusing is that it doesn't tell you the cache status of each version of each video. And I think there are up to four versions now (?).

glouel commented 6 years ago

The list will tell you the status of the best available format for your preferred format only. If you switch format you'll see the list update.

I had started to make a grid that showed each video in each format for the cache, but ended up scrapping it for some reason.

As for versions, there's up to 5 I think. tvOS12 JSON has 3 format, tvOS10 litteraly has duplicates in it. 1.4+ never download duplicates or "outdated" versions.

So back to your question, scrap your cache and redownload, it will be clean with one best file per video :)

glouel commented 6 years ago

Just to give some background, what Aerial 1.4 does is :

At every point, it tries to "merge" info (so for example, Liwa is only in tvOS11 JSON as 1080p HEVC and 4K HEVC, no 1080p H.264, but it's in the tvOS10 JSON as H.264, so we merge that H.264 url in the list). Merging is done by looking at the UUID of each video when possible, but we also have a list of duplicate UUID so we can merge those correctly.

On top of that, there are litteral duplicates with different names and UUID that we have to exclude, and videos that are available in lower quality that gets excluded.

Again on top of that, we merge extra info :

At the end, you get a perfectly deduplicated list with all the "best" urls for each of the 3 video format (when available) and that's what Aerial uses now :)

WebVeteran commented 6 years ago

It's a whole other world of logic.

I tossed out everything not 4K. Plex is happy =)

screen shot 2018-10-15 at 5 27 16 pm

glouel commented 5 years ago

I've now added the option to move away or trash old duplicate videos, the option is in the advanced panel. If you choose move, it will create a /oldvideos/YYYY-MM-DD/ and move the old videos there.

Only old, no longer linked videos will be moved away. It will not remove 1080p videos if you picked 4K as a format for example.

capture d ecran 2018-12-12 a 17 35 57