mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added Python library for music players / scrobblers
This commit is contained in:
27
malojalib/__init__.py
Normal file
27
malojalib/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import requests
|
||||
|
||||
class MalojaInstance:
|
||||
def __init__(self,base_url,key):
|
||||
self.base_url = base_url
|
||||
self.key = key
|
||||
|
||||
def test(self):
|
||||
url = self.base_url + '/apis/mlj_1/test'
|
||||
response = requests.get(url,{'key':self.key})
|
||||
|
||||
return (response.status_code == 200)
|
||||
|
||||
def scrobble(self,artists,title,timestamp=None,album=None,duration=None):
|
||||
payload = {
|
||||
'key':self.key,
|
||||
'artists':artists,
|
||||
'title':title,
|
||||
'time':timestamp,
|
||||
'album':album,
|
||||
'duration':duration
|
||||
}
|
||||
|
||||
url = self.base_url + '/apis/mlj_1/newscrobble'
|
||||
response = requests.post(url,payload)
|
||||
|
||||
return response.json()
|
||||
22
malojalib/__pkginfo__.py
Normal file
22
malojalib/__pkginfo__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
name = "maloja-lib"
|
||||
desc = "Utilities to interact with Maloja servers"
|
||||
author = {
|
||||
"name":"Johannes Krattenmacher",
|
||||
"email":"maloja@dev.krateng.ch",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 1,0,0
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
links = {
|
||||
"pypi":"maloja-lib",
|
||||
"github":"maloja"
|
||||
}
|
||||
python_version = ">=3.6"
|
||||
requires = [
|
||||
"requests"
|
||||
]
|
||||
resources = [
|
||||
]
|
||||
|
||||
commands = {
|
||||
}
|
||||
Reference in New Issue
Block a user