mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
add help text to recently played
+ read app version from the env
This commit is contained in:
@@ -42,9 +42,9 @@ class Albums(Resource):
|
||||
|
||||
sort_is_count = sort == "count"
|
||||
sort_is_duration = sort == "duration"
|
||||
sort_is_create_date = sort == "created_date"
|
||||
|
||||
sort_is_date = is_albums and sort == "date"
|
||||
sort_is_create_date = is_albums and sort == "created_date"
|
||||
sort_is_artist = is_albums and sort == "albumartists"
|
||||
|
||||
sort_is_artist_trackcount = is_artists and sort == "trackcount"
|
||||
|
||||
+3
-2
@@ -5,7 +5,7 @@ from app.db.sqlite.settings import SettingsSQLMethods as sdb
|
||||
from app.lib import populate
|
||||
from app.lib.watchdogg import Watcher as WatchDog
|
||||
from app.logger import log
|
||||
from app.settings import Paths, SessionVarKeys, set_flag
|
||||
from app.settings import Keys, Paths, SessionVarKeys, set_flag
|
||||
from app.store.albums import AlbumStore
|
||||
from app.store.artists import ArtistStore
|
||||
from app.store.tracks import TrackStore
|
||||
@@ -182,7 +182,8 @@ def get_all_settings():
|
||||
|
||||
root_dirs = sdb.get_root_dirs()
|
||||
s["root_dirs"] = root_dirs
|
||||
s['plugins'] = plugins
|
||||
s["plugins"] = plugins
|
||||
s["version"] = Keys.SWINGMUSIC_APP_VERSION
|
||||
|
||||
return {
|
||||
"settings": s,
|
||||
|
||||
@@ -47,6 +47,7 @@ class HandleArgs:
|
||||
"LASTFM_API_KEY",
|
||||
"PLUGIN_LYRICS_AUTHORITY",
|
||||
"PLUGIN_LYRICS_ROOT_URL",
|
||||
"SWINGMUSIC_APP_VERSION",
|
||||
]
|
||||
|
||||
lines = []
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
LASTFM_API_KEY = ""
|
||||
PLUGIN_LYRICS_AUTHORITY = ""
|
||||
PLUGIN_LYRICS_ROOT_URL = ""
|
||||
SWINGMUSIC_APP_VERSION = ""
|
||||
|
||||
@@ -176,7 +176,6 @@ def get_recent_items(cutoff_days: int, limit: int = 7):
|
||||
older_artists.add(t.artist_hashes)
|
||||
|
||||
tracks = sorted(tracks, key=lambda t: t.created_date)
|
||||
|
||||
groups = group_track_by_folders(tracks)
|
||||
|
||||
recent_items = []
|
||||
|
||||
@@ -48,6 +48,7 @@ def get_recently_played(limit=7):
|
||||
"og_title",
|
||||
},
|
||||
)
|
||||
album["help_text"] = "album"
|
||||
|
||||
items.append({"type": "album", "item": album})
|
||||
continue
|
||||
@@ -59,6 +60,7 @@ def get_recently_played(limit=7):
|
||||
continue
|
||||
|
||||
artist = serialize_for_card(artist)
|
||||
artist["help_text"] = "artist"
|
||||
|
||||
items.append({"type": "artist", "item": artist})
|
||||
|
||||
@@ -71,6 +73,7 @@ def get_recently_played(limit=7):
|
||||
continue
|
||||
|
||||
track = serialize_track(track)
|
||||
track["help_text"] = "track"
|
||||
|
||||
items.append({"type": "track", "item": track})
|
||||
|
||||
@@ -93,6 +96,7 @@ def get_recently_played(limit=7):
|
||||
"item": {
|
||||
"path": entry.type_src,
|
||||
"count": count,
|
||||
"help_text": "folder",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -104,12 +108,16 @@ def get_recently_played(limit=7):
|
||||
if is_recently_added:
|
||||
playlist, _ = get_recently_added_playlist()
|
||||
playlist.images = [i["image"] for i in playlist.images]
|
||||
|
||||
playlist = serialize_playlist(
|
||||
playlist, to_remove={"settings", "duration"}
|
||||
)
|
||||
|
||||
playlist["help_text"] = "playlist"
|
||||
items.append(
|
||||
{
|
||||
"type": "playlist",
|
||||
"item": serialize_playlist(
|
||||
playlist, to_remove={"settings", "duration"}
|
||||
),
|
||||
"item": playlist,
|
||||
}
|
||||
)
|
||||
continue
|
||||
@@ -126,6 +134,11 @@ def get_recently_played(limit=7):
|
||||
images = [i["image"] for i in images]
|
||||
playlist.images = images
|
||||
|
||||
items.append({"type": "playlist", "item": serialize_playlist(playlist)})
|
||||
items.append(
|
||||
{
|
||||
"type": "playlist",
|
||||
"item": {"help_text": "playlist", **serialize_playlist(playlist)},
|
||||
}
|
||||
)
|
||||
|
||||
return items
|
||||
|
||||
+3
-1
@@ -242,6 +242,7 @@ class Keys:
|
||||
LASTFM_API_KEY = os.environ.get("LASTFM_API_KEY")
|
||||
PLUGIN_LYRICS_AUTHORITY = os.environ.get("PLUGIN_LYRICS_AUTHORITY")
|
||||
PLUGIN_LYRICS_ROOT_URL = os.environ.get("PLUGIN_LYRICS_ROOT_URL")
|
||||
SWINGMUSIC_APP_VERSION = os.environ.get("SWINGMUSIC_APP_VERSION")
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
@@ -249,6 +250,7 @@ class Keys:
|
||||
cls.LASTFM_API_KEY = configs.LASTFM_API_KEY
|
||||
cls.PLUGIN_LYRICS_AUTHORITY = configs.PLUGIN_LYRICS_AUTHORITY
|
||||
cls.PLUGIN_LYRICS_ROOT_URL = configs.PLUGIN_LYRICS_ROOT_URL
|
||||
cls.SWINGMUSIC_APP_VERSION = Release.APP_VERSION
|
||||
|
||||
cls.verify_keys()
|
||||
|
||||
@@ -260,4 +262,4 @@ class Keys:
|
||||
|
||||
@classmethod
|
||||
def get(cls, key: str):
|
||||
return getattr(cls, key, None)
|
||||
return getattr(cls, key, None)
|
||||
|
||||
Reference in New Issue
Block a user