Added more commands #2

Merged
pratyush merged 2 commits from add_more_commands into master 2025-11-21 11:03:13 +01:00
Owner

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.

can refer #1

Signed-off-by: Pratyush Desai pratyush.desai@liberta.casa

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. can refer #1 Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
pratyush added 1 commit 2025-11-19 15:00:54 +01:00
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>
Georg reviewed 2025-11-19 18:16:36 +01:00
plugin.py Outdated
@ -52,16 +53,16 @@ class ListenBrainz(callbacks.Plugin):
listen = client.get_playing_now(user)
if listen is not None:
Owner

nit: I think if listen is None ... foo ... else ... bar would be more direct than if listen is not None ... bar ... else ... foo

nit: I think `if listen is None ... foo ... else ... bar` would be more direct than `if listen is not None ... bar ... else ... foo`
pratyush marked this conversation as resolved
plugin.py Outdated
@ -70,11 +71,92 @@ class ListenBrainz(callbacks.Plugin):
count = client.get_user_listen_count(user)
if count is not None:
Owner

similar here, but it was not touched in this patch

similar here, but it was not touched in this patch
pratyush marked this conversation as resolved
plugin.py Outdated
@ -78,0 +104,4 @@
irc.reply(header)
for i, track in enumerate(top_tracks):
rank = i + 1
Owner

rank does not seem to be used, it could be removed, and then enumerate() and i would no longer be needed either - or am I missing something?

`rank` does not seem to be used, it could be removed, and then `enumerate()` and `i` would no longer be needed either - or am I missing something?
Author
Owner

it was a part of the output in the original idea but thought maybe it’s better to merge a –count optional arg which also does a reply.inPrivate (iirc it’s called).

it was a part of the output in the original idea but thought maybe it's better to merge a --count optional arg which also does a reply.inPrivate (iirc it's called).
Author
Owner

i feel even 4 lines is a lot of output so kept this hardcoded to top 3 results as it gives 25 by default.

i feel even 4 lines is a lot of output so kept this hardcoded to top 3 results as it gives 25 by default.
Author
Owner

Planning to keep it.

Planning to keep it.
pratyush marked this conversation as resolved
plugin.py Outdated
@ -78,0 +146,4 @@
irc.reply(header)
for i, release in enumerate(top_releases):
rank = i + 1
Owner

same here

same here
pratyush marked this conversation as resolved
pratyush changed title from Added more commands to DRAFT: Added more commands 2025-11-20 08:28:13 +01:00
pratyush changed title from DRAFT: Added more commands to WIP: Added more commands 2025-11-20 08:28:30 +01:00
pratyush force-pushed add_more_commands from e9a800a093 to 25d72680cb 2025-11-20 09:47:26 +01:00 Compare
pratyush changed title from WIP: Added more commands to Added more commands 2025-11-20 09:50:05 +01:00
pratyush added 1 commit 2025-11-20 20:51:46 +01:00
fix client instance initialization.

Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
pratyush force-pushed add_more_commands from 8003fbfa62 to d240612183 2025-11-20 20:56:33 +01:00 Compare
pratyush force-pushed add_more_commands from d240612183 to a675fc8c18 2025-11-21 11:00:00 +01:00 Compare
Author
Owner

Merging as there’s too much to improve and don’t want to jam it all here with forced pushes.

Merging as there's too much to improve and don't want to jam it all here with forced pushes.
pratyush merged commit ff2bbfcc25 into master 2025-11-21 11:03:13 +01:00
pratyush deleted branch add_more_commands 2025-11-21 11:03:14 +01:00
Sign in to join this conversation.
No description provided.