Hi, is there any method to fetch the total number of artists grouped by a country?
2025-04-14 10423, 2025
holycow23[m]
* Hi, is there any function defined to fetch the total number of artists grouped by a country?
2025-04-14 10419, 2025
mayhem[m] joined the channel
2025-04-14 10420, 2025
mayhem[m]
holycow23[m]: I personally don't know of one, but I suspect that if it does exist in the spark world, lucifer would know.
2025-04-14 10439, 2025
monkey[m] joined the channel
2025-04-14 10439, 2025
monkey[m]
<lucifer[m]> "monkey: sure i can create a..." <- Great, some help would be very helpful, thank you :)
2025-04-14 10439, 2025
monkey[m]
I got the SSE endpoint working and sending updates. The part I need help with is somehow consuming incoming listening-now listens for a specific person, and how to set that up as a generator function for the SSE endpoint.
2025-04-14 10439, 2025
monkey[m]
Let me upload the code I have for now...
2025-04-14 10404, 2025
holycow23[m]
<BrainzGit> "[listenbrainz-server] granth23..." <- ansh: could you please review this PR
Currently sleeps 5 seconds before checking the playing-now again, for testing only.
2025-04-14 10427, 2025
monkey[m]
I struggled trying to figure out how to consume the RMQ channel, didn't get it to work. I figured this would be a good time to pass the baton and learn from your implementation
2025-04-14 10403, 2025
lucifer[m]
holycow23: its not a function but yes that data is available in a table you can join to. what's your use case?
2025-04-14 10422, 2025
lucifer[m]
monkey: i saw your latest commit in the widgets branch but i have a feeling it might not work, because as long as the sse request is running uwsgi won't be able to take up another request for processing. so 10-20 widgets rendering would block the server.
2025-04-14 10452, 2025
lucifer[m]
also one more thing, sse has a limit of 6 connections per site per browser.
2025-04-14 10454, 2025
monkey[m]
Oh...
2025-04-14 10425, 2025
monkey[m]
Well, that's unfortunate, then. Do you think I should go back to a timed polling system on the client?
2025-04-14 10440, 2025
lucifer[m]
can you do it without real time updates for now?
2025-04-14 10408, 2025
lucifer[m]
or can you use websockets?
2025-04-14 10409, 2025
monkey[m]
Yeah, I suppose we're back to WS in that case. Poop 💩
2025-04-14 10413, 2025
lucifer[m]
lucifer[m]: this could be potentially solved by migrating to async flask but that is a big task.
2025-04-14 10442, 2025
lucifer[m]
monkey[m]: does WS has a downside for your use case?
2025-04-14 10403, 2025
monkey[m]
I'll have to see what the support is like with HTMX
2025-04-14 10420, 2025
monkey[m]
But overall, I suspect heavier library, less god interaction with HTMX
htmx seems to support websockets but not socket.io
2025-04-14 10456, 2025
lucifer[m]
we are using socket.io which is a wrapper around websockets and provides some additional capabilities on top of it. but yeah try using it and if you face issues let me know and i can try to help fix it.
2025-04-14 10421, 2025
monkey[m]
Cool, I'll have a look. Although I think I'll have the same questions: How does one connect to the WS feed for a specific user?
on the connection start, you emit a message with the username to add a user's feed to your connection. then you monitor it using the playing now events.
2025-04-14 10428, 2025
lucifer[m]
the WS feeds already exist so you only need frontend side to connect properly. i am not sure if we can connect properly without the socket.io extension but try it and let me know. otherwise i'll to find a work around.
2025-04-14 10447, 2025
monkey[m]
lucifer: I think this is a different mechanism than what I am trying to achieve. I'm trying to do all the templating and rendering on the server, and send rendered HTML fragments to the client.
2025-04-14 10447, 2025
monkey[m]
So I'd like to avoid the type of mechanism we have for the metadataviewer, where we render everything on the client.
2025-04-14 10445, 2025
lucifer[m]
monkey: yes i understand that but do you want constant updates or just show the playing now listen at the time of server rendering?
2025-04-14 10454, 2025
monkey[m]
What I'm looking for is how to consume incoming listens for the user on the server-side, then I'll try to set up the fragment update mechanism using WS + HTMX>
2025-04-14 10454, 2025
monkey[m]
SO not connecting to the same WS feed I suppose
2025-04-14 10420, 2025
monkey[m]
The initial rendering of playing now listen is all working fine already, that's sorted.
2025-04-14 10443, 2025
monkey[m]
I do want constant updates when a new listening-now comes in, if we can
2025-04-14 10422, 2025
lucifer[m]
right so at that point the code to consume the playing now listens would run on the client side no?
2025-04-14 10424, 2025
monkey[m]
But I could try to have the client do regular polling if that's easier than sending updates from the server
2025-04-14 10432, 2025
lucifer[m]
since the initial render on the server side has already completed.
2025-04-14 10458, 2025
monkey[m]
lucifer[m]: No, it would be consumed on the server, rendered using jinja templates, and the rendered HTML will be sent to the client
2025-04-14 10410, 2025
monkey[m]
(i.e. no the initial playing-now WS message)
2025-04-14 10416, 2025
monkey[m]
not*
2025-04-14 10452, 2025
lucifer[m]
i see and how would you send this rendered html to the client?
2025-04-14 10429, 2025
monkey[m]
So currently that's done with SSE, but with all the new info I suppose we'll
2025-04-14 10433, 2025
monkey[m]
ditch that.
2025-04-14 10435, 2025
lucifer[m]
ah okay got it.
2025-04-14 10402, 2025
lucifer[m]
so instead of the json listen payload, you want a html payload created from the json
2025-04-14 10412, 2025
monkey[m]
So I guess setting up a new WS connection (at that point, doesn't need to be socket.io maybe?) and use HTMX to connect to an update endpoint which will send the HTML fragment
2025-04-14 10417, 2025
monkey[m]
Yes
2025-04-14 10429, 2025
lucifer[m]
that shouldn't be hard, we can create a new WS room/endpoint
2025-04-14 10412, 2025
lucifer[m]
can you just test one thing, somehow log the json payload in htmx and see if its ws library works fine with our websockets setup.
2025-04-14 10437, 2025
lucifer[m]
if that works, i can setup a new endpoint for you to test. otherwise we'll first have to make the connection work.
2025-04-14 10446, 2025
monkey[m]
Well, I still need help with setting up the json payload consumer
2025-04-14 10452, 2025
monkey[m]
One sec
2025-04-14 10458, 2025
lucifer[m]
sure
2025-04-14 10444, 2025
monkey[m]
OK, understood better now :)
2025-04-14 10444, 2025
monkey[m]
I'll try to set up the HTMX code to hit our existing WS/socketi.io endpoint, see what happens
2025-04-14 10456, 2025
lucifer[m]
okay i don't it will work. htmx has custom event names that need to be defined on our server.
2025-04-14 10455, 2025
lucifer[m]
i'll try to set it up later today and try to make it work.
LB-1777: Artist origin map "play something from this country"
2025-04-14 10429, 2025
lucifer[m]
holycow23: i see, can you tell what's your plan is to implement it? i don't think you'll need spark for it.
2025-04-14 10420, 2025
lucifer[m]
also mayhem might want to work this through LB radio so it might be better to add country support to LB radio if missing and then you only need to create a prompt.
2025-04-14 10423, 2025
monkey[m]
lucifer: I found one way that does work, it might just be enough...... (full message at <https://matrix.chatbrainz.org/_matrix/media/v3/download/chatbrainz.org/rnCMMKUkwBTrQZtnWJqwqVUf>)
2025-04-14 10409, 2025
lucifer[m]
monkey: polling the playing now endpoint is pretty efficient since it only queries redis.
2025-04-14 10417, 2025
holycow23[m]
lucifer[m]: I didn't intend to use spark, but if needed will have to make an API/function to retrieve the count for a country, which I will call everytime the stats are loaded
2025-04-14 10438, 2025
holycow23[m]
lucifer[m]: Country is already supported by radio and thus the LB-Radio side and prompt work is already done
2025-04-14 10447, 2025
monkey[m]
lucifer[m]: I think this would probably be hitting the widget endpoint that renders the HTML fragment instead, but maybe it could be improved in the same way I used the socket.io event, i.e. hit the plyaing-now endpoint, parse the response, compare if it is the same trans_name, otherwise trigger an event to reload the fragment...
2025-04-14 10409, 2025
mayhem[m]
there is country support in LB Radio. play random recordings from a country.
2025-04-14 10424, 2025
lucifer[m]
monkey: yes that sounds good to me
2025-04-14 10445, 2025
lucifer[m]
i think that is simplest for now.
2025-04-14 10458, 2025
monkey[m]
We're assuming it is better than loading the JS for socket.io and using a long-lived WS connection, then?
2025-04-14 10402, 2025
monkey[m]
OK
2025-04-14 10448, 2025
monkey[m]
Thank for the assist! No more need to consume the RMQ message on the server then, simpler to set up.
2025-04-14 10451, 2025
lucifer[m]
holycow23: i see, how do you intend to use the total artists count? anyway if you want to use it here then we'll have to create a LB metadata or labs api query for that.
2025-04-14 10413, 2025
monkey[m]
Shame about SSE though, that seemed like a really nice solution
2025-04-14 10427, 2025
holycow23[m] uploaded an image: (20KiB) < https://matrix.chatbrainz.org/_matrix/media/v3/download/matrix.org/igaKlWpNIaVQWorYbDAVyomR/image.png >
2025-04-14 10428, 2025
lucifer[m]
it is a nice solution yes, but i don't think it is meant for this use case.
2025-04-14 10400, 2025
monkey[m]
Apparently HTTP/2 removes the issue with 6 concurrent connections (defaults to 100)
2025-04-14 10416, 2025
lucifer[m]
oh i didn't know that, that's great.
2025-04-14 10430, 2025
holycow23[m]
holycow23[m]: The mockup prepared by aerozol has a total artist count from the country
if you face any issues, let me know and i'll help out
2025-04-14 10432, 2025
yano joined the channel
2025-04-14 10414, 2025
reosarevok[m]
aerozol, bitmap: MBS-13984 seems like a reasonable complaint to me - not sure what would be the best way to deal with this, do you have a preference from the suggested options?
"not show them at all", "show them collapsed" both sound good to me, potentially. I don't think it's the end of the world the way it is now, but still gets a bit silly :)
2025-04-14 10413, 2025
holycow23[m]
<lucifer[m]> "so forget the labs api link..." <- cool will look into it
if you cannot setup the dump, i can create the endpoint for you
2025-04-14 10444, 2025
holycow23[m]
I will give it a try
2025-04-14 10426, 2025
holycow23[m]
How do I use the dump?
2025-04-14 10446, 2025
holycow23[m]
And I assume I need to go ahead with admin/configure with alt-db-only-mirror
2025-04-14 10400, 2025
holycow23[m]
s//`/, s//` to just use the db not the website/
2025-04-14 10445, 2025
holycow23[m]
<lucifer[m]> "if you cannot setup the dump..." <- And I assume I need to go ahead with `admin/configure with alt-db-only-mirror` to just use the db not the website
2025-04-14 10455, 2025
lucifer[m]
Yes
2025-04-14 10419, 2025
holycow23[m]
okay
2025-04-14 10454, 2025
jasje[m] has quit
2025-04-14 10437, 2025
bitmap[m] joined the channel
2025-04-14 10437, 2025
bitmap[m]
<reosarevok[m]> ""not show them at all", "show..." <- my thought would be to hide them entirely (I've never even seen these before since I use the inline mode, and they aren't shown inline for some reason?) but maybe wait for more feedback on the ticket
2025-04-14 10454, 2025
reosarevok[m]
I think we hide a bunch of things online we do show on the bottom
2025-04-14 10447, 2025
reosarevok[m]
Inline even :D
2025-04-14 10419, 2025
yano has quit
2025-04-14 10400, 2025
bitmap[m]
hmm, well we do have an isIrrelevantLinkType util but it's called from both places. only the inline code skips urls though. there might be other differences I'm missing
2025-04-14 10418, 2025
reosarevok[m]
Hmm, ok
2025-04-14 10433, 2025
reosarevok[m]
Let's see what aerozol thinks (any other opinions welcome!)
2025-04-14 10440, 2025
yano joined the channel
2025-04-14 10448, 2025
yano has quit
2025-04-14 10406, 2025
yano joined the channel
2025-04-14 10447, 2025
julian45[m] joined the channel
2025-04-14 10447, 2025
TOPIC: MetaBrainz Community and Development channel | MusicBrainz non-development: #musicbrainz | BookBrainz: #bookbrainz | Channel is logged and not empty as it is bridged to IRC; see https://musicbrainz.org/doc/ChatBrainz for details | Agenda: Reviews, ChatBrainz downtime
2025-04-14 10419, 2025
TOPIC: MetaBrainz Community and Development channel | MusicBrainz non-development: #musicbrainz | BookBrainz: #bookbrainz | Channel is logged and not empty as it is bridged to IRC; see https://musicbrainz.org/doc/ChatBrainz for details | Agenda: Reviews
2025-04-14 10432, 2025
rustynova[m] joined the channel
2025-04-14 10433, 2025
rustynova[m]
Kinda want some advice on this. Critiquebrainz uses oauth for user api requests, meaning I need to securely store the app tokens. However, how can I do that in an user script? Should I just give up and let it in plain text?