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

Removed last unnecessary cross-server HTTP call

This commit is contained in:
Krateng 2019-03-28 14:18:12 +01:00
parent d3e46ac50b
commit ef765352e0
2 changed files with 92 additions and 90 deletions

View File

@ -4,6 +4,7 @@
from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template
import waitress import waitress
# rest of the project # rest of the project
import database
from htmlgenerators import removeIdentical from htmlgenerators import removeIdentical
from utilities import * from utilities import *
from htmlgenerators import KeySplit from htmlgenerators import KeySplit
@ -71,7 +72,8 @@ def database_post(pth):
def graceful_exit(sig=None,frame=None): def graceful_exit(sig=None,frame=None):
urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync") #urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
database.sync()
log("Server shutting down...") log("Server shutting down...")
os._exit(42) os._exit(42)
@ -172,7 +174,8 @@ signal.signal(signal.SIGTERM, graceful_exit)
setproctitle.setproctitle("Maloja") setproctitle.setproctitle("Maloja")
## start database server ## start database server
_thread.start_new_thread(SourceFileLoader("database","database.py").load_module().runserver,(DATABASE_PORT,)) #_thread.start_new_thread(SourceFileLoader("database","database.py").load_module().runserver,(DATABASE_PORT,))
_thread.start_new_thread(database.runserver,(DATABASE_PORT,))
log("Starting up Maloja server...") log("Starting up Maloja server...")
run(webserver, host='::', port=MAIN_PORT, server='waitress') run(webserver, host='::', port=MAIN_PORT, server='waitress')

View File

@ -147,16 +147,16 @@ def addEntries(filename,al,escape=True):
### Useful functions ### Useful functions
def int_or_none(input_): #def int_or_none(input_):
try: # try:
return int(input_) # return int(input_)
except: # except:
return None # return None
def cleandict(d): #def cleandict(d):
newdict = {k:d[k] for k in d if d[k] is not None} # newdict = {k:d[k] for k in d if d[k] is not None}
d.clear() # d.clear()
d.update(newdict) # d.update(newdict)
@ -431,4 +431,3 @@ def resolveImage(artist=None,track=None):
return getTrackImage(track["artists"],track["title"]) return getTrackImage(track["artists"],track["title"])
elif artist is not None: elif artist is not None:
return getArtistImage(artist) return getArtistImage(artist)