mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Janky self-restarter
This commit is contained in:
parent
28f85300fe
commit
15a423060c
@ -12,10 +12,6 @@ Maloja is self-hosted. You will always be able to access your data, and not have
|
||||
|
||||
Maloja gets rid of all the extra stuff: social networking, radios, recommendations, etc. It only keeps track of your listening history and lets you analyze it. This focus on its core allows it to potentially implement much better database features. One example: Maloja supports multiple artists per track. This means artists who are often just "featuring" in the track title get a place in your charts, and collaborations between several artists finally get credited to all participants.
|
||||
|
||||
### Why not use the established API?
|
||||
|
||||
Compatibility creates overhead effort. I only made this for myself, so I have no need to support lots of music players and scrobblers. Maloja has a significantly smaller API that allows it to be much simpler and implement its additional features.
|
||||
|
||||
### Why Maloja?
|
||||
|
||||
I like to name my projects after regions in Grisons, Switzerland. Don't waste your time trying to find a connection, I just picked one at random. Do visit Maloja though. It's a great pass to drive.
|
||||
@ -28,7 +24,7 @@ The software works fairly well and has a few web views, but there is only one sc
|
||||
|
||||
## How to install
|
||||
|
||||
Installing Maloja is fairly easy on a Linux machine. Don't ask me how to do it on Windows, I have no clue.
|
||||
Installing Maloja is fairly easy on a Linux machine. Don't ask me how to do it on Windows, I have no clue. Don't ask me to add any lines to make it work on Windows either, the code is already shitty enough.
|
||||
|
||||
1) Install the requirements:
|
||||
|
||||
|
25
restarter.py
Normal file
25
restarter.py
Normal file
@ -0,0 +1,25 @@
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
def startserver():
|
||||
time.sleep(5)
|
||||
print("Starting the Maloja server...")
|
||||
|
||||
p = subprocess.Popen(["python3","server.py"])
|
||||
exit("Restarter has done his job and is exiting!")
|
||||
|
||||
|
||||
def restart():
|
||||
#args = sys.argv[:]
|
||||
print("Starting the restarter...")
|
||||
|
||||
#args.insert(0, sys.executable)
|
||||
#print(' '.join(args))
|
||||
|
||||
p = subprocess.Popen(["python3","restarter.py"])
|
||||
#exit("Exiting!")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
startserver()
|
@ -12,6 +12,7 @@ from urllib.error import *
|
||||
import sys
|
||||
import signal
|
||||
import os
|
||||
import restarter
|
||||
|
||||
|
||||
MAIN_PORT = 42010
|
||||
@ -67,6 +68,12 @@ def database_post(pth):
|
||||
def shutdown():
|
||||
graceful_exit()
|
||||
|
||||
@webserver.route("/restart")
|
||||
def restart():
|
||||
urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
|
||||
restarter.restart()
|
||||
os._exit(42)
|
||||
|
||||
def graceful_exit(sig=None,frame=None):
|
||||
urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
|
||||
log("Server shutting down...")
|
||||
|
11
updater.py
11
updater.py
@ -4,12 +4,11 @@ import tempfile
|
||||
import zipfile
|
||||
import distutils.dir_util
|
||||
#import os
|
||||
import sys
|
||||
|
||||
SOURCE_URL = "https://github.com/krateng/maloja/archive/master.zip"
|
||||
|
||||
|
||||
update()
|
||||
|
||||
def update():
|
||||
print("Updating Maloja...")
|
||||
with urllib.request.urlopen(SOURCE_URL) as response:
|
||||
@ -27,3 +26,11 @@ def update():
|
||||
distutils.dir_util.copy_tree("./maloja-master/","./",verbose=2)
|
||||
shutil.rmtree("./maloja-master")
|
||||
print("Done!")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
update()
|
||||
|
Loading…
Reference in New Issue
Block a user