mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added transition updater to version 2
This commit is contained in:
parent
3c12462d36
commit
0bf6e80e07
23
README.md
23
README.md
@ -4,6 +4,12 @@ Simple self-hosted music scrobble database to create personal listening statisti
|
||||
|
||||
You can check [my own Maloja page](https://maloja.krateng.ch) to see what it looks like.
|
||||
|
||||
## **IMPORTANT NOTICE**
|
||||
|
||||
**Update to Version 2**
|
||||
|
||||
With the update 2.0, Maloja has been refactored into a Python package and the old update script no longer works. I will keep this repository on the old version for a while so that users with regular updates have a chance to load the transition script. If you have any trouble with updating, simply install Maloja as described below, then manually copy all your user data to your `~/.local/share/maloja` folder.
|
||||
|
||||
## Why not Last.fm / Libre.fm / GNU FM?
|
||||
|
||||
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.
|
||||
@ -22,25 +28,18 @@ Also neat: You can use your **custom artist or track images**.
|
||||
|
||||
## How to install
|
||||
|
||||
1) Either install Maloja with the [debian package](https://github.com/krateng/maloja/raw/master/packages/maloja.deb), or download the repository to some arbitrary location. If you pick the manual installation, every command needs to be executed from the Maloja directory and led with `./`. You can also only download the file `maloja` instead of the whole repository and fetch the rest with
|
||||
1) Install Maloja with
|
||||
|
||||
./maloja install
|
||||
pip3 install maloja
|
||||
|
||||
2) Install required packages with
|
||||
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
3) Start the server with
|
||||
2) Start the server with
|
||||
|
||||
maloja start
|
||||
|
||||
4) (Recommended) Put your server behind a reverse proxy for SSL encryption.
|
||||
3) (Recommended) Put your server behind a reverse proxy for SSL encryption.
|
||||
|
||||
## How to use
|
||||
|
||||
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) 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
|
||||
|
||||
maloja import *filename*
|
||||
@ -54,8 +53,6 @@ If you didn't install Maloja from the package (and therefore don't have it in `/
|
||||
maloja start
|
||||
maloja update
|
||||
|
||||
The `update` command will always fetch the latest version, while packages are only offered for release versions.
|
||||
|
||||
3) Various folders have `.info` files with more information on how to use their associated features.
|
||||
|
||||
4) If you'd like to implement anything on top of Maloja, visit `/api_explorer`.
|
||||
|
2
info.py
2
info.py
@ -5,6 +5,6 @@ author = {
|
||||
"email":"maloja@krateng.dev",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 1,5,15
|
||||
version = 1,5,16
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
dev = os.path.exists("./.dev")
|
||||
|
29
maloja
29
maloja
@ -39,6 +39,34 @@ def yellow(txt): return "\033[93m" + txt + "\033[0m"
|
||||
## LOADLASTFM GOTODIR - imports csv data
|
||||
## INSTALLHERE makes this directory valid - UPDATE - INSTALL - SETUP
|
||||
|
||||
|
||||
|
||||
def update_version_2():
|
||||
if gotodir():
|
||||
try:
|
||||
DATA_DIR = os.environ["XDG_DATA_HOME"].split(":")[0]
|
||||
assert os.path.exists(DATA_DIR)
|
||||
except:
|
||||
DATA_DIR = os.path.join(os.environ["HOME"],".local/share/")
|
||||
|
||||
DATA_DIR = os.path.join(DATA_DIR,"maloja")
|
||||
os.makedirs(DATA_DIR,exist_ok=True)
|
||||
|
||||
print(yellow("With version 2.0, Maloja has been refactored into a python package. The updater will attempt to make this transition smooth."))
|
||||
print("Relocating user data...")
|
||||
|
||||
import shutil
|
||||
for folder in ["clients","images","logs","rules","scrobbles","settings"]:
|
||||
shutil.copytree(folder,os.path.join(DATA_DIR,folder))
|
||||
|
||||
print("Installing pip package...")
|
||||
|
||||
os.system("pip3 install maloja --upgrade --no-cache-dir")
|
||||
|
||||
print(yellow("Maloja may now be started from any directory with the command"),blue("maloja start"))
|
||||
print(yellow("Updates will continue to work with ") + blue("maloja update") + yellow(", but you may also use pip directly"))
|
||||
print(yellow("Please test your new server installation. If it works correctly with all your scrobbles, rules, settings and custom images, you can delete your old Maloja directory."))
|
||||
|
||||
def gotodir():
|
||||
if os.path.exists("./server.py"):
|
||||
return True
|
||||
@ -347,4 +375,5 @@ if __name__ == "__main__":
|
||||
elif sys.argv[1] == "update": update()
|
||||
elif sys.argv[1] == "import": loadlastfm()
|
||||
elif sys.argv[1] == "install": installhere()
|
||||
elif sys.argv[1] == "update_v2": update_version_2()
|
||||
else: print("Valid commands: start restart stop update import install")
|
||||
|
Loading…
Reference in New Issue
Block a user