mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Easier installation
This commit is contained in:
parent
5c8dddc8a7
commit
27e7083281
@ -31,7 +31,7 @@ There are only two scrobblers (YouTube Music and Plex, both for Chromium), but a
|
||||
|
||||
1) Either install Maloja with a package, or download the repository to some arbitrary location. If you pick the manual installation, every command needs to be executed from the Maloja directory and led with `./`. You can also only download the file `maloja` instead of the whole repository and fetch the rest with
|
||||
|
||||
./maloja update
|
||||
./maloja install
|
||||
|
||||
2) Start the server with
|
||||
|
||||
|
47
maloja
47
maloja
@ -5,6 +5,7 @@ import sys
|
||||
import signal
|
||||
import os
|
||||
import stat
|
||||
import pathlib
|
||||
|
||||
|
||||
|
||||
@ -27,6 +28,16 @@ def blue(txt): return "\033[94m" + txt + "\033[0m"
|
||||
def green(txt): return "\033[92m" + txt + "\033[0m"
|
||||
def yellow(txt): return "\033[93m" + txt + "\033[0m"
|
||||
|
||||
## GOTODIR goes to directory that seems to have a maloja install
|
||||
## SETUP assumes correct directory. sets settings and key
|
||||
## INSTALL ignores local files, just installs prerequisites
|
||||
## START INSTALL - GOTODIR - SETUP - starts process
|
||||
## RESTART STOP - START
|
||||
## STOP Stops process
|
||||
## UPDATE GOTODIR - updates from repo
|
||||
## LOADLASTFM GOTODIR - imports csv data
|
||||
## INSTALLHERE makes this directory valid - UPDATE - INSTALL - SETUP
|
||||
|
||||
def gotodir():
|
||||
if os.path.exists("./server.py"):
|
||||
return True
|
||||
@ -37,7 +48,6 @@ def gotodir():
|
||||
print("Maloja installation could not be found.")
|
||||
return False
|
||||
|
||||
|
||||
def setup():
|
||||
|
||||
from doreah import settings
|
||||
@ -55,18 +65,6 @@ def setup():
|
||||
else:
|
||||
print("Last.FM API key found.")
|
||||
|
||||
# if os.path.exists("./apikey"):
|
||||
# with open("apikey","r") as keyfile:
|
||||
# apikey = keyfile.read().replace("\n","")
|
||||
#
|
||||
# if apikey == "NONE": print("Currently not using an API key for image display. Only local images will be used.")
|
||||
# else:
|
||||
# print("Please enter your Last.FM API key. If you do not want to display artist and track images, simply leave this empty and press Enter.")
|
||||
# key = input()
|
||||
# if key == "": key = "NONE"
|
||||
# with open("apikey","w") as keyfile:
|
||||
# keyfile.write(key)
|
||||
|
||||
# OWN API KEY
|
||||
if os.path.exists("./clients/authenticated_machines.tsv"):
|
||||
pass
|
||||
@ -167,8 +165,6 @@ def install():
|
||||
print("All necessary modules seem to be installed.")
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def getInstance():
|
||||
try:
|
||||
output = subprocess.check_output(["pidof","Maloja"])
|
||||
@ -177,9 +173,6 @@ def getInstance():
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
def start():
|
||||
if install():
|
||||
|
||||
@ -205,8 +198,6 @@ def start():
|
||||
print("Error while starting Maloja.")
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def restart():
|
||||
#pid = getInstance()
|
||||
#if pid == None:
|
||||
@ -283,7 +274,6 @@ def update():
|
||||
|
||||
if stop(): start() #stop returns whether it was running before, in which case we restart it
|
||||
|
||||
|
||||
def loadlastfm():
|
||||
|
||||
try:
|
||||
@ -304,6 +294,18 @@ def loadlastfm():
|
||||
os.system("python3 ./lastfmconverter.py " + filename + " ./scrobbles/lastfmimport.tsv")
|
||||
print("Successfully imported your Last.FM scrobbles!")
|
||||
|
||||
def installhere():
|
||||
if len(os.listdir()) > 1:
|
||||
print("You should install Maloja in an empty directory.")
|
||||
return False
|
||||
else:
|
||||
open("server.py","w").close()
|
||||
# if it's cheese, but it works, it ain't cheese
|
||||
update()
|
||||
install()
|
||||
setup()
|
||||
|
||||
print("Maloja installed! Start with " + yellow("./maloja start"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
@ -312,4 +314,5 @@ if __name__ == "__main__":
|
||||
elif sys.argv[1] == "stop": stop()
|
||||
elif sys.argv[1] == "update": update()
|
||||
elif sys.argv[1] == "import": loadlastfm()
|
||||
else: print("Valid commands: start restart stop update")
|
||||
elif sys.argv[1] == "install": installhere()
|
||||
else: print("Valid commands: start restart stop update import install")
|
||||
|
Loading…
Reference in New Issue
Block a user