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 # generic temporary / dev files
*.pyc *.pyc
*.sh *.sh
!/alpine_install.sh
*.note *.note
*.xcf *.xcf
nohup.out nohup.out

View File

@ -17,30 +17,21 @@ Also neat: You can use your **custom artist or track images**.
## Requirements ## Requirements
* Python 3 * 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! * 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 ## 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) Start the server with
2) Install required packages with
pip3 install -r requirements.txt
3) Start the server with
maloja start 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 ## 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 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* 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 stop
maloja restart maloja restart
maloja start 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 ## 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 = [ requires = [
"bottle>=0.12.16", "bottle>=0.12.16",
"waitress>=1.3", "waitress>=1.3",
"doreah>=1.2.7", "doreah>=1.2.9",
"nimrodel>=0.4.9", "nimrodel>=0.4.9",
"setproctitle>=1.1.10", "setproctitle>=1.1.10",
"wand>=0.5.4", "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) os.chdir(DATA_DIR)
def copy_initial_local_files(): def copy_initial_local_files():
@ -131,11 +132,10 @@ def stop():
return True return True
def loadlastfm(): def loadlastfm(filename):
try: try:
filename = sys.argv[2] filename = os.path.join(origpath,filename)
filename = os.path.abspath(filename)
except: except:
print("Please specify a file!") print("Please specify a file!")
return return
@ -147,19 +147,27 @@ def loadlastfm():
else: else:
return return
print("Please wait...") 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!") print("Successfully imported your Last.FM scrobbles!")
def direct():
from . import server
from doreah.control import mainfunction
def main(): @mainfunction({},shield=True)
if sys.argv[1] == "start": restart() def main(action,*args,**kwargs):
elif sys.argv[1] == "restart": restart() actions = {
elif sys.argv[1] == "stop": stop() "start":restart,
#elif sys.argv[1] == "update": update() "restart":restart,
elif sys.argv[1] == "import": loadlastfm() "stop":stop,
#elif sys.argv[1] == "install": installhere() "import":loadlastfm,
else: print("Valid commands: start restart stop import") "debug":direct
}
if action in actions: actions[action](*args,**kwargs)
else: print("Valid commands: " + " ".join(a for a in actions))
return True
if __name__ == "__main__": #if __name__ == "__main__":
main() # main()

View File

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

Binary file not shown.