mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added startup upgrade task for album parsing
This commit is contained in:
parent
517bc6f5c0
commit
54a085c5b2
@ -619,6 +619,7 @@ def start_db():
|
|||||||
# Upgrade database
|
# Upgrade database
|
||||||
from .. import upgrade
|
from .. import upgrade
|
||||||
upgrade.upgrade_db(sqldb.add_scrobbles)
|
upgrade.upgrade_db(sqldb.add_scrobbles)
|
||||||
|
upgrade.parse_old_albums()
|
||||||
|
|
||||||
# Load temporary tables
|
# Load temporary tables
|
||||||
from . import associated
|
from . import associated
|
||||||
|
@ -16,7 +16,7 @@ class DatabaseNotBuilt(HTTPError):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
status=503,
|
status=503,
|
||||||
body="The Maloja Database is being upgraded to Version 3. This could take quite a long time! (~ 2-5 minutes per 10 000 scrobbles)",
|
body="The Maloja Database is being upgraded to support new Maloja features. This could take a while.",
|
||||||
headers={"Retry-After":120}
|
headers={"Retry-After":120}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ from .pkg_global.conf import data_dir, dir_settings
|
|||||||
from .apis import _apikeys
|
from .apis import _apikeys
|
||||||
|
|
||||||
|
|
||||||
|
from .database.sqldb import get_maloja_info, set_maloja_info
|
||||||
|
|
||||||
|
|
||||||
# Dealing with old style tsv files - these should be phased out everywhere
|
# Dealing with old style tsv files - these should be phased out everywhere
|
||||||
def read_tsvs(path,types):
|
def read_tsvs(path,types):
|
||||||
result = []
|
result = []
|
||||||
@ -40,7 +43,7 @@ def upgrade_apikeys():
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# v2 to v3 iupgrade
|
||||||
def upgrade_db(callback_add_scrobbles):
|
def upgrade_db(callback_add_scrobbles):
|
||||||
|
|
||||||
oldfolder = os.path.join(dir_settings['state'],"scrobbles")
|
oldfolder = os.path.join(dir_settings['state'],"scrobbles")
|
||||||
@ -88,3 +91,13 @@ def upgrade_db(callback_add_scrobbles):
|
|||||||
callback_add_scrobbles(scrobblelist)
|
callback_add_scrobbles(scrobblelist)
|
||||||
os.rename(os.path.join(oldfolder,sf),os.path.join(newfolder,sf))
|
os.rename(os.path.join(oldfolder,sf),os.path.join(newfolder,sf))
|
||||||
log("Done!",color='yellow')
|
log("Done!",color='yellow')
|
||||||
|
|
||||||
|
|
||||||
|
# 3.2 album support
|
||||||
|
def parse_old_albums():
|
||||||
|
setting_name = "db_upgrade_albums"
|
||||||
|
if get_maloja_info([setting_name]).get(setting_name):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
#set_maloja_info({setting_name:True})
|
||||||
|
Loading…
Reference in New Issue
Block a user