add scrobble frontend

This commit is contained in:
bw 2024-10-03 00:50:47 -07:00
parent 4bc641e95a
commit 370508acc4
4 changed files with 50 additions and 0 deletions

View file

@ -93,6 +93,23 @@ class SubsonicApi:
def get_censored_song_stream_uri(self, song_id):
return self.get_subsonic_uri("stream", dict(id=song_id), True)
def send_scrobble(self, song_id, submission=True):
try:
response = self.connection.scrobble(
uri.get_song_id(song_id),
submission
)
except Exception:
logger.warning("Failed to scrobble")
return None
if response.get("status") != RESPONSE_OK:
logger.warning(
"Got non-okay status code from subsonic: $s"
% response.get("status")
)
return None
return response.get("scrobble")
def find_raw(
self,
query,