From b53052c8183c35dbafb3ab660e5b29fbf23f27c2 Mon Sep 17 00:00:00 2001 From: Krateng Date: Fri, 1 Jan 2021 04:13:58 +0100 Subject: [PATCH] Housekeeping --- maloja/data_files/config/settings/default.ini | 8 ++++---- maloja/database.py | 4 ++-- maloja/utilities/maintenance.py | 6 +++--- settings.md | 6 ++++++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/maloja/data_files/config/settings/default.ini b/maloja/data_files/config/settings/default.ini index 4d0ecd2..f831fb8 100644 --- a/maloja/data_files/config/settings/default.ini +++ b/maloja/data_files/config/settings/default.ini @@ -3,13 +3,13 @@ # Category headers in [brackets] are only for organization and not necessary [Directories] -# DATA_DIR determines the base directory. It should be specified as environment +# DATA_DIRECTORY determines the base directory. It should be specified as environment # variable because this file itself is loaded from it. # Configuration is always in this base directory. Other data defaults to be here # too, but can be customized with the options below. -DATA_DIR_STATE = None # This is /var/lib/maloja per XDG -DATA_DIR_LOGS = None # this is /var/log/maloja per XDG -DATA_DIR_CACHE = None # this is /var/cache/maloja per XDG +DIRECTORY_STATE = None # This is /var/lib/maloja per XDG +DIRECTORY_LOGS = None # this is /var/log/maloja per XDG +DIRECTORY_CACHE = None # this is /var/cache/maloja per XDG [HTTP] diff --git a/maloja/database.py b/maloja/database.py index 84758c6..7830dac 100644 --- a/maloja/database.py +++ b/maloja/database.py @@ -68,7 +68,7 @@ ARTISTS_NORMALIZED = [] ARTISTS_NORMALIZED_SET = set() TRACKS_NORMALIZED_SET = set() -MEDALS = {} #literally only changes once per year, no need to calculate that on the fly +MEDALS_ARTISTS = {} #literally only changes once per year, no need to calculate that on the fly MEDALS_TRACKS = {} WEEKLY_TOPTRACKS = {} WEEKLY_TOPARTISTS = {} @@ -477,7 +477,7 @@ def artistInfo(artist): "scrobbles":scrobbles, "position":position, "associated":others, - "medals":{"gold":[],"silver":[],"bronze":[],**MEDALS.get(artist,{})}, + "medals":{"gold":[],"silver":[],"bronze":[],**MEDALS_ARTISTS.get(artist,{})}, "topweeks":WEEKLY_TOPARTISTS.get(artist,0) } except: diff --git a/maloja/utilities/maintenance.py b/maloja/utilities/maintenance.py index cb96e66..9d26549 100644 --- a/maloja/utilities/maintenance.py +++ b/maloja/utilities/maintenance.py @@ -50,10 +50,10 @@ rankmedals = { def update_medals(): - from ..database import MEDALS, MEDALS_TRACKS, STAMPS, get_charts_artists, get_charts_tracks + from ..database import MEDALS_ARTISTS, MEDALS_TRACKS, STAMPS, get_charts_artists, get_charts_tracks - MEDALS.clear() + MEDALS_ARTISTS.clear() MEDALS_TRACKS.clear() for year in ranges(step="year"): @@ -62,7 +62,7 @@ def update_medals(): charts_artists = get_charts_artists(timerange=year) charts_tracks = get_charts_tracks(timerange=year) - collect_rankings(charts_artists,get_artist,MEDALS,iteration=year,count=False) + collect_rankings(charts_artists,get_artist,MEDALS_ARTISTS,iteration=year,count=False) collect_rankings(charts_tracks,get_track,MEDALS_TRACKS,iteration=year,count=False) diff --git a/settings.md b/settings.md index af9e386..838f48b 100644 --- a/settings.md +++ b/settings.md @@ -3,8 +3,14 @@ Technically, each setting can be set via environment variable or the settings fi Settings File | Environment Variable | Type | Description ------ | --------- | --------- | --------- **Setup** +  | `MALOJA_DATA_DIRECTORY` | String | Use this directory to store all application files. Useful for docker. Overwrites all individually specified directories below. +  | `MALOJA_DIRECTORY_CONFIG` | String | Use this directory to store configuration files. +`DIRECTORY_STATE` | `MALOJA_DIRECTORY_STATE` | String | Use this directory to store state files. +`DIRECTORY_LOGS` | `MALOJA_DIRECTORY_LOGS` | String | Use this directory to store log files. +`DIRECTORY_CACHE` | `MALOJA_DIRECTORY_CACHE` | String | Use this directory to store cache files. `SKIP_SETUP` | `MALOJA_SKIP_SETUP` | Boolean | Whether to make server startup non-interactive. Vital for docker.   | `MALOJA_FORCE_PASSWORD` | String | Sets password for admin login in web interface. This should normally be done via the interactive prompt. +`CLEAN_OUTPUT` | `MALOJA_CLEAN_OUTPUT` | Boolean | Avoid mutable console output. Use if console output will be redirected e.g. to a web interface. **Debug** `LOGGING` | `MALOJA_LOGGING` | Boolean | Enable logging `DEV_MODE` | `MALOJA_DEV_MODE` | Boolean | Enable developer mode