sort files by creation date

This commit is contained in:
geoffrey45
2022-03-02 15:12:13 +03:00
parent 59646ce7f1
commit 6931cd926c
4 changed files with 77 additions and 15 deletions
+10 -4
View File
@@ -45,6 +45,8 @@ def reindex_tracks():
while flag is False:
functions.populate()
functions.populate_images()
# functions.save_t_colors()
time.sleep(300)
@@ -153,17 +155,21 @@ def get_all_songs() -> List[models.Track]:
for track in instances.songs_instance.get_all_songs():
try:
os.chmod(os.path.join(track["filepath"]), 0o755)
os.chmod(track["filepath"], 0o755)
except FileNotFoundError:
instances.songs_instance.remove_song_by_filepath(track["filepath"])
tracks.append(functions.create_track_class(track))
tracks.append(models.Track(track))
return tracks
def extract_colors(image) -> list:
colors = sorted(colorgram.extract(image, 2), key=lambda c: c.hsl.h)
"""Extracts 2 of the most dominant colors from an image."""
try:
colors = sorted(colorgram.extract(image, 2), key=lambda c: c.hsl.h)
except OSError:
return []
formatted_colors = []
@@ -184,4 +190,4 @@ def get_album_duration(album: List[models.Track]) -> int:
for track in album:
album_duration += track.length
return album_duration
return album_duration