mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Some refining
This commit is contained in:
@@ -5,7 +5,7 @@ from .info import author,version,versionstr
|
||||
requires = [
|
||||
"bottle>=0.12.16",
|
||||
"waitress>=1.3",
|
||||
"doreah>=1.2.7",
|
||||
"doreah>=1.2.9",
|
||||
"nimrodel>=0.4.9",
|
||||
"setproctitle>=1.1.10",
|
||||
"wand>=0.5.4",
|
||||
|
||||
@@ -22,6 +22,7 @@ def yellow(txt): return "\033[93m" + txt + "\033[0m"
|
||||
|
||||
|
||||
|
||||
origpath = os.getcwd()
|
||||
os.chdir(DATA_DIR)
|
||||
|
||||
def copy_initial_local_files():
|
||||
@@ -131,11 +132,10 @@ def stop():
|
||||
return True
|
||||
|
||||
|
||||
def loadlastfm():
|
||||
def loadlastfm(filename):
|
||||
|
||||
try:
|
||||
filename = sys.argv[2]
|
||||
filename = os.path.abspath(filename)
|
||||
filename = os.path.join(origpath,filename)
|
||||
except:
|
||||
print("Please specify a file!")
|
||||
return
|
||||
@@ -147,19 +147,27 @@ def loadlastfm():
|
||||
else:
|
||||
return
|
||||
print("Please wait...")
|
||||
os.system("python3 ./lastfmconverter.py " + filename + " ./scrobbles/lastfmimport.tsv")
|
||||
os.system("python3 -m maloja.lastfmconverter " + filename + " ./scrobbles/lastfmimport.tsv")
|
||||
print("Successfully imported your Last.FM scrobbles!")
|
||||
|
||||
def direct():
|
||||
from . import server
|
||||
|
||||
from doreah.control import mainfunction
|
||||
|
||||
def main():
|
||||
if sys.argv[1] == "start": restart()
|
||||
elif sys.argv[1] == "restart": restart()
|
||||
elif sys.argv[1] == "stop": stop()
|
||||
#elif sys.argv[1] == "update": update()
|
||||
elif sys.argv[1] == "import": loadlastfm()
|
||||
#elif sys.argv[1] == "install": installhere()
|
||||
else: print("Valid commands: start restart stop import")
|
||||
@mainfunction({},shield=True)
|
||||
def main(action,*args,**kwargs):
|
||||
actions = {
|
||||
"start":restart,
|
||||
"restart":restart,
|
||||
"stop":stop,
|
||||
"import":loadlastfm,
|
||||
"debug":direct
|
||||
}
|
||||
if action in actions: actions[action](*args,**kwargs)
|
||||
else: print("Valid commands: " + " ".join(a for a in actions))
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
#if __name__ == "__main__":
|
||||
# main()
|
||||
|
||||
@@ -5,7 +5,7 @@ author = {
|
||||
"email":"maloja@krateng.dev",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 2,0,0
|
||||
version = 2,0,1
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user