Skip to content

Commit

Permalink
Saving additional info for Listenbrainz API, fix GH-149
Browse files Browse the repository at this point in the history
  • Loading branch information
krateng committed May 17, 2022
1 parent 084c7d5 commit 1eaba88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions dev/releases/3.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ minor_release_name: "Soyeon"
- "[Bugfix] Fixed leftover whitespaces when parsing titles"
- "[Bugfix] Fixed handling of fallthrough values in config file"
3.1.3:
commit: "f3a04c79b1c37597cdf3cafcd95e3c923cd6a53f"
notes:
- "[Bugfix] Fixed infinite recursion with capitalized featuring delimiters"
- "[Bugfix] Fixed favicon display"
3.1.4:
notes:
- "[Feature] Expanded information saved from Listenbrainz API"
12 changes: 11 additions & 1 deletion maloja/apis/listenbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,27 @@ def submit(self,pathnodes,keys):
try:
metadata = listen["track_metadata"]
artiststr, titlestr = metadata["artist_name"], metadata["track_name"]
additional = metadata.get("additional_info",{})
try:
timestamp = int(listen["listened_at"])
except Exception:
timestamp = None
except Exception:
raise MalformedJSONException()

extrafields = {
# fields that will not be consumed by regular scrobbling
# will go into 'extra'
k:additional[k]
for k in ['release_mbid','artist_mbids','recording_mbid','tags']
if k in additional
}

self.scrobble({
'track_artists':[artiststr],
'track_title':titlestr,
'scrobble_time':timestamp
'scrobble_time':timestamp,
**extrafields
},client=client)

return 200,{"status":"ok"}
Expand Down

0 comments on commit 1eaba88

Please sign in to comment.