TarheelGrad1998 / gallery-card

A custom card for Home Assistant that will display images and/or videos from a folder in the style of a gallery.
97 stars 30 forks source link

Maximum Files and Parsed_Date_Sort Not Working Properly Together #65

Closed clearwave1 closed 1 year ago

clearwave1 commented 1 year ago

I have a single entity that watches a single folder for updates using the HA built in folder sensor.

I've noticed that I need to use parsed_date_sort: true in order to get the correct sorted order. However, I also want to limit the size of the list by using maximum_files: 10.

What I've noticed is that it appears the code is first limiting the list of files to 10 (based on whatever order it receives them) and then performs the parsed_date_sort function. The effect is that I'm not always seeing the most recent videos because the maximum files cuts them off. I've tested this by increasing the maximum files number and the most recent videos appear.

Here is my full config:

type: custom:gallery-card
entities:
  - sensor.garage
menu_alignment: Responsive
maximum_files: 10
file_name_format: YYYYMMDD_HHmmss
caption_format: M/D h:mm A
parsed_date_sort: true
clearwave1 commented 1 year ago

I played with this a bit more and it behaves properly if I set maximum_files_per_entity to false.

You may want to update the documentation as this is not very intuitive from the description.