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

Moved monkey patching and globalconf to subpackage

This commit is contained in:
krateng 2022-04-09 21:39:04 +02:00
parent abde7e72c4
commit 871b3d289d
23 changed files with 30 additions and 30 deletions

View File

@ -1,4 +1,4 @@
# monkey patching
from . import monkey
from .pkg_global import monkey
# configuration before all else
from . import globalconf
from .pkg_global import conf

View File

@ -10,7 +10,7 @@ from doreah.io import col
from doreah.logging import log
from . import __pkginfo__ as pkginfo
from . import globalconf
from .pkg_global import conf
from .proccontrol import tasks
from .setup import setup
from .dev import generate
@ -55,7 +55,7 @@ def start():
sp = subprocess.Popen(["python3","-m","maloja","supervisor"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
print(col["green"]("Maloja started!"))
port = globalconf.malojaconfig["PORT"]
port = conf.malojaconfig["PORT"]
print("Visit your server address (Port " + str(port) + ") to see your web interface. Visit /admin_setup to get started.")
print("If you're installing this on your local machine, these links should get you there:")
@ -115,16 +115,16 @@ def run_supervisor():
def debug():
os.environ["MALOJA_DEV_MODE"] = 'true'
globalconf.malojaconfig.load_environment()
conf.malojaconfig.load_environment()
direct()
def print_info():
print_header_info()
print(col['lightblue']("Configuration Directory:"),globalconf.dir_settings['config'])
print(col['lightblue']("Data Directory: "),globalconf.dir_settings['state'])
print(col['lightblue']("Log Directory: "),globalconf.dir_settings['logs'])
print(col['lightblue']("Network: "),f"IPv{ip_address(globalconf.malojaconfig['host']).version}, Port {globalconf.malojaconfig['port']}")
print(col['lightblue']("Timezone: "),f"UTC{globalconf.malojaconfig['timezone']:+d}")
print(col['lightblue']("Configuration Directory:"),conf.dir_settings['config'])
print(col['lightblue']("Data Directory: "),conf.dir_settings['state'])
print(col['lightblue']("Log Directory: "),conf.dir_settings['logs'])
print(col['lightblue']("Network: "),f"IPv{ip_address(conf.malojaconfig['host']).version}, Port {conf.malojaconfig['port']}")
print(col['lightblue']("Timezone: "),f"UTC{conf.malojaconfig['timezone']:+d}")
print()
print()

View File

@ -4,7 +4,7 @@
from doreah.keystore import KeyStore
from doreah.logging import log
from ..globalconf import data_dir
from ..pkg_global.conf import data_dir
apikeystore = KeyStore(file=data_dir['clients']("apikeys.yml"),save_endpoint="/apis/mlj_1/apikeys")

View File

@ -4,7 +4,7 @@ from .. import database
import datetime
from ._apikeys import apikeystore
from ..globalconf import malojaconfig
from ..pkg_global.conf import malojaconfig
class Listenbrainz(APIHandler):

View File

@ -11,7 +11,7 @@ from nimrodel import Multi
from .. import database
from ..globalconf import malojaconfig, data_dir
from ..pkg_global.conf import malojaconfig, data_dir

View File

@ -2,7 +2,7 @@ import re
import os
import csv
from .globalconf import data_dir, malojaconfig
from .pkg_global.conf import data_dir, malojaconfig
# need to do this as a class so it can retain loaded settings from file
# apparently this is not true

View File

@ -7,7 +7,7 @@ from .. import images
from ..malojatime import register_scrobbletime, time_stamps, ranges, alltime
from ..malojauri import uri_to_internal, internal_to_uri, compose_querystring
from ..thirdparty import proxy_scrobble_all
from ..globalconf import data_dir, malojaconfig
from ..pkg_global.conf import data_dir, malojaconfig
from ..apis import apikeystore
#db
from . import sqldb

View File

@ -8,7 +8,7 @@ import csv
import os
from . import sqldb
from ..globalconf import data_dir
from ..pkg_global.conf import data_dir
def load_associated_rules():

View File

@ -8,7 +8,7 @@ import json
from doreah.regular import runhourly
from doreah.logging import log
from ..globalconf import malojaconfig
from ..pkg_global.conf import malojaconfig
HIGH_NUMBER = 1000000

View File

@ -3,7 +3,7 @@ from . sqldb import engine
from .dbcache import serialize
from ..globalconf import malojaconfig
from ..pkg_global.conf import malojaconfig
from doreah.logging import log

View File

@ -5,7 +5,7 @@ import math
from datetime import datetime
from threading import Lock
from ..globalconf import data_dir
from ..pkg_global.conf import data_dir
from .dbcache import cached_wrapper, cached_wrapper_individual
from doreah.logging import log

View File

@ -5,7 +5,7 @@ import cProfile, pstats
from doreah.logging import log
from doreah.timing import Clock
from ..globalconf import data_dir
from ..pkg_global.conf import data_dir
profiler = cProfile.Profile()

View File

@ -1,4 +1,4 @@
from .globalconf import data_dir, malojaconfig
from .pkg_global.conf import data_dir, malojaconfig
from . import thirdparty
from . import database

View File

@ -1,5 +1,5 @@
from . import filters
from ..globalconf import malojaconfig
from ..pkg_global.conf import malojaconfig
from .. import database, malojatime, images, malojauri, thirdparty, __pkginfo__
from ..database import jinjaview

View File

@ -3,7 +3,7 @@ from calendar import monthrange
from os.path import commonprefix
import math
from .globalconf import malojaconfig
from .pkg_global.conf import malojaconfig
OFFSET = malojaconfig["TIMEZONE"]

View File

@ -3,7 +3,7 @@ from doreah.configuration import Configuration
from doreah.configuration import types as tp
from .__pkginfo__ import VERSION
from ..__pkginfo__ import VERSION

View File

@ -2,7 +2,7 @@ import tarfile
import time
import glob
import os
from ...globalconf import dir_settings
from ...pkg_global.conf import dir_settings
from pathlib import PurePath
from doreah.logging import log

View File

@ -4,7 +4,7 @@ import json, csv
from doreah.io import col, ask, prompt
from ...cleanup import *
from ...globalconf import data_dir
from ...pkg_global.conf import data_dir
c = CleanerAgent()

View File

@ -20,7 +20,7 @@ from . import database
from .database.jinjaview import JinjaDBConnection
from .images import resolve_track_image, resolve_artist_image
from .malojauri import uri_to_internal, remove_identical
from .globalconf import malojaconfig, data_dir
from .pkg_global.conf import malojaconfig, data_dir
from .jinjaenv.context import jinja_environment
from .apis import init_apis, apikeystore

View File

@ -6,7 +6,7 @@ from distutils import dir_util
from doreah.io import col, ask, prompt
from doreah import auth
from .globalconf import data_dir, dir_settings, malojaconfig
from .pkg_global.conf import data_dir, dir_settings, malojaconfig

View File

@ -13,7 +13,7 @@ import base64
from doreah.logging import log
from threading import BoundedSemaphore
from ..globalconf import malojaconfig
from ..pkg_global.conf import malojaconfig
from .. import database

View File

@ -7,7 +7,7 @@ import csv
from doreah.logging import log
from doreah.io import col
from .globalconf import data_dir, dir_settings
from .pkg_global.conf import data_dir, dir_settings
from .apis import _apikeys