Some brushing up

This commit is contained in:
Krateng 2019-02-17 16:27:55 +01:00
parent 2c723e2586
commit 4b3cd8cce3
4 changed files with 46 additions and 11 deletions

View File

@ -22,20 +22,22 @@ You can check [my own Maloja page](https://maloja.krateng.ch) to see what it cur
The software works fairly well and has a few web views, but there is only one scrobbler (a Chrome extension for Plex).
## 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. 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:
## Requirements
* [bottle.py](https://github.com/bottlepy/bottle)
* [waitress](https://github.com/Pylons/waitress)
2) Put the Maloja folder anywhere and make sure the file "maloja" is executable. Start the server with
## 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. Don't ask me to add any lines to make it work on Windows either, the code is already shitty enough.
1) Put the Maloja folder anywhere and make sure the file "maloja" is executable. Start the server with
./maloja start
If you're missing packages, the console output will tell you so. Install them.
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:
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:
location / {
proxy_pass http://yoururl:42010;
@ -46,11 +48,13 @@ Installing Maloja is fairly easy on a Linux machine. Don't ask me how to do it o
proxy_pass http://yoururl:42011;
}
4) In order to scrobble your music from Plex Web, install the included Chrome extension. Make sure to generate a random key and enter that key in the extension as well as the file autenticated_machines.tsv in the clients folder.
## How to use
5) If you would like to import all your previous last.fm scrobbles, use [benfoxall's website](https://benjaminbenben.com/lastfm-to-csv/) ([GitHub page](https://github.com/benfoxall/lastfm-to-csv)). Use the python script lastfmconverter.py with two arguments - the downloaded csv file and your new tsv file - to convert your data. Place the tsv file in scrobbles/ and the server will recognize it on startup.
1) In order to scrobble your music from Plex Web, install the included Chrome extension. Make sure to generate a random key and enter that key in the extension as well as the file autenticated_machines.tsv in the clients folder.
6) You can interact with the server at any time with the commands
2) If you would like to import all your previous last.fm scrobbles, use [benfoxall's website](https://benjaminbenben.com/lastfm-to-csv/) ([GitHub page](https://github.com/benfoxall/lastfm-to-csv)). Use the python script lastfmconverter.py with two arguments - the downloaded csv file and your new tsv file - to convert your data. Place the tsv file in scrobbles/ and the server will recognize it on startup.
3) You can interact with the server at any time with the commands
./maloja stop
./maloja restart

View File

@ -16,6 +16,29 @@ a:hover {
text-decoration:underline;
}
/**
Github link
**/
div.footer {
position:fixed;
height:20px;
width:100%;
background-color:rgba(0.5,0.5,0.5,0.3);
bottom:0px;
left:0px;
padding:10px;
opacity:0.8;
}
div.footer span a {
padding-left:20px;
background-repeat:no-repeat;
background-size:contain;
background-position:left;
background-image:url("https://github.com/favicon.ico");
}
/*
**
**

View File

@ -269,6 +269,11 @@
</tr>
</table>
</div>
<div class="footer">
<span>Get your own Maloja scrobble server on <a href="https://github.com/krateng/maloja">GitHub</a></span>
</div>
</body>
</html>

View File

@ -1,6 +1,7 @@
import urllib
import json
from threading import Thread
#import database
def getpictures(ls,result,tracks=False):
@ -20,7 +21,6 @@ def instructions(keys,dbport):
posrange = ["#" + str(i) for i in range(1,max_show)]
#clean(keys)
#timekeys = pickKeys(keys,"since","to","in")
#limitkeys = pickKeys(keys)
@ -31,6 +31,7 @@ def instructions(keys,dbport):
response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/artists")
db_data = json.loads(response.read())
charts = db_data["list"][:max_show]
#charts = database.get_charts_artists()[:max_show]
topartist = charts[0]["artist"]
artisttitles = [c["artist"] for c in charts]
@ -45,6 +46,7 @@ def instructions(keys,dbport):
response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/tracks")
db_data = json.loads(response.read())
charts = db_data["list"][:max_show]
#charts = database.get_charts_trackss()[:max_show]
trackobjects = [t["track"] for t in charts]
tracktitles = [t["title"] for t in trackobjects]
@ -60,6 +62,7 @@ def instructions(keys,dbport):
response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?max=50")
db_data = json.loads(response.read())
scrobblelist = db_data["list"]
#scrobblelist = database.get_scrobbles(max=50)
scrobbletrackobjects = scrobblelist #ignore the extra time attribute, the format should still work
scrobbleartists = [", ".join([artistLink(a) for a in s["artists"]]) for s in scrobblelist]
scrobbletitles = [s["title"] for s in scrobblelist]