Compare commits

..

1 Commits

Author SHA1 Message Date
25d72680cb
Added more commands
added 2 commands that show the top tracks and albums played by a user.
There are some formatting decisions that will need to be taken.
Also the client library for the API seems exhausted. Missing some key
things. Yet to use a constructor the initialize an instance of the
client when plugin is called rather than under each function.

Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
2025-11-20 14:16:46 +05:30

View File

@ -51,14 +51,14 @@ class ListenBrainz(callbacks.Plugin):
"""
client = liblistenbrainz.ListenBrainz()
listen = client.get_playing_now(user)
if listen is not None:
if listen is None:
response = f"{user} doen't seem to be listening to anything"
else:
response = (
f"{user} is currently playing: \x02{listen.track_name}\x0f "
f"from \x02{listen.release_name}\x0f by \x02{listen.artist_name}\x0f "
f"at \x02{listen.listened_at}\x0f"
)
else:
response = f"{user} doen't seem to be listening to anything"
irc.reply(response)
@wrap(["text"])
@ -69,11 +69,10 @@ class ListenBrainz(callbacks.Plugin):
"""
client = liblistenbrainz.ListenBrainz()
count = client.get_user_listen_count(user)
if count is not None:
response = f"{user} has recorded listening to {count} tracks"
irc.reply(response)
else:
if count is None:
response = "Nothing recorded"
else:
response = (f"{user} has recorded listening to {count} tracks")
irc.reply(response)
@wrap(["text"])