implement CLI password recovery (hacky :omg:)

+ rewrite migrations logic
+ rename encode_password to hash_password
+ update image sizes (add medium size)
+ rename image endpoints
This commit is contained in:
cwilvx
2024-05-11 21:26:03 +03:00
parent 1e857c1e89
commit b40f05cc7c
21 changed files with 306 additions and 152 deletions
+41 -17
View File
@@ -45,22 +45,24 @@ class Paths:
def get_img_path(cls):
return join(cls.get_app_dir(), "images")
# ARTISTS
@classmethod
def get_artist_img_path(cls):
return join(cls.get_img_path(), "artists")
@classmethod
def get_artist_img_sm_path(cls):
def get_sm_artist_img_path(cls):
return join(cls.get_artist_img_path(), "small")
@classmethod
def get_artist_img_lg_path(cls):
return join(cls.get_artist_img_path(), "large")
def get_md_artist_img_path(cls):
return join(cls.get_artist_img_path(), "medium")
@classmethod
def get_playlist_img_path(cls):
return join(cls.get_img_path(), "playlists")
def get_lg_artist_img_path(cls):
return join(cls.get_artist_img_path(), "large")
# TRACK THUMBNAILS
@classmethod
def get_thumbs_path(cls):
return join(cls.get_img_path(), "thumbnails")
@@ -69,10 +71,23 @@ class Paths:
def get_sm_thumb_path(cls):
return join(cls.get_thumbs_path(), "small")
@classmethod
def get_xsm_thumb_path(cls):
return join(cls.get_thumbs_path(), "xsmall")
@classmethod
def get_md_thumb_path(cls):
return join(cls.get_thumbs_path(), "medium")
@classmethod
def get_lg_thumb_path(cls):
return join(cls.get_thumbs_path(), "large")
# OTHERS
@classmethod
def get_playlist_img_path(cls):
return join(cls.get_img_path(), "playlists")
@classmethod
def get_assets_path(cls):
return join(Paths.get_app_dir(), "assets")
@@ -92,12 +107,25 @@ class Paths:
# defaults
class Defaults:
THUMB_SIZE = 512
SM_THUMB_SIZE = 128
"""
Contains default values for various settings.
XSM_THUMB_SIZE: extra small thumbnail size for web client tracklist
SM_THUMB_SIZE: small thumbnail size for android client tracklist
MD_THUMB_SIZE: medium thumbnail size for web client album cards
LG_THUMB_SIZE: large thumbnail size for web client now playing album art
NOTE: LG_ARTIST_IMG_SIZE is not defined as the images are saved in the original size (500px)
"""
XSM_THUMB_SIZE = 64
SM_THUMB_SIZE = 96
MD_THUMB_SIZE = 256
LG_THUMB_SIZE = 512
SM_ARTIST_IMG_SIZE = 128
"""
The size of extracted images in pixels
"""
MD_ARTIST_IMG_SIZE = 256
HASH_LENGTH = 10
API_ALBUMHASH = "bfe300e966"
API_ARTISTHASH = "cae59f1fc5"
@@ -105,7 +133,6 @@ class Defaults:
API_ALBUMNAME = "The Goat"
API_ARTISTNAME = "Polo G"
API_TRACKNAME = "Martin & Gina"
API_CARD_LIMIT = 6
@@ -162,6 +189,8 @@ class ALLARGS:
host = "--host"
config = "--config"
pswd = "--pswd"
show_feat = ("--show-feat", "-sf")
show_prod = ("--show-prod", "-sp")
dont_clean_albums = ("--no-clean-albums", "-nca")
@@ -275,6 +304,7 @@ class Info:
NOTE: This class initially written to load keys when running in build mode.
TODO: Remove this class entirely, and implement functionality where needed.
"""
SWINGMUSIC_APP_VERSION = os.environ.get("SWINGMUSIC_APP_VERSION")
GIT_LATEST_COMMIT_HASH = "<unset>"
GIT_CURRENT_BRANCH = "<unset>"
@@ -289,12 +319,6 @@ class Info:
cls.GIT_LATEST_COMMIT_HASH = getLatestCommitHash()
cls.GIT_CURRENT_BRANCH = getCurrentBranch()
cls.verify_keys()
@classmethod
def verify_keys(cls):
pass
@classmethod
def get(cls, key: str):
return getattr(cls, key, None)