#musicbrainz-devel

/

      • mat_ joined the channel
      • 2014-03-21 08022, 2014

      • mat_ joined the channel
      • 2014-03-21 08056, 2014

      • UmkaDK joined the channel
      • 2014-03-21 08032, 2014

      • Nyanko-sensei joined the channel
      • 2014-03-21 08034, 2014

      • night199uk joined the channel
      • 2014-03-21 08014, 2014

      • JesseW joined the channel
      • 2014-03-21 08012, 2014

      • JesseW joined the channel
      • 2014-03-21 08009, 2014

      • reosarevok
        alastairp, he's traveling and said he wouldn't be online much this week
      • 2014-03-21 08048, 2014

      • kepstin_ joined the channel
      • 2014-03-21 08054, 2014

      • kepstin-laptop joined the channel
      • 2014-03-21 08006, 2014

      • JesseW joined the channel
      • 2014-03-21 08000, 2014

      • JesseW joined the channel
      • 2014-03-21 08041, 2014

      • rvedotrc joined the channel
      • 2014-03-21 08007, 2014

      • dufferzafar joined the channel
      • 2014-03-21 08030, 2014

      • ohrstrom joined the channel
      • 2014-03-21 08003, 2014

      • JonnyJD joined the channel
      • 2014-03-21 08035, 2014

      • rvedotrc joined the channel
      • 2014-03-21 08026, 2014

      • rvedotrc1 joined the channel
      • 2014-03-21 08006, 2014

      • ohrstrom joined the channel
      • 2014-03-21 08005, 2014

      • travis-ci has left the channel
      • 2014-03-21 08014, 2014

      • UmkaDK joined the channel
      • 2014-03-21 08009, 2014

      • travis-ci has left the channel
      • 2014-03-21 08025, 2014

      • Jormangeud joined the channel
      • 2014-03-21 08015, 2014

      • reosarevok joined the channel
      • 2014-03-21 08054, 2014

      • zhengyangl joined the channel
      • 2014-03-21 08020, 2014

      • xram joined the channel
      • 2014-03-21 08014, 2014

      • xram joined the channel
      • 2014-03-21 08050, 2014

      • Nyanko-sensei joined the channel
      • 2014-03-21 08057, 2014

      • chirlu` joined the channel
      • 2014-03-21 08008, 2014

      • bobcat_ joined the channel
      • 2014-03-21 08006, 2014

      • bobcat_
        hi guys
      • 2014-03-21 08049, 2014

      • bobcat_
        im trying to output artists with urls but cant get the correct join query
      • 2014-03-21 08027, 2014

      • nikki
        what do you have so far?
      • 2014-03-21 08042, 2014

      • rvedotrc joined the channel
      • 2014-03-21 08012, 2014

      • xram
        basically join artist id with entity0 on l_artist_url
      • 2014-03-21 08041, 2014

      • xram
        then url id with entity1 of l_artist_url
      • 2014-03-21 08043, 2014

      • reosarevok
        they're gone :p
      • 2014-03-21 08048, 2014

      • xram
        oops
      • 2014-03-21 08052, 2014

      • reosarevok
        People have surprisingly low patience in IRC
      • 2014-03-21 08055, 2014

      • reosarevok shrugs
      • 2014-03-21 08009, 2014

      • xram
        I think he found how quite quickly anyway
      • 2014-03-21 08009, 2014

      • chirlu`
        Well, they timed out, so it’s not necessarily due to lack of patience.
      • 2014-03-21 08020, 2014

      • chirlu`
        Perhaps they are still patiently waiting for a reply. :-)
      • 2014-03-21 08043, 2014

      • demonimin joined the channel
      • 2014-03-21 08016, 2014

      • rvedotrc joined the channel
      • 2014-03-21 08027, 2014

      • CallerNo6 joined the channel
      • 2014-03-21 08038, 2014

      • dufferzafar joined the channel
      • 2014-03-21 08048, 2014

      • hawke joined the channel
      • 2014-03-21 08048, 2014

      • kepstin-laptop joined the channel
      • 2014-03-21 08034, 2014

      • CatQuest joined the channel
      • 2014-03-21 08041, 2014

      • dufferzafar joined the channel
      • 2014-03-21 08054, 2014

      • dufferzafar joined the channel
      • 2014-03-21 08054, 2014

      • Gentlecat joined the channel
      • 2014-03-21 08043, 2014

      • Gentlecat joined the channel
      • 2014-03-21 08006, 2014

      • hawke joined the channel
      • 2014-03-21 08014, 2014

      • Mineo joined the channel
      • 2014-03-21 08041, 2014

      • esra joined the channel
      • 2014-03-21 08016, 2014

      • zas joined the channel
      • 2014-03-21 08004, 2014

      • zas
        which method is used on mb website to sort collections in the collection's list ?
      • 2014-03-21 08052, 2014

      • kepstin-laptop
        probably database row id :/
      • 2014-03-21 08055, 2014

      • Freso
        zas: Yo. :)
      • 2014-03-21 08003, 2014

      • kepstin-laptop
        (i.e. unsorted)
      • 2014-03-21 08035, 2014

      • Freso
        zas: I thought Sophist was using MB rel. dates for something in that comment earlier. I hadn't caught that it was a filesystem timestamp. :)
      • 2014-03-21 08018, 2014

      • bobcat_ joined the channel
      • 2014-03-21 08043, 2014

      • kepstin-laptop
        hmm, wait, on the website? those might actually be sorted...
      • 2014-03-21 08002, 2014

      • kepstin-laptop
        nope, not sorted :)
      • 2014-03-21 08027, 2014

      • kepstin-laptop
        .. or is it
      • 2014-03-21 08037, 2014

      • kepstin-laptop is confused now
      • 2014-03-21 08042, 2014

      • kepstin-laptop
        time to create a new collection and see!
      • 2014-03-21 08017, 2014

      • kepstin-laptop
        zas: case insensitive sort by collection name :)
      • 2014-03-21 08034, 2014

      • bobcat_
        hi guys. how can i select artists only with official homepages? im having trouble joining artist and url tables :-(
      • 2014-03-21 08035, 2014

      • zas
        they are sorted � < a < A < b < B ... + mbid when name is the same
      • 2014-03-21 08049, 2014

      • zas
        but i need to know where is the code doing it
      • 2014-03-21 08021, 2014

      • ianmcorvidae
        it's probably sorted by musicbrainz_collate(name) coming out of the database
      • 2014-03-21 08026, 2014

      • Freso
      • 2014-03-21 08015, 2014

      • zas
        ianmcorvidae: according to https://github.com/metabrainz/postgresql-musicbra… i shouldn't get the order i wrote ....
      • 2014-03-21 08047, 2014

      • kepstin-laptop
      • 2014-03-21 08056, 2014

      • bobcat_
        yes i got disconnected. wasnt lack of patience ;-)
      • 2014-03-21 08056, 2014

      • ianmcorvidae
        it's consistent winth the 'older versions of ICU' order
      • 2014-03-21 08011, 2014

      • ianmcorvidae
        er well, I don't see what the first character in your ordering is, but
      • 2014-03-21 08037, 2014

      • chirlu`
        It’s a with a grave accent.
      • 2014-03-21 08050, 2014

      • ianmcorvidae
        anyway, yes, most things on the site are ordered by musicbrainz_collate(name), so that's probably the safest assumption
      • 2014-03-21 08056, 2014

      • kepstin-laptop
        " ORDER BY musicbrainz_collate(name), editor_collection.id"
      • 2014-03-21 08026, 2014

      • ianmcorvidae
        https://github.com/metabrainz/musicbrainz-server/… is likely the relevant one, you're quoting the one from the subscriptions bit
      • 2014-03-21 08003, 2014

      • zas
        what is editor_collection.id ? mbid or internal ?
      • 2014-03-21 08014, 2014

      • ianmcorvidae
        internal; gid is what mbids are stored as
      • 2014-03-21 08031, 2014

      • kepstin-laptop
        huh, and L154 has the public list, which sorts only by musicbrainz_collate(name) and not id
      • 2014-03-21 08057, 2014

      • kepstin-laptop
        I wonder why the subscribed one has also the sort by id
      • 2014-03-21 08005, 2014

      • zas
        hmmm, so we can't ensure the same order in Picard, this id isn't returned by webservice
      • 2014-03-21 08039, 2014

      • kepstin-laptop
        zas: I was mistaken, the id is only used in a fairly obscure place. the main collections list only uses the name
      • 2014-03-21 08044, 2014

      • ianmcorvidae
        as mentioned, it's not actually sorted by that where you're likely to care, the line kepstin quoted was for subscriptions
      • 2014-03-21 08055, 2014

      • zas
        ah ok
      • 2014-03-21 08021, 2014

      • zas
        so when two collections have same name, they are randomly sorted
      • 2014-03-21 08021, 2014

      • ianmcorvidae
        now, when the names are the same it's just sorted by whatever order it comes out of the DB, so that bit you won't be able to replicate
      • 2014-03-21 08039, 2014

      • kepstin-laptop
        presumably the webservice will return them in the order they came out of the db
      • 2014-03-21 08041, 2014

      • ianmcorvidae
        but then, naming two collections the same makes them nearly useless anyway :P
      • 2014-03-21 08047, 2014

      • kepstin-laptop
        so if you use a stable sort, it should be ok
      • 2014-03-21 08038, 2014

      • nikki
        we could just make it so people can't do stupid things like that :P
      • 2014-03-21 08055, 2014

      • ianmcorvidae
        we could let them suffer with their own mistake if they do, is more what I was suggesting :P
      • 2014-03-21 08016, 2014

      • Freso goes to rename all his collections "cllection"
      • 2014-03-21 08023, 2014

      • zas
        :)
      • 2014-03-21 08008, 2014

      • kepstin-laptop is annoyed that he can't get xpaths to work in firefox :/
      • 2014-03-21 08030, 2014

      • zas
        well, if two or more collections can have the same name, we have to handle it ;) the best thing to do is to not allow it from start, stupidity solved ;)
      • 2014-03-21 08009, 2014

      • ianmcorvidae proposes order by musicbrainz_collate(name), random() then :P
      • 2014-03-21 08034, 2014

      • kepstin-laptop
        to be specific, that I can't get xpaths to work on the xml returned from an xmlhttpresponse
      • 2014-03-21 08036, 2014

      • kepstin-laptop
        hmm.
      • 2014-03-21 08056, 2014

      • zas
        order by random() is even better if you ask me, CHAOS !
      • 2014-03-21 08025, 2014

      • zas
        musicbrainz_collate() in python is ... ?
      • 2014-03-21 08043, 2014

      • ianmcorvidae
        unsure, there's probably an ICU library you could replicate it with
      • 2014-03-21 08005, 2014

      • zas
        yes, that's what i fear... dependency in sight
      • 2014-03-21 08009, 2014

      • kepstin-laptop
        zas: that'll be a lot of fun ;) that function's written in C or C++, installed as a postgres plugin, and uses ICU to make collation strings with various options set
      • 2014-03-21 08029, 2014

      • kepstin-laptop
        zas: if you can get a reasonable case-insensitive unicode sort, that's probably good enough.
      • 2014-03-21 08033, 2014

      • zas
        well, it's nikki's fault ... PICARD-561
      • 2014-03-21 08034, 2014

      • mb-chat-logger
      • 2014-03-21 08014, 2014

      • kepstin-laptop
        hmm. looks like it's just ICU's default collation key mode with only the numeric collation option added
      • 2014-03-21 08036, 2014

      • kepstin-laptop
        (so e.g. "collection 10" sorts after "collection 2")
      • 2014-03-21 08033, 2014

      • kepstin-laptop
        and ICU is just an implementation of the standard unicode collation algorithm
      • 2014-03-21 08042, 2014

      • zas
        yes, but it will need an extra module for python imho, not sure it is worth
      • 2014-03-21 08058, 2014

      • kepstin-laptop
        you want to get a proper unicode collation algorithm in there to deal reasonably with mixed scripts and stuff :/
      • 2014-03-21 08027, 2014

      • zas
        http://stackoverflow.com/a/3413436 -> pyICU looks the way to go
      • 2014-03-21 08054, 2014

      • kepstin-laptop is annoyed that the glibc C library's collation functions for the english unicode locales handle japanese really, really poorly
      • 2014-03-21 08058, 2014

      • zas
        but just to sort collection menu it looks a bit overkill
      • 2014-03-21 08004, 2014

      • kepstin-laptop
        i.e. worse than sorting by unicode codepoint :/
      • 2014-03-21 08032, 2014

      • kepstin-laptop
        I'm sure we could find some other places to use ICU once we have it :)
      • 2014-03-21 08045, 2014

      • zas
        yes prolly
      • 2014-03-21 08049, 2014

      • kepstin-laptop notes that getting PyICU isn't really an issue on linux, most folks already have ICU and PyICU is easy to install - it's only an issue with the bundled installers for windows/os x :/
      • 2014-03-21 08017, 2014

      • ianmcorvidae
        it seems to be fairly rare that things are an issue on linux, so that's not exactly unpredictable :P
      • 2014-03-21 08024, 2014

      • zas
        ;)
      • 2014-03-21 08000, 2014

      • bobcat_
        Hmm. Im still struggling. I want to add the external links to what I have so far: select artist.name,area.name from artist join area on (artist.area=area.id) where artist.name ~ 'Orchestra';
      • 2014-03-21 08025, 2014

      • chirlu`
        bobcat_: Links for the artist or the area?
      • 2014-03-21 08046, 2014

      • bobcat_
        chirlu`: for the artist
      • 2014-03-21 08007, 2014

      • bobcat_
        chirlu`: official homepage, twitter etc
      • 2014-03-21 08007, 2014

      • chirlu`
        Then you need to join the "url" table via "l_artist_url".
      • 2014-03-21 08038, 2014

      • bobcat_
        chirlu`: this is my first day with psql
      • 2014-03-21 08009, 2014

      • chirlu`
        … JOIN l_artist_url ON artist.id = l_artist_url.entity0 JOIN url ON l_artist_url.entity1 = url.id
      • 2014-03-21 08013, 2014

      • chirlu`
        or something like that.
      • 2014-03-21 08026, 2014

      • chirlu`
        (untested)
      • 2014-03-21 08057, 2014

      • kepstin-laptop notes that the unicode collation algorithm itself isn't that big, it has a few tricky spots, but not that bad. But it does require a fairly large number of tables, including locale specific ones
      • 2014-03-21 08016, 2014

      • bobcat_
        chirlu`: Thank you!
      • 2014-03-21 08014, 2014

      • chirlu`
        bobcat_: Oh, BTW, this will only return results that have at least one URL (and an area, for that matter).
      • 2014-03-21 08013, 2014

      • chirlu`
        If that’s not what you want, you will need to look into outer joins (LEFT JOIN etc.).
      • 2014-03-21 08036, 2014

      • bobcat_
        chirlu`: This almost works: select artist.name,area.name,url from artist join area on (artist.area=area.id) join l_artist_url on (artist.id=l_artist_url.entity0) join url on (l_artist_url.entity1=url.id) where artist.name ~ 'Orchestra';
      • 2014-03-21 08052, 2014

      • bobcat_
        chirlu`: but im getting each artist,name,area.name,url in a separate line when there are multiple urls
      • 2014-03-21 08037, 2014

      • chirlu`
        Yes, that’s how it usually works in SQL. :-)
      • 2014-03-21 08006, 2014

      • reosarevok joined the channel
      • 2014-03-21 08000, 2014

      • chirlu`
        bobcat_: Aggregate functions may help you: http://www.postgresql.org/docs/9.3/static/functio…
      • 2014-03-21 08006, 2014

      • bobcat_
        yikes
      • 2014-03-21 08048, 2014

      • Freso
        bobcat_: Btw, there will possibly soon be an artist type "orchestra".
      • 2014-03-21 08016, 2014

      • bobcat_
        :D
      • 2014-03-21 08036, 2014

      • chirlu`
        But to make use of it, you might need to join another table. ;-)