1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Future-proofed update script

This commit is contained in:
Krateng 2019-03-24 13:45:59 +01:00
parent 5603ca9eb1
commit 2246efb4b4
2 changed files with 64 additions and 57 deletions

View File

@ -4,23 +4,19 @@ Simple self-hosted music scrobble database to create personal listening statisti
## Never Asked Questions
### Why not Last.fm / Libre.fm?
### Why not Last.fm / Libre.fm / GNU FM?
Maloja is self-hosted. You will always be able to access your data, and not have to trust anyone to provide an API for it. Your library is not synced with any public or official music database, so you can follow your own tagging schema or even group associated artists together in your charts.
Maloja is self-hosted. You will always be able to access your data in an easily-parseable format. Your library is not synced with any public or official music database, so you can follow your own tagging schema or even group associated artists together in your charts.
### Why not GNU FM?
Maloja also gets rid of all the extra stuff: social networking, radios, recommendations, etc. It only keeps track of your listening history and lets you analyze it.
Maloja gets rid of all the extra stuff: social networking, radios, recommendations, etc. It only keeps track of your listening history and lets you analyze it. This focus on its core allows it to potentially implement much better database features. One example: Maloja supports multiple artists per track. This means artists who are often just "featuring" in the track title get a place in your charts, and collaborations between several artists finally get credited to all participants.
### Why Maloja?
I like to name my projects after regions in Grisons, Switzerland. Don't waste your time trying to find a connection, I just picked one at random. Do visit Maloja though. It's a great pass to drive.
Maloja's database has one big advantage: It supports multiple artists per track. This means artists who are often just "featuring" in the track title get a place in your charts, and collaborations between several artists finally get credited to all participants. This allows you to get an actual idea of your artist preferences over time.
## Current status
You can check [my own Maloja page](https://maloja.krateng.ch) to see what it currently looks like.
There is only one scrobbler (a Chrome extension for Plex), but a very simple API to create your own scrobbler.
There are only two scrobblers (YouTube Music and Plex, both for Chromium), but a very simple API to create your own scrobbler.
## Requirements
@ -55,7 +51,7 @@ There is only one scrobbler (a Chrome extension for Plex), but a very simple API
If you didn't install Maloja from the package (and therefore don't have it in `/opt/maloja`), every command needs to be executed from the Maloja directory and led with `./`. Otherwise, all commands work in any location and without the prefix.
1) In order to scrobble your music from Plex Web, install the included Chrome extension. Make sure to enter the random key Maloja generates on first startup in the extension.
1) In order to scrobble your music from Plex Web or YouTube Music, install the included Chrome extension. Make sure to enter the random key Maloja generates on first startup in the extension.
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 command

19
maloja
View File

@ -236,9 +236,21 @@ def update():
os.system("wget " + SOURCE_URL)
with zipfile.ZipFile("./master.zip","r") as z:
for f in z.namelist():
#print("extracting " + f)
z.extract(f)
# if we ever have a separate directory for the code
# (the calling update script is not the same version as the current
# remote repository, so we better add this check just in case)
if "source/" in z.namelist():
for f in z.namelist():
if f.startswith("source/"):
z.extract(f)
for dir,_,files in os.walk("source"):
for f in files:
origfile = os.path.join(dir,f)
newfile = ps.path.join(dir[7:],f)
os.renames(origfile,newfile) #also prunes empty directory
else:
for f in z.namelist():
z.extract(f)
os.remove("./master.zip")
@ -281,4 +293,3 @@ if __name__ == "__main__":
elif sys.argv[1] == "update": update()
elif sys.argv[1] == "import": loadlastfm()
else: print("Valid commands: start restart stop update")