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

More refactoring

This commit is contained in:
Krateng 2019-12-03 16:23:01 +01:00
parent 47eeb38edf
commit 2e69ef7df9
6 changed files with 32 additions and 26 deletions

View File

@ -1,6 +1,15 @@
name = "maloja"
### PACKAGE DATA
name = "maloja"
desc = "Self-hosted music scrobble database"
author = {
"name":"Johannes Krattenmacher",
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,0,3
versionstr = ".".join(str(n) for n in version)
from .info import author,version,versionstr
requires = [
"bottle>=0.12.16",
@ -22,6 +31,8 @@ commands = {
"maloja":"controller:main"
}
### DOREAH CONFIGURATION
from doreah import config
config(
logging={
@ -40,3 +51,17 @@ config(
"autostart": False
}
)
### USER DATA FOLDER
import os
try:
DATA_DIR = os.environ["XDG_DATA_HOME"].split(":")[0]
assert os.path.exists(DATA_DIR)
except:
DATA_DIR = os.path.join(os.environ["HOME"],".local/share/")
DATA_DIR = os.path.join(DATA_DIR,"maloja")
os.makedirs(DATA_DIR,exist_ok=True)

View File

@ -11,7 +11,7 @@ import pathlib
import pkg_resources
from doreah.control import mainfunction
from .info import DATA_DIR
from .__init__ import DATA_DIR

View File

@ -7,7 +7,7 @@ from .malojatime import register_scrobbletime, time_stamps, ranges
from .urihandler import uri_to_internal, internal_to_uri, compose_querystring
from . import compliant_api
from .external import proxy_scrobble
from . import info
from .__init__ import version
# doreah toolkit
from doreah.logging import log
from doreah import tsv
@ -240,7 +240,7 @@ def server_info():
return {
"name":settings.get_settings("NAME"),
"version":info.version
"version":version
}
## All database functions are separated - the external wrapper only reads the request keys, converts them into lists and renames them where necessary, and puts the end result in a dict if not already so it can be returned as json

View File

@ -1,19 +0,0 @@
import os
author = {
"name":"Johannes Krattenmacher",
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,0,2
versionstr = ".".join(str(n) for n in version)
try:
DATA_DIR = os.environ["XDG_DATA_HOME"].split(":")[0]
assert os.path.exists(DATA_DIR)
except:
DATA_DIR = os.path.join(os.environ["HOME"],".local/share/")
DATA_DIR = os.path.join(DATA_DIR,"maloja")
os.makedirs(DATA_DIR,exist_ok=True)

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import os
from .info import DATA_DIR
from .__init__ import DATA_DIR
os.chdir(DATA_DIR)

View File

@ -11,7 +11,7 @@ setuptools.setup(
version=".".join(str(n) for n in module.version),
author=module.author["name"],
author_email=module.author["email"],
description="Self-hosted music scrobble database",
description=module.desc,
license="GPLv3",
long_description=long_description,
long_description_content_type="text/markdown",