From 383c24511f83f921d285404daee03aa38e654b47 Mon Sep 17 00:00:00 2001 From: krateng Date: Sun, 12 Dec 2021 13:53:02 +0100 Subject: [PATCH] Added ability to add custom css files, fix GH-79 --- README.md | 6 +++--- maloja/data_files/config/custom_css/customcss.info | 1 + maloja/globalconf.py | 1 + maloja/server.py | 5 +++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 maloja/data_files/config/custom_css/customcss.info diff --git a/README.md b/README.md index 814727e..3fedd34 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,13 @@ You can check [my own Maloja page](https://maloja.krateng.ch) to see what it loo ## Features * **Self-hosted**: You will always be able to access your data in an easily-parseable format. Your library is not synced with any public or official music database, so you can follow your own tagging schema. -* **Associated Artists**: Compare different artist's popularity in your listening habits including subunits, collaboration projects or solo performances by their members. Change these associations at any time without losing any information. +* **Associated Artists**: Compare different artists' popularity in your listening habits including subunits, collaboration projects or solo performances by their members. Change these associations at any time without losing any information. * **Multi-Artist Tracks**: Some artists often collaborate with others or are listed under "featuring" in the track title. Instead of tracking each combination of artists, each individual artist competes in your charts. * **Custom Images**: Don't rely on the community to select the best pictures for your favorite artists. Upload your own so that your start page looks like you want it to look. * **Proxy Scrobble**: No need to fully commit or set up every client twice - you can configure your Maloja server to forward your scrobbles to other services. * **Standard-compliant API**: Use existing, mature apps or extensions to scrobble to your Maloja server. * **Manual Scrobbling**: Listening to vinyl or elevator background music? Simply submit a scrobble with the web interface. -* **Keep it Simple**: Unlike Last.fm and similar alternatives, Maloja doesn't have social networking, radios, recommendations or any other gimmicks. It's a tool to keep track of your listening habits over time. +* **Keep it Simple**: Unlike Last.fm and similar alternatives, Maloja doesn't have social networking, radios, recommendations or any other gimmicks. It's a tool to keep track of your listening habits over time - and nothing more. ## How to install @@ -138,7 +138,7 @@ If you're the maintainer of a music player or server and would like to implement ### Standard-compliant API -You can use any third-party scrobbler that supports the audioscrobbler (GNUFM) or the ListenBrainz protocol. This is still very experimental, but give it a try with these settings: +You can use any third-party scrobbler that supports the audioscrobbler (GNUFM) or the ListenBrainz protocol. This is still somewhat experimental, but give it a try with these settings: GNU FM |   ------ | --------- diff --git a/maloja/data_files/config/custom_css/customcss.info b/maloja/data_files/config/custom_css/customcss.info new file mode 100644 index 0000000..d04009f --- /dev/null +++ b/maloja/data_files/config/custom_css/customcss.info @@ -0,0 +1 @@ +In this folder, you can place any number of CSS files to change Maloja's style. diff --git a/maloja/globalconf.py b/maloja/globalconf.py index 644f537..191fbe4 100644 --- a/maloja/globalconf.py +++ b/maloja/globalconf.py @@ -123,6 +123,7 @@ data_directories = { "rules":pthj(dir_settings['config'],"rules"), "clients":pthj(dir_settings['config'],"clients"), "settings":pthj(dir_settings['config'],"settings"), + "css":pthj(dir_settings['config'],"custom_css"), "logs":pthj(dir_settings['logs']), "cache":pthj(dir_settings['cache']), } diff --git a/maloja/server.py b/maloja/server.py index cff924e..e89bf53 100644 --- a/maloja/server.py +++ b/maloja/server.py @@ -70,6 +70,11 @@ def generate_css(): with open(os.path.join(STATICFOLDER,"css",f),"r") as fd: css += fd.read() + for f in os.listdir(data_dir['css']()): + if f.endswith(".css"): + with open(os.path.join(data_dir['css'](f)),"r") as fd: + css += fd.read() + css = css_minify(css) return css