From 54bef3e8c2139c210259be9f4d9927d6b8e08d33 Mon Sep 17 00:00:00 2001
From: Krateng <git.noreply@krateng.ch>
Date: Sun, 5 May 2019 13:52:13 +0200
Subject: [PATCH] Made DB cache non-persistent for now to avoid long startup
 times

---
 README.md                                   | 12 ++++--------
 database.py                                 |  4 ++--
 external.py                                 |  4 ++--
 rules/predefined/krateng_kpopgirlgroups.tsv |  1 +
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index f64cca6..5ad00e2 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
 
 Simple self-hosted music scrobble database to create personal listening statistics. No recommendations, no social network, no nonsense.
 
+You can check [my own Maloja page](https://maloja.krateng.ch) to see what it looks like.
+
 ## Never Asked Questions
 
 ### Why not Last.fm / Libre.fm / GNU FM?
@@ -14,19 +16,13 @@ Maloja's database has one big advantage: It supports **multiple artists per trac
 
 Also neat: You can use your **custom artist or track images**.
 
-## Current status
-
-You can check [my own Maloja page](https://maloja.krateng.ch) to see what it currently looks like.
-
-There are only two scrobblers (YouTube Music and Plex, both for Chromium), but a very simple API to create your own scrobbler.
-
 ## Requirements
 
 * [python3](https://www.python.org/) - [GitHub](https://github.com/python/cpython)
 * [bottle.py](https://bottlepy.org/) - [GitHub](https://github.com/bottlepy/bottle)
 * [waitress](https://docs.pylonsproject.org/projects/waitress/) - [GitHub](https://github.com/Pylons/waitress)
 * [doreah](https://pypi.org/project/doreah/) - [GitHub](https://github.com/krateng/doreah) (at least Version 0.6.1)
-* If you'd like to display images, you will need API keys for Last.fm and Fanart.tv. These are free of charge!
+* If you'd like to display images, you will need API keys for [Last.fm](https://www.last.fm/api/account/create) and [Fanart.tv](https://fanart.tv/get-an-api-key/). These are free of charge!
 
 ## How to install
 
@@ -55,7 +51,7 @@ There are only two scrobblers (YouTube Music and Plex, both for Chromium), but a
 
 If you didn't install Maloja from the package (and therefore don't have it in `/opt/maloja`), every command needs to be executed from the Maloja directory and led with `./`. Otherwise, all commands work in any location and without the prefix.
 
-1) In order to scrobble your music from Plex Web or YouTube Music, install the included Chrome extension. Make sure to enter the random key Maloja generates on first startup in the extension.
+1) In order to scrobble your music from Plex Web or YouTube Music, install the included Chrome extension. Make sure to enter the random key Maloja generates on first startup in the extension. If you use another music player, Maloja has a very simple API to create your own scrobbler.
 
 2) If you would like to import all your previous last.fm scrobbles, use [benfoxall's website](https://benjaminbenben.com/lastfm-to-csv/) ([GitHub page](https://github.com/benfoxall/lastfm-to-csv)). Use the command
 
diff --git a/database.py b/database.py
index 8310499..c50df47 100644
--- a/database.py
+++ b/database.py
@@ -895,7 +895,7 @@ def sync():
 import copy
 
 cache_query = {}
-cache_query_permanent = Cache(maxmemory=1024*1024*settings.get_settings("DB_CACHE_SIZE"),persistent=True,name="dbcache_query")
+cache_query_permanent = Cache(maxmemory=1024*1024*settings.get_settings("DB_CACHE_SIZE"))
 cacheday = (0,0,0)
 def db_query(**kwargs):
 	check_cache_age()
@@ -918,7 +918,7 @@ def db_query(**kwargs):
 	return result
 
 cache_aggregate = {}
-cache_aggregate_permanent = Cache(maxmemory=1024*1024*settings.get_settings("DB_CACHE_SIZE"),persistent=True,name="dbcache_aggregate")
+cache_aggregate_permanent = Cache(maxmemory=1024*1024*settings.get_settings("DB_CACHE_SIZE"))
 def db_aggregate(**kwargs):
 	check_cache_age()
 	global cache_aggregate, cache_aggregate_permanent
diff --git a/external.py b/external.py
index 853d1a7..b0c1c3f 100644
--- a/external.py
+++ b/external.py
@@ -7,7 +7,7 @@ from doreah.logging import log
 apis_artists = [
 	{
 		"name":"LastFM + Fanart.tv",
-		"check":get_settings("LASTFM_API_KEY") is not None and get_settings("FANARTTV_API_KEY") is not None,
+		"check":get_settings("LASTFM_API_KEY") not in [None,"ASK"] and get_settings("FANARTTV_API_KEY") not in [None,"ASK"],
 		"steps":[
 			("url","http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist={artiststring}&api_key=" + get_settings("LASTFM_API_KEY") + "&format=json"),
 			("parse",["artist","mbid"]),
@@ -20,7 +20,7 @@ apis_artists = [
 apis_tracks = [
 	{
 		"name":"LastFM",
-		"check":get_settings("LASTFM_API_KEY") is not None,
+		"check":get_settings("LASTFM_API_KEY") not in [None,"ASK"],
 		"steps":[
 			("url","https://ws.audioscrobbler.com/2.0/?method=track.getinfo&track={titlestring}&artist={artiststring}&api_key=" + get_settings("LASTFM_API_KEY") + "&format=json"),
 			("parse",["track","album","image",3,"#text"])
diff --git a/rules/predefined/krateng_kpopgirlgroups.tsv b/rules/predefined/krateng_kpopgirlgroups.tsv
index e28a5a9..e0d14eb 100644
--- a/rules/predefined/krateng_kpopgirlgroups.tsv
+++ b/rules/predefined/krateng_kpopgirlgroups.tsv
@@ -135,3 +135,4 @@ replaceartist	A pink					Apink
 # IOI
 replaceartist	CHUNG HA				Chungha
 countas		Chungha					I.O.I
+replacetitle	벌써 12시 Gotta Go				Gotta Go