Uploaded image for project: 'Other'
  1. Other
  2. OTHER-251

Discourse: Extend Onebox to support MB.org entity pages

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Normal Normal
    • Discourse
    • None

      Discourse supports showing details about an URL that was posted on a separate line. This info is called "onebox" and is developed as a separate Ruby library [1]. I started work in using oneboxes that display details about the core MusicBrainz entities. The implementation is pretty easy, see https://github.com/phw/onebox/commit/1ea7b06a4aff417e6405a7b609c608593e62d59c for the MB artist onebox. The release box is also done, I just need to find the time to do the rest.

      I would like to finish this. Going forward we have two options:

      1. Add the MB oneboxes as a plugin to our Discourse installation using the Discourse plugin API [2]
      2. Push the MB oneboxes upstream and wait for Discourse to ship them.

      I would like to first start with 1., as it allows us to roll-out the oneboxes quickly and do any changes necessary once they are actually used. When we are satisfied with the result we can move forward and try to upstream them.

      [1] https://github.com/discourse/onebox
      [2] https://meta.discourse.org/t/brand-new-plugin-interface/8793

          [OTHER-251] Discourse: Extend Onebox to support MB.org entity pages

          Freso added a comment -

          Has been alive and working well (well, it's been working alright most of the time anyway, but not the plugin's/extension's fault!) for several months now on the forum. Any further issues with it should be filed upstream: https://github.com/phw/discourse-musicbrainz-onebox/issues

          Freso added a comment - Has been alive and working well (well, it's been working alright most of the time anyway, but not the plugin's/extension's fault!) for several months now on the forum. Any further issues with it should be filed upstream: https://github.com/phw/discourse-musicbrainz-onebox/issues

          For the failing requests see also https://community.metabrainz.org/t/rate-limiter-has-changed/14253 and the linked IRC discussion.

          For the Wikimedia issue I will add some debug output.

          Philipp Wolfer added a comment - For the failing requests see also https://community.metabrainz.org/t/rate-limiter-has-changed/14253 and the linked IRC discussion. For the Wikimedia issue I will add some debug output.

          I have fixed that icon loading issue. As discussed on IRC for the other issues it would be helpful to see logs. I just tried it with my local VM: While I have the MB server sometimes failing when generating a onebox it is nowhere near the rate that explains that the onebox creation on community fails most of the time.

          Philipp Wolfer added a comment - I have fixed that icon loading issue. As discussed on IRC for the other issues it would be helpful to see logs. I just tried it with my local VM: While I have the MB server sometimes failing when generating a onebox it is nowhere near the rate that explains that the onebox creation on community fails most of the time.

          Regarding the favicon issue: I just found out I'm doing this the wrong way, https://meta.discourse.org/t/is-it-possible-to-include-background-images-with-a-plugin/36298/3

          Philipp Wolfer added a comment - Regarding the favicon issue: I just found out I'm doing this the wrong way, https://meta.discourse.org/t/is-it-possible-to-include-background-images-with-a-plugin/36298/3

          Philipp Wolfer added a comment - - edited

          Cool. Unfortunately this doesn't work too well at the moment.

          1. More often than not the onebox doesn't show up at all. This might be related to the fact that the MB server currently frequently reports "The MusicBrainz web server is currently busy. Please try again later.". When using the API I have seen this error quite frequently in the last weeks. But in our Discourse installation the onebox creation fails far more often (just had to try 9 times before it succeeded for one URL) then I get this error locally. Not sure whether those server issues are worked on or whether we can do something else to improve this for Discourse. But it is probably worth to look at the Discourse logs to see what the actual reason is or if it maybe is something else. See also [1]

          2. Displaying Wikimedia images seems to be disabled. I added an option to toggle this, but the default is enabled. Did you consciously disable this?

          3. Just as in other oneboxes, e.g. the Wikimedia ones, the MB favicon is supposed to be displayed in front of the title. I have added the image asset inside the plugin on the path /assets/favicons/musicbrainz.png. This works on my local Disourse VM just fine, but fails on the MB community installation. Maybe some asset caching or special treatment is in place?

          [1] The behavior of Discourse in case of errors in the Onebox creation is a bit special. It will always cache the result (for a day by default), even if an exception happened. That means once the generation for one URL fails it will always return an empty box for the same URL. To work around it or for testing one can append a different query string, e.g. "?a", "?aa"

          Philipp Wolfer added a comment - - edited Cool. Unfortunately this doesn't work too well at the moment. 1. More often than not the onebox doesn't show up at all. This might be related to the fact that the MB server currently frequently reports "The MusicBrainz web server is currently busy. Please try again later.". When using the API I have seen this error quite frequently in the last weeks. But in our Discourse installation the onebox creation fails far more often (just had to try 9 times before it succeeded for one URL) then I get this error locally. Not sure whether those server issues are worked on or whether we can do something else to improve this for Discourse. But it is probably worth to look at the Discourse logs to see what the actual reason is or if it maybe is something else. See also [1] 2. Displaying Wikimedia images seems to be disabled. I added an option to toggle this, but the default is enabled. Did you consciously disable this? 3. Just as in other oneboxes, e.g. the Wikimedia ones, the MB favicon is supposed to be displayed in front of the title. I have added the image asset inside the plugin on the path /assets/favicons/musicbrainz.png. This works on my local Disourse VM just fine, but fails on the MB community installation. Maybe some asset caching or special treatment is in place? [1] The behavior of Discourse in case of errors in the Onebox creation is a bit special. It will always cache the result (for a day by default), even if an exception happened. That means once the generation for one URL fails it will always return an empty box for the same URL. To work around it or for testing one can append a different query string, e.g. "?a", "?aa"

          Freso added a comment -

          Zas added this to our Discourse last night, writing changelog topic now.

          Freso added a comment - Zas added this to our Discourse last night, writing changelog topic now.

          I managed to get the code into a proper Discourse plugin. Initial version with basic oneboxes for artists, release groups and releases is available at https://github.com/phw/discourse-musicbrainz-onebox . For release groups and releases the cover art from CAA will be shown if available.

          I have tried to keep the info minimal for now, I'd like to extend it based on feedback.

          I will extend it for the other entity types. It is not really much work, but I probably won't find a lot of time during the next weeks.

          Philipp Wolfer added a comment - I managed to get the code into a proper Discourse plugin. Initial version with basic oneboxes for artists, release groups and releases is available at https://github.com/phw/discourse-musicbrainz-onebox . For release groups and releases the cover art from CAA will be shown if available. I have tried to keep the info minimal for now, I'd like to extend it based on feedback. I will extend it for the other entity types. It is not really much work, but I probably won't find a lot of time during the next weeks.

          Freso added a comment -

          I agree with your suggested approach. Just let us know when you're ready to have an iteration go live on the site and zas'll do it when he gets around to it. Remember to "release early and release often".

          Freso added a comment - I agree with your suggested approach. Just let us know when you're ready to have an iteration go live on the site and zas'll do it when he gets around to it. Remember to "release early and release often".

            outsidecontext Philipp Wolfer
            outsidecontext Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package