diff --git a/README.md b/README.md index 85fe4f2..281801d 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,14 @@ Deep in development. I just uploaded Maloja here in case I die tomorrow. It can I wouldn't recommend it yet. But if you want to test Maloja, it's fairly easy: -1) Put it anywhere and start server.py -2) (Recommended) Put your server behind a reverse proxy for SSL encryption. Configure that proxy to rewrite /db/ requests to the database port. In nginx this would look as follows: +1) Install the requirements: + +* [bottle.py](https://github.com/bottlepy/bottle) +* [waitress](https://github.com/Pylons/waitress) + + +2) Put it anywhere and start server.py +3) (Recommended) Put your server behind a reverse proxy for SSL encryption. Configure that proxy to rewrite /db/ requests to the database port. In nginx this would look as follows: location / { proxy_pass http://yoururl:42010; diff --git a/database.py b/database.py index f6ebe35..c4a60d5 100644 --- a/database.py +++ b/database.py @@ -114,14 +114,14 @@ def get_artists(): return {"list":ARTISTS} -@route("/artistcharts") +@route("/charts/artists") def get_charts_artists(): since = request.query.get("since") to = request.query.get("to") return {"list":db_aggregate(by="ARTIST",since=since,to=to)} -@route("/trackcharts") +@route("/charts/tracks") def get_charts_tracks(): since = request.query.get("since") to = request.query.get("to") @@ -267,12 +267,12 @@ def build_db(): SCROBBLES = SCROBBLESNEW - for f in os.listdir("logs/"): + for f in os.listdir("scrobbles/"): if not (".tsv" in f): continue - logfile = open("logs/" + f) + logfile = open("scrobbles/" + f) for l in logfile: l = l.replace("\n","") @@ -303,7 +303,7 @@ def sync(): entry = "\t".join([str(t["time"]),artistss,t["title"]]) - monthfile = open("logs/" + str(timestamp.year) + "_" + str(timestamp.month) + ".tsv","a") + monthfile = open("scrobbles/" + str(timestamp.year) + "_" + str(timestamp.month) + ".tsv","a") monthfile.write(entry) monthfile.write("\n") monthfile.close() diff --git a/maloja b/maloja new file mode 100755 index 0000000..e950818 --- /dev/null +++ b/maloja @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import subprocess + +subprocess.Popen(["python","server.py"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) +print("Maloja started!") diff --git a/scrobbles/.gitignore b/scrobbles/.gitignore new file mode 100644 index 0000000..a59cd8e --- /dev/null +++ b/scrobbles/.gitignore @@ -0,0 +1,2 @@ +*.tsv +*.csv diff --git a/scrobbles/dummy b/scrobbles/dummy new file mode 100644 index 0000000..e69de29