mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
4a9f804e70
+ port populate to new db interface
+ add genrehashes and hash info to tracks
+ properly structure new db table files
+ move helpers to dedicated utils file
+ move settings from db to config file
+ move artists, albums, auth and favorites endpoint to new db interface
+ use folder store to index filepaths
+ paginate favorite pages
+ 56 moretiny changes 😅
33 lines
691 B
Python
33 lines
691 B
Python
"""
|
|
Contains methods relating to albums.
|
|
"""
|
|
|
|
from dataclasses import asdict
|
|
from typing import Any
|
|
from itertools import groupby
|
|
|
|
|
|
from app.models.track import Track
|
|
from app.store.albums import AlbumStore
|
|
from app.store.tracks import TrackStore
|
|
|
|
|
|
def remove_duplicate_on_merge_versions(tracks: list[Track]) -> list[Track]:
|
|
"""
|
|
Removes duplicate tracks when merging versions of the same album.
|
|
"""
|
|
# TODO!
|
|
pass
|
|
|
|
|
|
def sort_by_track_no(tracks: list[Track]):
|
|
# tracks = [asdict(t) for t in tracks]
|
|
|
|
for t in tracks:
|
|
track = str(t.track).zfill(3)
|
|
t._pos = int(f"{t.disc}{track}")
|
|
|
|
tracks = sorted(tracks, key=lambda t: t._pos)
|
|
|
|
return tracks
|