mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Repurposed __pkginfo__ module
This commit is contained in:
parent
c745d4a647
commit
73a6c18b17
@ -1,44 +1,12 @@
|
|||||||
name = "maloja"
|
# This file has now been slighly repurposed and will simply give other parts of
|
||||||
desc = "Self-hosted music scrobble database"
|
# the package access to some global meta-information about itself
|
||||||
author = {
|
|
||||||
"name":"Johannes Krattenmacher",
|
|
||||||
"email":"maloja@dev.krateng.ch",
|
|
||||||
"github": "krateng"
|
|
||||||
}
|
|
||||||
version = 2,13,4
|
|
||||||
versionstr = ".".join(str(n) for n in version)
|
|
||||||
links = {
|
|
||||||
"pypi":"malojaserver",
|
|
||||||
"github":"maloja"
|
|
||||||
}
|
|
||||||
python_version = ">=3.6"
|
|
||||||
requires = [
|
|
||||||
"bottle>=0.12.16",
|
|
||||||
"waitress>=1.3",
|
|
||||||
"doreah>=1.7.1",
|
|
||||||
"nimrodel>=0.7.0",
|
|
||||||
"setproctitle>=1.1.10",
|
|
||||||
"wand>=0.5.4",
|
|
||||||
"jinja2>=2.11",
|
|
||||||
"lru-dict>=1.1.6",
|
|
||||||
"css_html_js_minify>=2.5.5",
|
|
||||||
"psutil>=5.8.0"
|
|
||||||
]
|
|
||||||
resources = [
|
|
||||||
"web/*/*/*",
|
|
||||||
"web/*/*",
|
|
||||||
"web/*",
|
|
||||||
"data_files/*/*",
|
|
||||||
"data_files/*/.*",
|
|
||||||
"data_files/*/*/*",
|
|
||||||
"data_files/*/*/.*",
|
|
||||||
"data_files/*/*/*/*",
|
|
||||||
"data_files/*/*/*/.*",
|
|
||||||
"*/*.py",
|
|
||||||
"*/*/*.py",
|
|
||||||
"*/*/*/*.py"
|
|
||||||
]
|
|
||||||
|
|
||||||
commands = {
|
import pkg_resources
|
||||||
"maloja":"proccontrol.control:main"
|
self = pkg_resources.get_distribution('maloja')
|
||||||
|
|
||||||
|
versionstr = self.version
|
||||||
|
version = self.version.split('.')
|
||||||
|
urls = {
|
||||||
|
"repo":"https://github.com/krateng/maloja"
|
||||||
}
|
}
|
||||||
|
user_agent = f"Maloja/{versionstr} ( {urls['repo']} )"
|
||||||
|
@ -10,12 +10,14 @@ from . import tasks
|
|||||||
from .. import __pkginfo__ as info
|
from .. import __pkginfo__ as info
|
||||||
from .. import globalconf
|
from .. import globalconf
|
||||||
|
|
||||||
print()
|
|
||||||
print("#####")
|
def print_header_info():
|
||||||
print("Maloja v" + info.versionstr)
|
print()
|
||||||
print("https://github.com/" + info.author['github'] + "/" + info.links['github'])
|
print("#####")
|
||||||
print("#####")
|
print("Maloja v" + info.versionstr)
|
||||||
print()
|
print(info.urls['repo'])
|
||||||
|
print("#####")
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
def getInstance():
|
def getInstance():
|
||||||
@ -42,6 +44,7 @@ def start():
|
|||||||
else:
|
else:
|
||||||
setup()
|
setup()
|
||||||
try:
|
try:
|
||||||
|
print_header_info()
|
||||||
#p = subprocess.Popen(["python3","-m","maloja.server"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
#p = subprocess.Popen(["python3","-m","maloja.server"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
||||||
sp = subprocess.Popen(["python3","-m","maloja.proccontrol.supervisor"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
sp = subprocess.Popen(["python3","-m","maloja.proccontrol.supervisor"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
||||||
print(col["green"]("Maloja started!"))
|
print(col["green"]("Maloja started!"))
|
||||||
@ -77,6 +80,7 @@ def stop():
|
|||||||
|
|
||||||
|
|
||||||
def direct():
|
def direct():
|
||||||
|
print_header_info()
|
||||||
setup()
|
setup()
|
||||||
from .. import server
|
from .. import server
|
||||||
|
|
||||||
@ -85,23 +89,32 @@ def debug():
|
|||||||
globalconf.malojaconfig.load_environment()
|
globalconf.malojaconfig.load_environment()
|
||||||
direct()
|
direct()
|
||||||
|
|
||||||
|
def print_info():
|
||||||
|
print_header_info()
|
||||||
|
|
||||||
|
@mainfunction({"l":"level","v":"version"},shield=True)
|
||||||
|
def main(*args,**kwargs):
|
||||||
|
|
||||||
@mainfunction({"l":"level"},shield=True)
|
|
||||||
def main(action,*args,**kwargs):
|
|
||||||
actions = {
|
actions = {
|
||||||
"start":start,
|
"start":start,
|
||||||
"restart":restart,
|
"restart":restart,
|
||||||
"stop":stop,
|
"stop":stop,
|
||||||
"run":direct,
|
"run":direct,
|
||||||
"debug":debug,
|
"debug":debug,
|
||||||
|
|
||||||
"import":tasks.loadlastfm,
|
"import":tasks.loadlastfm,
|
||||||
"backup":tasks.backuphere,
|
"backup":tasks.backuphere,
|
||||||
# "update":update,
|
# "update":update,
|
||||||
"fix":tasks.fixdb,
|
"fix":tasks.fixdb,
|
||||||
"generate":tasks.generate_scrobbles
|
"generate":tasks.generate_scrobbles,
|
||||||
|
"info":print_info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(args) > 0:
|
||||||
|
action = args[0]
|
||||||
|
args = args[1:]
|
||||||
if action in actions: actions[action](*args,**kwargs)
|
if action in actions: actions[action](*args,**kwargs)
|
||||||
else: print("Valid commands: " + " ".join(a for a in actions))
|
else: print("Valid commands: " + " ".join(a for a in actions))
|
||||||
|
else:
|
||||||
|
print("No action specified!")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
4
maloja/thirdparty/musicbrainz.py
vendored
4
maloja/thirdparty/musicbrainz.py
vendored
@ -3,7 +3,7 @@ import urllib.parse, urllib.request
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
from ..__pkginfo__ import versionstr, author, links
|
from ..__pkginfo__ import user_agent
|
||||||
|
|
||||||
class MusicBrainz(MetadataInterface):
|
class MusicBrainz(MetadataInterface):
|
||||||
name = "MusicBrainz"
|
name = "MusicBrainz"
|
||||||
@ -11,7 +11,7 @@ class MusicBrainz(MetadataInterface):
|
|||||||
|
|
||||||
# musicbrainz is rate-limited
|
# musicbrainz is rate-limited
|
||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
useragent = "Maloja/" + versionstr + " ( https://github.com/" + author["github"] + "/" + links["github"] + " )"
|
useragent = user_agent
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user