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

Some refining

This commit is contained in:
Krateng 2019-11-25 02:32:59 +01:00
parent 55621ef4ef
commit 8f53839db8
7 changed files with 35 additions and 33 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# generic temporary / dev files
*.pyc
*.sh
!/alpine_install.sh
*.note
*.xcf
nohup.out

View File

@ -17,30 +17,21 @@ Also neat: You can use your **custom artist or track images**.
## Requirements
* Python 3
* Pip packages specified in `requirements.txt`
* Several Pip packages (automatically downloaded)
* If you'd like to display images, you will need API keys for [Last.fm](https://www.last.fm/api/account/create) and [Fanart.tv](https://fanart.tv/get-an-api-key/). These are free of charge!
## 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) Download Maloja with the command `pip install maloja`. Make sure to use the correct python version (Use `pip3` if necessary). I've provided a simple .sh file to get Maloja going on an Alpine server (e.g. in Proxmox).
./maloja install
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*
@ -52,13 +43,12 @@ If you didn't install Maloja from the package (and therefore don't have it in `/
maloja stop
maloja restart
maloja start
maloja update
The `update` command will always fetch the latest version, while packages are only offered for release versions.
3) Update Maloja with `pip install maloja --upgrade --no-cache-dir`
3) Various folders have `.info` files with more information on how to use their associated features.
4) 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`.
5) If you'd like to implement anything on top of Maloja, visit `/api_explorer`.
## How to scrobble

3
alpine_install.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
apk add python3 python3-dev gcc libxml2-dev libxslt-dev py3-pip libc-dev
pip3 install maloja

View File

@ -5,7 +5,7 @@ from .info import author,version,versionstr
requires = [
"bottle>=0.12.16",
"waitress>=1.3",
"doreah>=1.2.7",
"doreah>=1.2.9",
"nimrodel>=0.4.9",
"setproctitle>=1.1.10",
"wand>=0.5.4",

View File

@ -22,6 +22,7 @@ def yellow(txt): return "\033[93m" + txt + "\033[0m"
origpath = os.getcwd()
os.chdir(DATA_DIR)
def copy_initial_local_files():
@ -131,11 +132,10 @@ def stop():
return True
def loadlastfm():
def loadlastfm(filename):
try:
filename = sys.argv[2]
filename = os.path.abspath(filename)
filename = os.path.join(origpath,filename)
except:
print("Please specify a file!")
return
@ -147,19 +147,27 @@ def loadlastfm():
else:
return
print("Please wait...")
os.system("python3 ./lastfmconverter.py " + filename + " ./scrobbles/lastfmimport.tsv")
os.system("python3 -m maloja.lastfmconverter " + filename + " ./scrobbles/lastfmimport.tsv")
print("Successfully imported your Last.FM scrobbles!")
def direct():
from . import server
from doreah.control import mainfunction
def main():
if sys.argv[1] == "start": restart()
elif sys.argv[1] == "restart": restart()
elif sys.argv[1] == "stop": stop()
#elif sys.argv[1] == "update": update()
elif sys.argv[1] == "import": loadlastfm()
#elif sys.argv[1] == "install": installhere()
else: print("Valid commands: start restart stop import")
@mainfunction({},shield=True)
def main(action,*args,**kwargs):
actions = {
"start":restart,
"restart":restart,
"stop":stop,
"import":loadlastfm,
"debug":direct
}
if action in actions: actions[action](*args,**kwargs)
else: print("Valid commands: " + " ".join(a for a in actions))
if __name__ == "__main__":
main()
return True
#if __name__ == "__main__":
# main()

View File

@ -5,7 +5,7 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,0,0
version = 2,0,1
versionstr = ".".join(str(n) for n in version)

Binary file not shown.