Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-1777

Artist origin map "play something from this country"

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None

      Combining the powers of the artist origins map and LB Radio!

      When you click on a country, a little button at the bottom with "Play [country]" would be cool. It would generate a playlist with a simple prompt like "country:(Mali)" and start playing it.

      We should also enable clicking on countries with 0 plays, for this purpose.

      Stretch goal: A "play the world" button (or just a nondescript play button in the corner of the map) which has a prompt for a playlist containing all the countries.

      Super overachiever stretch goal: Probably should be another ticket, but while I'm here... light up the country squares when something from that country is currently playing!

        1. image-2025-04-06-13-54-15-536.png
          image-2025-04-06-13-54-15-536.png
          59 kB
        2. india overhaul.png
          india overhaul.png
          132 kB
        3. play the world.png
          play the world.png
          280 kB
        4. screenshot-1.png
          screenshot-1.png
          26 kB

          [LB-1777] Artist origin map "play something from this country"

          GitHub Bot added a comment -

          See code changes in pull request #3257 submitted by granth23.

          GitHub Bot added a comment - See code changes in pull request #3257 submitted by granth23 .

          Aerozol added a comment -

          btw if this is getting into the weeds and sounding super annoying, you really are okay to just leave it blank!

          I like to include challenges in my mockups, it is always okay to question whether they are really needed.

          Aerozol added a comment - btw if this is getting into the weeds and sounding super annoying, you really are okay to just leave it blank! I like to include challenges in my mockups, it is always okay to question whether they are really needed.

          Aerozol added a comment -

          As said, we can leave it blank but also:

          Not sure what we could hardcode. Maybe one of these (kinda useless but looks interesting!)

          • Location (lat/long or 38°33′N 68°48′E)
          • Area (e.g. 143,100 km2)
            They are available via Wikipedia and are unlikely to ever change, but would be quite a bit of manual cutting and pasting!

          Aerozol added a comment - As said, we can leave it blank but also: Not sure what we could hardcode. Maybe one of these (kinda useless but looks interesting!) Location (lat/long or 38°33′N 68°48′E) Area (e.g. 143,100 km2) They are available via Wikipedia and are unlikely to ever change, but would be quite a bit of manual cutting and pasting!

          holycow23 added a comment -

          It could be a hectic process for a small detail so could it be replaced with something else or could we just go ahead without that for now?

          holycow23 added a comment - It could be a hectic process for a small detail so could it be replaced with something else or could we just go ahead without that for now?

          Monkey added a comment -

          We can't fetch those stats unfortunately. No API endpoints for it.
          We could potentially add new endpoints in listenbrainz to fetch that data from the MB database, but at this point it's starting to look like a big job for a small detail...

          Monkey added a comment - We can't fetch those stats unfortunately. No API endpoints for it. We could potentially add new endpoints in listenbrainz to fetch that data from the MB database, but at this point it's starting to look like a big job for a small detail...

          Aerozol added a comment -

          Looks great holycow23!

          The artist count is from: https://musicbrainz.org/statistics/countries
          Which presumably we can fetch?

          But TBH I was just filling a space - if it's too complicated we could put something else there? All of the actual fun/interesting stuff (like the countries top listened artist, or the MB wikipedia link) would require backend stuff/fetching.

          Not sure what we could hardcode. Maybe one of these (kinda useless but looks interesting!)

          • Location (lat/long or 38°33′N 68°48′E)
          • Area (e.g. 143,100 km2)

          Aerozol added a comment - Looks great holycow23 ! The artist count is from: https://musicbrainz.org/statistics/countries Which presumably we can fetch? But TBH I was just filling a space - if it's too complicated we could put something else there? All of the actual fun/interesting stuff (like the countries top listened artist, or the MB wikipedia link) would require backend stuff/fetching. Not sure what we could hardcode. Maybe one of these (kinda useless but looks interesting!) Location (lat/long or 38°33′N 68°48′E) Area (e.g. 143,100 km2)

          Monkey added a comment -

          I think you are right, adding an entirely new page will hide the feature away.
          Let's add it in the existing map as you suggested, and revisit it at a later date when we have more related features (like the "personal stats + country" playlists).

          Monkey added a comment - I think you are right, adding an entirely new page will hide the feature away. Let's add it in the existing map as you suggested, and revisit it at a later date when we have more related features (like the "personal stats + country" playlists).

          holycow23 added a comment - - edited

          Does this look nice and could you help me with fetching the Artists count for the country

          holycow23 added a comment - - edited Does this look nice and could you help me with fetching the Artists count for the country

          holycow23 added a comment -

          Yeah I went through the codebase too, couldn't find a solution for "and" so for now we could ahead with just the "Play India" button.

          holycow23 added a comment - Yeah I went through the codebase too, couldn't find a solution for "and" so for now we could ahead with just the "Play India" button.

          Aerozol added a comment -

          Unfortunately mayhem has confirmed there is no way to have 'country' AND 'user.

          So we would just have the one "play india" play button. I am okay with this though. Or do you still think it is confusing, with the proposed updated layout, mr_monkey?

          Aerozol added a comment - Unfortunately mayhem has confirmed there is no way to have 'country' AND 'user. So we would just have the one "play india" play button. I am okay with this though. Or do you still think it is confusing, with the proposed updated layout, mr_monkey ?

          Aerozol added a comment -

          Hmm you're right - I'm certain there is a way to make the playlist use "AND" instead of "OR" (so both statements have to be true for a recording to be added), but I can't remember and I can't figure it out from the docs: https://troi.readthedocs.io/en/latest/lb_radio.html

          Aerozol added a comment - Hmm you're right - I'm certain there is a way to make the playlist use "AND" instead of "OR" (so both statements have to be true for a recording to be added), but I can't remember and I can't figure it out from the docs: https://troi.readthedocs.io/en/latest/lb_radio.html

          holycow23 added a comment - - edited

          The attached Radio query generates a mix of songs from New Zealand and Your own listens (from around the world) but not your listens from new zealand as far as I know so not sure if the My New Zealand button would just have songs from New Zealand Origin.

          holycow23 added a comment - - edited The attached Radio query generates a mix of songs from New Zealand and Your own listens (from around the world) but not your listens from new zealand as far as I know so not sure if the My New Zealand button would just have songs from New Zealand Origin.

          Aerozol added a comment -

          I don't know about a new page, just to add a play button. If we were adding more functions I think that would be cool, but otherwise it feels like duplication + hiding away a feature. We're not hurting for space when a user clicks on a country, are we?

          The following mockup is a through re. how it could be made clearer - it assumes that this playlist prompt generates what we want for the personal playlists:

          stats:aerozol::week country:(new zealand)
          

          P.S. Another "simple" ticket that turns out not to be that simple

          Aerozol added a comment - I don't know about a new page, just to add a play button. If we were adding more functions I think that would be cool, but otherwise it feels like duplication + hiding away a feature. We're not hurting for space when a user clicks on a country, are we? The following mockup is a through re. how it could be made clearer - it assumes that this playlist prompt generates what we want for the personal playlists: stats:aerozol::week country:( new zealand) P.S. Another "simple" ticket that turns out not to be that simple

          holycow23 added a comment -

          I thought of two options to integrate this functionality:

          1. What if we just showed this button of "Play India" if the stats are "Global". 
          2. If a new page in the explore section then we could just show the same map using nivo and on click it plays the country and we could add like an info rollover explaining what would be played.

          holycow23 added a comment - I thought of two options to integrate this functionality: What if we just showed this button of "Play India" if the stats are "Global".  If a new page in the explore section then we could just show the same map using nivo and on click it plays the country and we could add like an info rollover explaining what would be played.

          Monkey added a comment -

          All the plans outlined below seem great IMHO!

          I don't really have much feedback at this point, other than it feels like this should be a separate page in the Explore section.
          This echoes the possibly-confusing aspect Aerozol pointed out: when I click that "Play India" button, it will play a random track from India, but not from my listens from Indian artists.
          For that reason I would keep it separate, and add a link to this new "World Explorer" page from the personal stats.

          That is, until there is a way for us to combine filters in such a way that troi can generate a playlist of my listens from India from my stats.

          Monkey added a comment - All the plans outlined below seem great IMHO! I don't really have much feedback at this point, other than it feels like this should be a separate page in the Explore section. This echoes the possibly-confusing aspect Aerozol pointed out: when I click that "Play India" button, it will play a random track from India, but not from my listens from Indian artists. For that reason I would keep it separate, and add a link to this new "World Explorer" page from the personal stats. That is, until there is a way for us to combine filters in such a way that troi can generate a playlist of my listens from India from my stats.

          holycow23 added a comment - - edited

          While exploring the codebase, I noticed that the current implementation of troi appears to only support a min_recordings parameter. From what I can tell, there doesn’t seem to be a built-in way to enforce a maximum number of recordings per country—for example, limiting it to 1 song per country. I might be missing something, so if there is a way to configure this with the existing structure, please feel free to correct me.

          holycow23 added a comment - - edited While exploring the codebase, I noticed that the current implementation of troi appears to only support a min_recordings parameter. From what I can tell, there doesn’t seem to be a built-in way to enforce a maximum number of recordings per country—for example, limiting it to 1 song per country . I might be missing something, so if there is a way to configure this with the existing structure, please feel free to correct me.

          Aerozol added a comment - - edited

          One song per country: https://musicbrainz.org/statistics/countries
          Only skipping those with 0 artists (5 countries currently), so a playlist with 253 artists/countries and 253 songs. 252 if we take out artists set to [worldwide].

          P.S. This may expose some issues and weaknesses in MB's artist-country data - especially for countries with very few artists - but it is likely to lead to users fixing or improving the data so I am okay with that.

          Edit: I wasn't aware of max_recordings! That seems to do what we want?

          Aerozol added a comment - - edited One song per country: https://musicbrainz.org/statistics/countries Only skipping those with 0 artists (5 countries currently), so a playlist with 253 artists/countries and 253 songs. 252 if we take out artists set to [worldwide] . P.S. This may expose some issues and weaknesses in MB's artist-country data - especially for countries with very few artists - but it is likely to lead to users fixing or improving the data so I am okay with that. Edit: I wasn't aware of max_recordings! That seems to do what we want?

          Aerozol added a comment -

          Hmm okay, 1 song per country would be much nicer. But FYI I would rather have a mix of 50 from each than nothing!

          We should still wait on Monkey's feedback before proceeding, as well.

          Perhaps in the long term we could request a function be added to the radio, like count:option, to allow for more granular control over the number of tracks, not just weight:option. Are you still keen to play with new radio stuff rob?

          Aerozol added a comment - Hmm okay, 1 song per country would be much nicer. But FYI I would rather have a mix of 50 from each than nothing! We should still wait on Monkey's feedback before proceeding, as well. Perhaps in the long term we could request a function be added to the radio, like count:option , to allow for more granular control over the number of tracks, not just weight:option. Are you still keen to play with new radio stuff rob ?

          holycow23 added a comment - - edited

          If I use Radio to generate a playlist, it will generate 50 tracks per country thus the more time, to generate just 1 song per country will have to ignore the idea of Radio and write a new script.

          holycow23 added a comment - - edited If I use Radio to generate a playlist, it will generate 50 tracks per country thus the more time, to generate just 1 song per country will have to ignore the idea of Radio and write a new script.

          Aerozol added a comment - - edited

          Hah, understood! Why is it more time consuming to generate 1 song per country? Do you mean that the code will take longer to write? Or that the backend would take longer to generate it each time?

          Aerozol added a comment - - edited Hah, understood! Why is it more time consuming to generate 1 song per country? Do you mean that the code will take longer to write? Or that the backend would take longer to generate it each time?

          holycow23 added a comment - - edited

          What I meant to say was that for each country, 50 songs are generated so if we plan to generate for all countries it will be (Number of countries x 50)

          Thus, generating the playlist will take quite long, I could take the first per country out of the 50 generated but still the compute time will remain the same.

          holycow23 added a comment - - edited What I meant to say was that for each country, 50 songs are generated so if we plan to generate for all countries it will be (Number of countries x 50) Thus, generating the playlist will take quite long, I could take the first per country out of the 50 generated but still the compute time will remain the same.

          Aerozol added a comment - - edited

          Just picking 50 countries seems ok, if we have to. I assume that you mean that it takes the backend a long time to generate a longer playlist?

          It will make our UX a bit more confusing, as we will have to explain to users that it won't really be a global playlist (or we will get bug reports - our users are very attentive!)

          Is it currently picking 50 random countries?

          Aerozol added a comment - - edited Just picking 50 countries seems ok, if we have to. I assume that you mean that it takes the backend a long time to generate a longer playlist? It will make our UX a bit more confusing, as we will have to explain to users that it won't really be a global playlist (or we will get bug reports - our users are very attentive!) Is it currently picking 50 random countries?

          holycow23 added a comment -
          1. I have made the changes to show "Play India"
          2. For the stretch goal right now Radio supports 50 songs at once, I could take one song but it will be very time consuming to generate a playlist with 1 song of each country.
          3. For the super achiever I think it could be a different ticket since it will involve the usage of BrainzPlayer as well.

          holycow23 added a comment - I have made the changes to show "Play India" For the stretch goal right now Radio supports 50 songs at once, I could take one song but it will be very time consuming to generate a playlist with 1 song of each country. For the super achiever I think it could be a different ticket since it will involve the usage of BrainzPlayer as well.

          Aerozol added a comment - - edited

          Thanks for picking this up! This is another one where mr_monkey should have a look before you submit PR's.

          The button should not say "Play all" (which implies that it will be playing the artists the user has already listened to/are in the list above), it should say something like "Play India", and play any artist/s from that country (imo).

          For the stretch goal:

          The text should say something like:
          "Plays a single random track from every country on the map."
          "Listen to a playlist with random tracks from every country in the world".
          Depending on if you can get the radio prompt/playlist generator to just add a single song from a country - I'm not sure if that's possible.

          Let me know if you want mockups for the super overachiever stretch goal! But I imagine that will be way more complicated than the rest.

          Aerozol added a comment - - edited Thanks for picking this up! This is another one where mr_monkey should have a look before you submit PR's. The button should not say "Play all" (which implies that it will be playing the artists the user has already listened to/are in the list above), it should say something like "Play India", and play any artist/s from that country (imo). For the stretch goal: The text should say something like: "Plays a single random track from every country on the map." "Listen to a playlist with random tracks from every country in the world". Depending on if you can get the radio prompt/playlist generator to just add a single song from a country - I'm not sure if that's possible. Let me know if you want mockups for the super overachiever stretch goal! But I imagine that will be way more complicated than the rest.

          holycow23 added a comment - - edited

          The "Play all" button plays the playlist generated in LB-Radio, and has also been modified to cater to countries with 0 artists.

          Any suggestions/feedback, and could you please explain the stretch goal a little in detail.

          holycow23 added a comment - - edited The "Play all" button plays the playlist generated in LB-Radio, and has also been modified to cater to countries with 0 artists. Any suggestions/feedback, and could you please explain the stretch goal a little in detail.

            holycow23 holycow23
            aerozol Aerozol
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Version Package