#musicbrainz-devel

/

      • mat_ joined the channel
      • mat_ joined the channel
      • UmkaDK joined the channel
      • Nyanko-sensei joined the channel
      • night199uk joined the channel
      • JesseW joined the channel
      • JesseW joined the channel
      • reosarevok
        alastairp, he's traveling and said he wouldn't be online much this week
      • kepstin_ joined the channel
      • kepstin-laptop joined the channel
      • JesseW joined the channel
      • JesseW joined the channel
      • rvedotrc joined the channel
      • dufferzafar joined the channel
      • ohrstrom joined the channel
      • JonnyJD joined the channel
      • rvedotrc joined the channel
      • rvedotrc1 joined the channel
      • ohrstrom joined the channel
      • travis-ci has left the channel
      • UmkaDK joined the channel
      • travis-ci has left the channel
      • Jormangeud joined the channel
      • reosarevok joined the channel
      • zhengyangl joined the channel
      • xram joined the channel
      • xram joined the channel
      • Nyanko-sensei joined the channel
      • chirlu` joined the channel
      • bobcat_ joined the channel
      • bobcat_
        hi guys
      • im trying to output artists with urls but cant get the correct join query
      • nikki
        what do you have so far?
      • rvedotrc joined the channel
      • xram
        basically join artist id with entity0 on l_artist_url
      • then url id with entity1 of l_artist_url
      • reosarevok
        they're gone :p
      • xram
        oops
      • reosarevok
        People have surprisingly low patience in IRC
      • reosarevok shrugs
      • xram
        I think he found how quite quickly anyway
      • chirlu`
        Well, they timed out, so it’s not necessarily due to lack of patience.
      • Perhaps they are still patiently waiting for a reply. :-)
      • demonimin joined the channel
      • rvedotrc joined the channel
      • CallerNo6 joined the channel
      • dufferzafar joined the channel
      • hawke joined the channel
      • kepstin-laptop joined the channel
      • CatQuest joined the channel
      • dufferzafar joined the channel
      • dufferzafar joined the channel
      • Gentlecat joined the channel
      • Gentlecat joined the channel
      • hawke joined the channel
      • Mineo joined the channel
      • esra joined the channel
      • zas joined the channel
      • zas
        which method is used on mb website to sort collections in the collection's list ?
      • kepstin-laptop
        probably database row id :/
      • Freso
        zas: Yo. :)
      • kepstin-laptop
        (i.e. unsorted)
      • 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. :)
      • bobcat_ joined the channel
      • kepstin-laptop
        hmm, wait, on the website? those might actually be sorted...
      • nope, not sorted :)
      • .. or is it
      • kepstin-laptop is confused now
      • time to create a new collection and see!
      • zas: case insensitive sort by collection name :)
      • bobcat_
        hi guys. how can i select artists only with official homepages? im having trouble joining artist and url tables :-(
      • zas
        they are sorted � < a < A < b < B ... + mbid when name is the same
      • but i need to know where is the code doing it
      • ianmcorvidae
        it's probably sorted by musicbrainz_collate(name) coming out of the database
      • Freso
      • zas
        ianmcorvidae: according to https://github.com/metabrainz/postgresql-musicb... i shouldn't get the order i wrote ....
      • kepstin-laptop
      • bobcat_
        yes i got disconnected. wasnt lack of patience ;-)
      • ianmcorvidae
        it's consistent winth the 'older versions of ICU' order
      • er well, I don't see what the first character in your ordering is, but
      • chirlu`
        It’s a with a grave accent.
      • ianmcorvidae
        anyway, yes, most things on the site are ordered by musicbrainz_collate(name), so that's probably the safest assumption
      • kepstin-laptop
        " ORDER BY musicbrainz_collate(name), editor_collection.id"
      • ianmcorvidae
        https://github.com/metabrainz/musicbrainz-serve... is likely the relevant one, you're quoting the one from the subscriptions bit
      • zas
        what is editor_collection.id ? mbid or internal ?
      • ianmcorvidae
        internal; gid is what mbids are stored as
      • kepstin-laptop
        huh, and L154 has the public list, which sorts only by musicbrainz_collate(name) and not id
      • I wonder why the subscribed one has also the sort by id
      • zas
        hmmm, so we can't ensure the same order in Picard, this id isn't returned by webservice
      • kepstin-laptop
        zas: I was mistaken, the id is only used in a fairly obscure place. the main collections list only uses the name
      • ianmcorvidae
        as mentioned, it's not actually sorted by that where you're likely to care, the line kepstin quoted was for subscriptions
      • zas
        ah ok
      • so when two collections have same name, they are randomly sorted
      • 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
      • kepstin-laptop
        presumably the webservice will return them in the order they came out of the db
      • ianmcorvidae
        but then, naming two collections the same makes them nearly useless anyway :P
      • kepstin-laptop
        so if you use a stable sort, it should be ok
      • nikki
        we could just make it so people can't do stupid things like that :P
      • ianmcorvidae
        we could let them suffer with their own mistake if they do, is more what I was suggesting :P
      • Freso goes to rename all his collections "cllection"
      • zas
        :)
      • kepstin-laptop is annoyed that he can't get xpaths to work in firefox :/
      • 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 ;)
      • ianmcorvidae proposes order by musicbrainz_collate(name), random() then :P
      • kepstin-laptop
        to be specific, that I can't get xpaths to work on the xml returned from an xmlhttpresponse
      • hmm.
      • zas
        order by random() is even better if you ask me, CHAOS !
      • musicbrainz_collate() in python is ... ?
      • ianmcorvidae
        unsure, there's probably an ICU library you could replicate it with
      • zas
        yes, that's what i fear... dependency in sight
      • 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
      • zas: if you can get a reasonable case-insensitive unicode sort, that's probably good enough.
      • zas
        well, it's nikki's fault ... PICARD-561
      • mb-chat-logger
      • kepstin-laptop
        hmm. looks like it's just ICU's default collation key mode with only the numeric collation option added
      • (so e.g. "collection 10" sorts after "collection 2")
      • and ICU is just an implementation of the standard unicode collation algorithm
      • zas
        yes, but it will need an extra module for python imho, not sure it is worth
      • kepstin-laptop
        you want to get a proper unicode collation algorithm in there to deal reasonably with mixed scripts and stuff :/
      • zas
        http://stackoverflow.com/a/3413436 -> pyICU looks the way to go
      • kepstin-laptop is annoyed that the glibc C library's collation functions for the english unicode locales handle japanese really, really poorly
      • but just to sort collection menu it looks a bit overkill
      • kepstin-laptop
        i.e. worse than sorting by unicode codepoint :/
      • I'm sure we could find some other places to use ICU once we have it :)
      • zas
        yes prolly
      • 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 :/
      • ianmcorvidae
        it seems to be fairly rare that things are an issue on linux, so that's not exactly unpredictable :P
      • zas
        ;)
      • 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';
      • chirlu`
        bobcat_: Links for the artist or the area?
      • bobcat_
        chirlu`: for the artist
      • chirlu`: official homepage, twitter etc
      • chirlu`
        Then you need to join the "url" table via "l_artist_url".
      • bobcat_
        chirlu`: this is my first day with psql
      • chirlu`
        … JOIN l_artist_url ON artist.id = l_artist_url.entity0 JOIN url ON l_artist_url.entity1 = url.id
      • or something like that.
      • (untested)
      • 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
      • bobcat_
        chirlu`: Thank you!
      • chirlu`
        bobcat_: Oh, BTW, this will only return results that have at least one URL (and an area, for that matter).
      • If that’s not what you want, you will need to look into outer joins (LEFT JOIN etc.).
      • 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';
      • chirlu`: but im getting each artist,name,area.name,url in a separate line when there are multiple urls
      • chirlu`
        Yes, that’s how it usually works in SQL. :-)
      • reosarevok joined the channel
      • bobcat_: Aggregate functions may help you: http://www.postgresql.org/docs/9.3/static/funct...
      • bobcat_
        yikes
      • Freso
        bobcat_: Btw, there will possibly soon be an artist type "orchestra".
      • bobcat_
        :D
      • chirlu`
        But to make use of it, you might need to join another table. ;-)