Various fixes

This commit is contained in:
krateng 2022-02-13 07:45:22 +01:00
parent a64d3610d3
commit 8db87bdbc5
6 changed files with 26 additions and 19 deletions

View File

@ -225,19 +225,18 @@ def post_scrobble(artist:Multi=None,**keys):
:param string artists: List of artists. Overwritten by artist parameter.
:param string title: Title of the track.
:param string album: Name of the album. Optional.
:param string albumartists: Album artists. Optional.
:param int duration: Actual listened duration of the scrobble in seconds. Optional.
:param int length: Total length of the track in seconds. Optional.
:param int time: UNIX timestamp of the scrobble. Optional, not needed if scrobble is at time of request.
:param boolean nofix: Skip server-side metadata parsing. Optional.
"""
#artists = "/".join(artist)
artists = artist if artist is not None else keys.get("artists")
title = keys.get("title")
album = keys.get("album")
duration = keys.get("seconds")
time = keys.get("time")
nofix = keys.get("nofix") is not None
keys['artists'] = [artist] if artist is not None else keys.get("artists")
keys['fix'] = keys.get("nofix") is None
if time is not None: time = int(time)
return incoming_scrobble(artists,title,album=album,duration=duration,time=time,fix=not nofix)
return incoming_scrobble(**keys)

View File

@ -72,7 +72,7 @@ coa = CollectorAgent()
def incoming_scrobble(artists,title,album=None,albumartists=None,duration=None,time=None,fix=True):
def incoming_scrobble(artists,title,album=None,albumartists=None,duration=None,length=None,time=None,fix=True):
if time is None:
time = int(datetime.datetime.now(tz=datetime.timezone.utc).timestamp())

View File

@ -36,7 +36,7 @@ def uri_to_internal(keys,forceTrack=False,forceArtist=False,api=False):
limitkeys["timerange"] = get_range_object(since=since,to=to,within=within)
#3
delimitkeys = {"step":"month","stepn":1,"trail":1}
delimitkeys = {"step":"year","stepn":1,"trail":1}
if "step" in keys: [delimitkeys["step"],delimitkeys["stepn"]] = (keys["step"].split("-") + [1])[:2]
if "stepn" in keys: delimitkeys["stepn"] = keys["stepn"] #overwrite if explicitly given
if "stepn" in delimitkeys: delimitkeys["stepn"] = int(delimitkeys["stepn"]) #in both cases, convert it here

View File

@ -49,6 +49,7 @@
<div class="footer">
<div>
<span>Get your own charts on
<a target="_blank" rel="noopener noreferrer" href="https://github.com/krateng/maloja">GitHub</a>,
<a target="_blank" rel="noopener noreferrer" href="https://pypi.org/project/malojaserver/">PyPI</a> or
<a target="_blank" rel="noopener noreferrer" href="https://hub.docker.com/r/krateng/maloja">Dockerhub</a>
</span>

View File

@ -54,7 +54,7 @@
<h2>Start Scrobbling</h2>
If you use Vivaldi, Brave, Iridium or any other Chromium-based browser and listen to music on Plex or YouTube Music, download the extension and simply enter the server URL as well as your API key in the relevant fields. They will turn green if the server is accessible.
If you use a Chromium-based browser and listen to music on Plex, Spotify, Soundcloud, Bandcamp or YouTube Music, download the extension and simply enter the server URL as well as your API key in the relevant fields. They will turn green if the server is accessible.
<br/><br/>
You can also use any standard-compliant scrobbler. For GNUFM (audioscrobbler) scrobblers, enter <span class="stats"><span name="serverurl">yourserver.tld</span>/apis/audioscrobbler</span> as your Gnukebox server and your API key as the password. For Listenbrainz scrobblers, use <span class="stats"><span name="serverurl">yourserver.tld</span>/apis/listenbrainz</span> as the API URL and your API key as token.
<br/><br/>
@ -62,15 +62,20 @@
<span class="stats"><span name="serverurl">yourserver.tld</span>/apis/mlj_1/newscrobble</span>
(make sure to use the public URL) with the key-value-pairs
(make sure to use the public URL) with the following values encoded as JSON:
<br/>
<br/>
<table class="misc">
<tr> <td>artist</td> <td><i>Artist String</i></td> </tr>
<tr> <td>title</td> <td><i>Title String</i></td> </tr>
<tr> <td>key</td> <td><i>API Key</i></td> </tr>
<tr> <td>time</td> <td><i>UNIX timestamp - optional, defaults to time of request</i></td> </tr>
<tr> <td>seconds</td> <td><i>Duration of Scrobble - optional and currently not used</i></td> </tr>
<tr> <td>artists</td> <td><i>List of artist names</i></td> </tr>
<tr> <td>title</td> <td><i>Song title</i></td> </tr>
<tr> <td>album</td> <td><i>Album title - optional</i></td> </tr>
<tr> <td>albumartists</td> <td><i>List of album artists - optional</i></td> </tr>
<tr> <td>duration</td> <td><i>Duration of play in seconds - optional</i></td> </tr>
<tr> <td>length</td> <td><i>Full length of the trackin seconds - optional</i></td> </tr>
<tr> <td>time</td> <td><i>UNIX timestamp - optional, defaults to time of request</i></td> </tr>
<tr> <td>fix</td> <td><i>Set this to false to skip server-side metadata fixing - optional</i></td> </tr>
<tr> <td>key</td> <td><i>API Key, see <a class="textlink" href="/admin_apikeys">API Keys</a></i></td> </tr>
</table>
<br/><br/>
Finally, you could always <a class="textlink" href="/admin_manual">manually scrobble</a>!
@ -79,7 +84,8 @@
<h2>Import your Last.FM data</h2>
Switching from Last.fm? <a class="textlink" href="https://benjaminbenben.com/lastfm-to-csv/">Download all your data</a> and run the command <span class="stats">maloja import <i>(the file you just downloaded)</i></span>.
Switching from Last.fm? <a class="textlink" href="https://benjaminbenben.com/lastfm-to-csv/">Download all your data</a> and run the command <span class="stats">maloja import <i>(the file you just downloaded)</i></span>.<br/>
You can also try out <a href="https://github.com/FoxxMD/multi-scrobbler">Multi-Scrobbler</a> to import scrobbles from a wider range of sources.
<br/><br/>
<h2>Set up some rules</h2>

View File

@ -1,6 +1,6 @@
[project]
name = "malojaserver"
version = "2.14.6"
version = "3.0.0-dev"
description = "Self-hosted music scrobble database"
readme = "./README.md"
requires-python = ">=3.6"
@ -28,7 +28,8 @@ dependencies = [
"jinja2>=2.11",
"lru-dict>=1.1.6",
"css_html_js_minify>=2.5.5",
"psutil>=5.8.0"
"psutil>=5.8.0",
"sqlalchemy>=1.4"
]
[project.scripts]