mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
rewrite db stuff with scalars and generators
+ dump mixes with less than x=4 artists + try: disable pragma mmap_size
This commit is contained in:
+3
-1
@@ -92,7 +92,6 @@ def get_album_tracks_and_info(body: GetAlbumInfoBody):
|
||||
og_album_title=album.og_title,
|
||||
)
|
||||
|
||||
|
||||
more_from_albums = get_more_from_artist(more_from_data)
|
||||
other_versions = get_album_versions(other_versions_data)
|
||||
|
||||
@@ -217,6 +216,9 @@ def get_similar_albums(query: GetSimilarAlbumsQuery):
|
||||
return []
|
||||
|
||||
artisthashes = similar_artists.get_artist_hash_set()
|
||||
|
||||
del similar_artists
|
||||
|
||||
artists = ArtistStore.get_artists_by_hashes(artisthashes)
|
||||
albums = AlbumStore.get_albums_by_artisthashes([a.artisthash for a in artists])
|
||||
sample = random.sample(albums, min(len(albums), limit))
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ def get_pages():
|
||||
"""
|
||||
Get all pages.
|
||||
"""
|
||||
return PageTable.get_all()
|
||||
return [page for page in PageTable.get_all()]
|
||||
|
||||
|
||||
class AddPageItemBody(BaseModel):
|
||||
|
||||
+19
-6
@@ -101,6 +101,11 @@ def send_all_playlists(query: SendAllPlaylistsQuery):
|
||||
Gets all the playlists.
|
||||
"""
|
||||
playlists = PlaylistTable.get_all()
|
||||
playlists = sorted(
|
||||
playlists,
|
||||
key=lambda p: datetime.strptime(p.last_updated, "%Y-%m-%d %H:%M:%S"),
|
||||
reverse=True,
|
||||
)
|
||||
|
||||
for playlist in playlists:
|
||||
if not playlist.has_image:
|
||||
@@ -110,10 +115,10 @@ def send_all_playlists(query: SendAllPlaylistsQuery):
|
||||
|
||||
playlist.clear_lists()
|
||||
|
||||
playlists.sort(
|
||||
key=lambda p: datetime.strptime(p.last_updated, "%Y-%m-%d %H:%M:%S"),
|
||||
reverse=True,
|
||||
)
|
||||
# playlists.sort(
|
||||
# key=lambda p: datetime.strptime(p.last_updated, "%Y-%m-%d %H:%M:%S"),
|
||||
# reverse=True,
|
||||
# )
|
||||
|
||||
return {"data": playlists}
|
||||
|
||||
@@ -175,7 +180,11 @@ def add_item_to_playlist(path: PlaylistIDPath, body: AddItemToPlaylistBody):
|
||||
if itemtype == "tracks":
|
||||
trackhashes = itemhash.split(",")
|
||||
elif itemtype == "folder":
|
||||
trackhashes = get_path_trackhashes(itemhash, sortoptions.get("tracksortby") or 'default', sortoptions.get("tracksortreverse") or False)
|
||||
trackhashes = get_path_trackhashes(
|
||||
itemhash,
|
||||
sortoptions.get("tracksortby") or "default",
|
||||
sortoptions.get("tracksortreverse") or False,
|
||||
)
|
||||
elif itemtype == "album":
|
||||
trackhashes = get_album_trackhashes(itemhash)
|
||||
elif itemtype == "artist":
|
||||
@@ -408,7 +417,11 @@ def save_item_as_playlist(body: SavePlaylistAsItemBody):
|
||||
if itemtype == "tracks":
|
||||
trackhashes = itemhash.split(",")
|
||||
elif itemtype == "folder":
|
||||
trackhashes = get_path_trackhashes(itemhash, sortoptions.get("tracksortby") or 'default', sortoptions.get("tracksortreverse") or False)
|
||||
trackhashes = get_path_trackhashes(
|
||||
itemhash,
|
||||
sortoptions.get("tracksortby") or "default",
|
||||
sortoptions.get("tracksortreverse") or False,
|
||||
)
|
||||
elif itemtype == "album":
|
||||
trackhashes = get_album_trackhashes(itemhash)
|
||||
elif itemtype == "artist":
|
||||
|
||||
+2
-2
@@ -95,14 +95,14 @@ def get_all_settings():
|
||||
Get all settings
|
||||
"""
|
||||
config = asdict(UserConfig())
|
||||
plugins = PluginTable.get_all()
|
||||
config["plugins"] = plugins
|
||||
config["plugins"] = [p for p in PluginTable.get_all()]
|
||||
config["version"] = Info.SWINGMUSIC_APP_VERSION
|
||||
|
||||
# hide lastfmSessionKeys for other users
|
||||
current_user = get_current_userid()
|
||||
config["lastfmSessionKey"] = config["lastfmSessionKeys"].get(str(current_user), "")
|
||||
del config["lastfmSessionKeys"]
|
||||
|
||||
return config
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user