mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Renamed folder and added launcher
This commit is contained in:
parent
ed82ae40a0
commit
98c23cd8af
10
README.md
10
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;
|
||||
|
10
database.py
10
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()
|
||||
|
6
maloja
Executable file
6
maloja
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import subprocess
|
||||
|
||||
subprocess.Popen(["python","server.py"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
||||
print("Maloja started!")
|
2
scrobbles/.gitignore
vendored
Normal file
2
scrobbles/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.tsv
|
||||
*.csv
|
0
scrobbles/dummy
Normal file
0
scrobbles/dummy
Normal file
Loading…
Reference in New Issue
Block a user