1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added descriptions, fixed various things

This commit is contained in:
krateng 2021-12-19 23:40:30 +01:00
parent df22a595b8
commit 1ec283f885
5 changed files with 135 additions and 65 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
*.note
*.xcf
nohup.out
*-old
# currently not using
/screenshot*.png

View File

@ -211,35 +211,35 @@ malojaconfig = Configuration(
"directory_state":(tp.String(), "State Directory", "/var/lib/maloja", "Folder for state data. Only applied when global data directory is not set."),
"directory_logs":(tp.String(), "Log Directory", "/var/log/maloja", "Folder for log data. Only applied when global data directory is not set."),
"directory_cache":(tp.String(), "Cache Directory", "/var/cache/maloja", "Folder for cache data. Only applied when global data directory is not set."),
"skip_setup":(tp.Boolean(), "Skip Setup", False, "Make server setup process non-interactive"),
"force_password":(tp.String(), "Force Password", None, "On startup, overwrite admin password with this one"),
"clean_output":(tp.Boolean(), "Avoid Mutable Console Output", False, "No console output that will cause problems when piped to other outputs")
"skip_setup":(tp.Boolean(), "Skip Setup", False, "Make server setup process non-interactive. Vital for Docker."),
"force_password":(tp.String(), "Force Password", None, "On startup, overwrite admin password with this one. This should usually only be done via environment variable in Docker."),
"clean_output":(tp.Boolean(), "Avoid Mutable Console Output", False, "Use if console output will be redirected e.g. to a web interface.")
},
"Debug":{
"logging":(tp.Boolean(), "Enable Logging", True),
"dev_mode":(tp.Boolean(), "Enable developer mode", False),
},
"Network":{
"host":(tp.String(), "Host", "::", "Use :: for default IPv6, 0.0.0.0 for default IPv4"),
"host":(tp.String(), "Host", "::", "Host for your server - most likely :: for IPv6 or 0.0.0.0 for IPv4"),
"port":(tp.Integer(), "Port", 42010),
},
"Technical":{
"cache_expire_positive":(tp.Integer(), "Days until images are refetched", 300),
"cache_expire_negative":(tp.Integer(), "Days until failed image fetches are reattempted", 30),
"cache_expire_positive":(tp.Integer(), "Image Cache Expiration", 300, "Days until images are refetched"),
"cache_expire_negative":(tp.Integer(), "Image Cache Negative Expiration", 30, "Days until failed image fetches are reattempted"),
"use_db_cache":(tp.Boolean(), "Use DB Cache", True),
"cache_database_short":(tp.Boolean(), "Use volatile Database Cache", True),
"cache_database_perm":(tp.Boolean(), "Use permanent Database Cache", True),
"db_cache_entries":(tp.Integer(), "Maximal Cache entries", 10000),
"db_max_memory":(tp.Integer(max=100,min=20), "RAM Percentage Theshold", 75)
"db_max_memory":(tp.Integer(max=100,min=20), "RAM Percentage Theshold", 75, "Maximal percentage of RAM that should be used by whole system before Maloja discards cache entries. Use a higher number if your Maloja runs on a dedicated instance (e.g. a container)")
},
"Fluff":{
"scrobbles_gold":(tp.Integer(), "Scrobbles for Gold", 250),
"scrobbles_platinum":(tp.Integer(), "Scrobbles for Platinum", 500),
"scrobbles_diamond":(tp.Integer(), "Scrobbles for Diamond", 1000),
"name":(tp.String(), "Name", "Maloja User")
"scrobbles_gold":(tp.Integer(), "Scrobbles for Gold", 250, "How many scrobbles a track needs to be considered 'Gold' status"),
"scrobbles_platinum":(tp.Integer(), "Scrobbles for Platinum", 500, "How many scrobbles a track needs to be considered 'Platinum' status"),
"scrobbles_diamond":(tp.Integer(), "Scrobbles for Diamond", 1000, "How many scrobbles a track needs to be considered 'Diamond' status"),
"name":(tp.String(), "Name", "Generic Maloja User")
},
"Third Party Services":{
"metadata_providers":(tp.List(tp.String()), "Metadata Providers", ['lastfm','spotify','deezer','musicbrainz']),
"metadata_providers":(tp.List(tp.String()), "Metadata Providers", ['lastfm','spotify','deezer','musicbrainz'], "Which metadata providers should be used in what order. Musicbrainz is rate-limited and should not be used first."),
"scrobble_lastfm":(tp.Boolean(), "Proxy-Scrobble to Last.fm", False),
"lastfm_api_key":(tp.String(), "Last.fm API Key", None),
"lastfm_api_secret":(tp.String(), "Last.fm API Secret", None),
@ -252,18 +252,18 @@ malojaconfig = Configuration(
},
"Database":{
"invalid_artists":(tp.Set(tp.String()), "Invalid Artists", ["[Unknown Artist]","Unknown Artist","Spotify"]),
"remove_from_title":(tp.Set(tp.String()), "Remove from Title", ["(Original Mix)","(Radio Edit)","(Album Version)","(Explicit Version)","(Bonus Track)"]),
"delimiters_feat":(tp.Set(tp.String()), "Featuring Delimiters", ["ft.","ft","feat.","feat","featuring","Ft.","Ft","Feat.","Feat","Featuring"]),
"delimiters_informal":(tp.Set(tp.String()), "Informal Delimiters", ["vs.","vs","&"]),
"delimiters_formal":(tp.Set(tp.String()), "Formal Delimiters", [";","/"])
"invalid_artists":(tp.Set(tp.String()), "Invalid Artists", ["[Unknown Artist]","Unknown Artist","Spotify"], "Artists that should be discarded immediately"),
"remove_from_title":(tp.Set(tp.String()), "Remove from Title", ["(Original Mix)","(Radio Edit)","(Album Version)","(Explicit Version)","(Bonus Track)"], "Phrases that should be removed from song titles"),
"delimiters_feat":(tp.Set(tp.String()), "Featuring Delimiters", ["ft.","ft","feat.","feat","featuring","Ft.","Ft","Feat.","Feat","Featuring"], "Delimiters used for extra artists, even when in the title field"),
"delimiters_informal":(tp.Set(tp.String()), "Informal Delimiters", ["vs.","vs","&"], "Delimiters in informal artist strings with spaces expected around them"),
"delimiters_formal":(tp.Set(tp.String()), "Formal Delimiters", [";","/"], "Delimiters used to tag multiple artists when only one tag field is available")
},
"Web Interface":{
"default_range_charts_artists":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range Artist Charts", "year"),
"default_range_charts_tracks":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range Track Charts", "year"),
"default_step_pulse":(tp.Choice({'year':'Year','month':"Month",'week':'Week','day':'Day'}), "Default Pulse Step", "month"),
"charts_display_tiles":(tp.Boolean(), "Display Chart Tiles", False),
"discourage_cpu_heavy_stats":(tp.Boolean(), "Discourage CPU-heavy stats", False),
"discourage_cpu_heavy_stats":(tp.Boolean(), "Discourage CPU-heavy stats", False, "Prevent visitors from mindlessly clicking on CPU-heavy options. Does not actually disable them for malicious actors!"),
"use_local_images":(tp.Boolean(), "Use Local Images", True),
"local_image_rotate":(tp.Integer(), "Local Image Rotate", 3600),
"timezone":(tp.Integer(), "UTC Offset", 0),
@ -274,3 +274,5 @@ malojaconfig = Configuration(
save_endpoint="/apis/mlj_1/settings"
)
malojaconfig.render_help("settings.md")

View File

@ -1,6 +1,6 @@
from .. import database_packed
from . import filters
from .globalconf import malojaconfig
from ..globalconf import malojaconfig
from .. import database, database_packed, malojatime, utilities, malojauri
from doreah.regular import repeatdaily

View File

@ -78,9 +78,11 @@ def setup():
# we still 'ask' the user to set one, but for docker this will be skipped
newpw = prompt("Please set a password for web backend access. Leave this empty to use the default password.",skip=SKIP,default=defaultpassword,secret=True)
auth.defaultuser.setpw(newpw)
if malojaconfig["NAME"] is None:
name = prompt("Please enter your name. This will be displayed e.g. when comparing your charts to another user. Leave this empty if you would not like to specify a name right now.",default="Generic Maloja User",skip=SKIP)
if malojaconfig["NAME"] == "Generic Maloja User":
name = prompt("Please enter your name. This will be displayed e.g. when comparing your charts to another user. Leave this empty if you would not like to specify a name right now.",default="Maloja User",skip=SKIP)
malojaconfig["NAME"] = name
# setting this as an actual setting instead of leaving the default fallback
# so we know not to ask again
if malojaconfig["SEND_STATS"] is None:
answer = ask("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)?",default=True,skip=SKIP)

View File

@ -2,54 +2,119 @@ 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.
`data_directory` | `MALOJA_DATA_DIRECTORY` | String | Folder for all user data. Overwrites all choices for specific directories.
`directory_config` | `MALOJA_DIRECTORY_CONFIG` | String | Folder for config data. Only applied when global data directory is not set.
`directory_state` | `MALOJA_DIRECTORY_STATE` | String | Folder for state data. Only applied when global data directory is not set.
`directory_logs` | `MALOJA_DIRECTORY_LOGS` | String | Folder for log data. Only applied when global data directory is not set.
`directory_cache` | `MALOJA_DIRECTORY_CACHE` | String | Folder for cache data. Only applied when global data directory is not set.
`skip_setup` | `MALOJA_SKIP_SETUP` | Boolean | Make server setup process non-interactive. Vital for Docker.
`force_password` | `MALOJA_FORCE_PASSWORD` | String | On startup, overwrite admin password with this one. This should usually only be done via environment variable in Docker.
`clean_output` | `MALOJA_CLEAN_OUTPUT` | Boolean | 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
`logging` | `MALOJA_LOGGING` | Boolean | Enable Logging
`dev_mode` | `MALOJA_DEV_MODE` | Boolean | Enable developer mode
**Network**
`host` | `MALOJA_HOST` | String | Host for your server - most likely :: for IPv6 or 0.0.0.0 for IPv4
`port` | `MALOJA_PORT` | Integer | Port
**Technical**
`WEB_PORT` |   | Integer | HTTP port to use for your web interface and API
`HOST` |   | String | Host for your server - most likely `::` for IPv6 or `0.0.0.0` for IPv4
`CACHE_EXPIRE_POSITIVE` |   | Integer | Days until images are refetched
`CACHE_EXPIRE_NEGATIVE` |   | Integer | Days until failed image fetches are reattempted
`USE_DB_CACHE` |   | Boolean | Whether to use the Database Cache.
`CACHE_DATABASE_SHORT` |   | Boolean | Whether to use the Volatile DB Cache.
`CACHE_DATABASE_PERM` |   | Boolean | Whether to use the Permanent DB Cache.
`DB_CACHE_ENTRIES` |   | Integer | Maximal entries of cache.
`DB_MAX_MEMORY` |   | Integer | Maximal percentage of total RAM that should be used (by whole system) before Maloja discards cache entries. Use a higher number if your Maloja runs on a dedicated instance (e.g. a container)
`cache_expire_positive` | `MALOJA_CACHE_EXPIRE_POSITIVE` | Integer | Days until images are refetched
`cache_expire_negative` | `MALOJA_CACHE_EXPIRE_NEGATIVE` | Integer | Days until failed image fetches are reattempted
`use_db_cache` | `MALOJA_USE_DB_CACHE` | Boolean | Use DB Cache
`cache_database_short` | `MALOJA_CACHE_DATABASE_SHORT` | Boolean | Use volatile Database Cache
`cache_database_perm` | `MALOJA_CACHE_DATABASE_PERM` | Boolean | Use permanent Database Cache
`db_cache_entries` | `MALOJA_DB_CACHE_ENTRIES` | Integer | Maximal Cache entries
`db_max_memory` | `MALOJA_DB_MAX_MEMORY` | Integer | Maximal percentage of RAM that should be used by whole system before Maloja discards cache entries. Use a higher number if your Maloja runs on a dedicated instance (e.g. a container)
**Fluff**
`SCROBBLES_GOLD` |   | Integer | How many scrobbles should be considered 'Gold' status for a track
`SCROBBLES_PLATINUM` |   | Integer | How many scrobbles should be considered 'Platinum' status for a track
`SCROBBLES_DIAMOND` |   | Integer | How many scrobbles should be considered 'Diamond' status for a track
`NAME` |   | String | Your Name for display
`scrobbles_gold` | `MALOJA_SCROBBLES_GOLD` | Integer | How many scrobbles a track needs to be considered 'Gold' status
`scrobbles_platinum` | `MALOJA_SCROBBLES_PLATINUM` | Integer | How many scrobbles a track needs to be considered 'Platinum' status
`scrobbles_diamond` | `MALOJA_SCROBBLES_DIAMOND` | Integer | How many scrobbles a track needs to be considered 'Diamond' status
`name` | `MALOJA_NAME` | String | Name
**Third Party Services**
`METADATA_PROVIDERS` |   | List (String) | Which metadata providers should be used in what order. Musicbrainz is rate-limited and should not be used first.
`SCROBBLE_LASTFM` |   | Boolean | Proxy-scrobble to Last.fm
`LASTFM_API_KEY` |   | String | API key for Last.fm. Necessary if proxy-scrobbling to Last.fm or using it as a metadata provider
`LASTFM_API_SECRET` |   | String | API secret for Last.fm. Necessary if proxy-scrobbling to Last.fm or using it as a metadata provider
`SPOTIFY_API_ID` |   | String | API ID for Spotify. Necessary if using it as a metadata provider.
`SPOTIFY_API_SECRET` |   | String | API Secret for Spotify. Necessary if using it as a metadata provider.
`TRACK_SEARCH_PROVIDER` |   | String | Provider for track search next to scrobbles. None to disable.
`THUMBOR_SERVER` |   | String | URL of Thumbor server to serve custom artwork.
`THUMBOR_SECRET` |   | String | Secret of Thumbor server
`metadata_providers` | `MALOJA_METADATA_PROVIDERS` | List | Which metadata providers should be used in what order. Musicbrainz is rate-limited and should not be used first.
`scrobble_lastfm` | `MALOJA_SCROBBLE_LASTFM` | Boolean | Proxy-Scrobble to Last.fm
`lastfm_api_key` | `MALOJA_LASTFM_API_KEY` | String | Last.fm API Key
`lastfm_api_secret` | `MALOJA_LASTFM_API_SECRET` | String | Last.fm API Secret
`spotify_api_id` | `MALOJA_SPOTIFY_API_ID` | String | Spotify API ID
`spotify_api_secret` | `MALOJA_SPOTIFY_API_SECRET` | String | Spotify API Secret
`audiodb_api_key` | `MALOJA_AUDIODB_API_KEY` | String | TheAudioDB API Key
`track_search_provider` | `MALOJA_TRACK_SEARCH_PROVIDER` | String | Track Search Provider
`send_stats` | `MALOJA_SEND_STATS` | Boolean | Send Statistics
**Database**
`INVALID_ARTISTS` |   | List (String) | Artists that should be discarded immediately
`REMOVE_FROM_TITLE` |   | List (String) | Phrases that should be removed from song titles
`DELIMITERS_FEAT` |   | List (String) | Delimiters used for extra artists, even when in the title field
`DELIMITERS_INFORMAL` |   | List (String) | Delimiters in informal artist strings with spaces expected around them
`DELIMITERS_FORMAL` |   | List (String) | Delimiters used to tag multiple artists when only one tag field is available
`invalid_artists` | `MALOJA_INVALID_ARTISTS` | Set | Artists that should be discarded immediately
`remove_from_title` | `MALOJA_REMOVE_FROM_TITLE` | Set | Phrases that should be removed from song titles
`delimiters_feat` | `MALOJA_DELIMITERS_FEAT` | Set | Delimiters used for extra artists, even when in the title field
`delimiters_informal` | `MALOJA_DELIMITERS_INFORMAL` | Set | Delimiters in informal artist strings with spaces expected around them
`delimiters_formal` | `MALOJA_DELIMITERS_FORMAL` | Set | Delimiters used to tag multiple artists when only one tag field is available
**Web Interface**
`DEFAULT_RANGE_CHARTS_ARTISTS` |   | String | What range is shown per default for the tile view on the start page
`DEFAULT_RANGE_CHARTS_TRACKS` |   | String | What range is shown per default for the tile view on the start page
`DEFAULT_STEP_PULSE` |   | String | What steps are shown per default for the pulse view on the start page
`CHARTS_DISPLAY_TILES` |   | Boolean | Whether to show tiles on chart pages
`DISCOURAGE_CPU_HEAVY_STATS` |   | Boolean | Prevent visitors from mindlessly clicking on CPU-heavy options. Does not actually disable them for malicious actors!
`USE_LOCAL_IMAGES` |   | Boolean | Use local images if present
`LOCAL_IMAGE_ROTATE` |   | Integer | How many seconds to wait between rotating local images
`default_range_charts_artists` | `MALOJA_DEFAULT_RANGE_CHARTS_ARTISTS` | Choice | Default Range Artist Charts
`default_range_charts_tracks` | `MALOJA_DEFAULT_RANGE_CHARTS_TRACKS` | Choice | Default Range Track Charts
`default_step_pulse` | `MALOJA_DEFAULT_STEP_PULSE` | Choice | Default Pulse Step
`charts_display_tiles` | `MALOJA_CHARTS_DISPLAY_TILES` | Boolean | Display Chart Tiles
`discourage_cpu_heavy_stats` | `MALOJA_DISCOURAGE_CPU_HEAVY_STATS` | Boolean | Prevent visitors from mindlessly clicking on CPU-heavy options. Does not actually disable them for malicious actors!
`use_local_images` | `MALOJA_USE_LOCAL_IMAGES` | Boolean | Use Local Images
`local_image_rotate` | `MALOJA_LOCAL_IMAGE_ROTATE` | Integer | Local Image Rotate
`timezone` | `MALOJA_TIMEZONE` | Integer | UTC Offset
`time_format` | `MALOJA_TIME_FORMAT` | String | Time Format