Bug 140542 - smart playlists matching multiple labels do not work
Summary: smart playlists matching multiple labels do not work
Status: RESOLVED INTENTIONAL
Alias: None
Product: amarok
Classification: Applications
Component: Playlist (show other bugs)
Version: 1.4-SVN
Platform: Ubuntu Linux
: HI normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 145925 147298 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-24 11:41 UTC by Danni Coy
Modified: 2008-12-07 14:37 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Danni Coy 2007-01-24 11:41:48 UTC
Version:           1.4.5svn (using KDE KDE 3.5.5)
Installed from:    Ubuntu Packages
Compiler:          gcc 4.1 
OS:                Linux

Try the following 
Create a new smart playlist...
Tick the "Match All of the Following Conditions Box"
add a condition such as Label contains "jazz" (assuming you have tracks tagged jazz in your collection
add another condition such as Label contains "slow" (assuming that you have tracks in your collection which are tagged both "jazz" and "slow")
Thats it...
Now try loading the playlist... 
In my case nothing loads even though I know that the label for some tracks contains both "jazz" and "slow" as labels.
Comment 1 Peter C. Ndikuwera 2007-01-24 12:26:17 UTC
Yeah. I can confirm this. The database query that processes smart playlists can't actually handle multiply-labelled tracks...
Comment 2 Augie DeHainaut 2007-02-05 06:14:07 UTC
I can also confirm this.
Comment 3 marc 2007-02-05 21:39:25 UTC
Just tried the final 1.4.5 and stumbled on this bug.

Does this bug only exist with SQLite? So a workaround would be to use MySQL, if it's not easy to fix.

I think this bug should be fixed soon, as it makes using labels rather useless.
Comment 4 Augie DeHainaut 2007-02-06 02:18:57 UTC
This bug also applies to the collection filter.

I've looked at the amarok database layout, and I don't see any simple solutions.  However, keep in mind that I have very limited sql skills, and I have only looked at the database, not how amarok actually interacts with it.  In fact, maybe everyone should just ignore this whole paragraph.
Comment 5 marc 2007-02-06 09:07:03 UTC
Just a side note: is it possible to correct the title of this bug? It should be "label" instead of "lable"
Normally I won't care about typos that much, but here I think it's important so one can find this bug easier.
Comment 6 Martin Aumueller 2007-02-06 10:36:21 UTC
#5: Yes.
Comment 7 Chad Bentfield 2007-02-07 00:27:32 UTC
I can confirm that this issue applies to a MySQL setup also.

just to add my 2 cents on the importance of this bug...
The "label" feature was the reason that I decided for the first time ever to go through the work of compiling source code in order to use/upgrade a program!  I was really excited to get this feature.  So, it is really disappointing that this does not work.  I would agree that this bug makes this new feature pretty much useless for me.
Comment 8 David Berg 2007-03-05 15:05:35 UTC
Oh how excited I was when I found this feature last night after recently switching from Rhythmbox (Amarok is so much more flexible).  Now this morning I find this bug and discover it doesn't work.  

For what it's worth, the same functionality can be had by using the comment field, and it works properly.  Though some of the nice interface features, like seeing the list of existing labels to choose from.  This has the added benefit of being able to edit the labels inline.  

If the problem is as difficult to solve as its made out, perhaps it could be reduced to another text field, like comment, until a more elegant solution can be had.
Comment 9 Max Cantor 2007-03-17 05:01:17 UTC
Confirmed for both MySQL and sqlite on Ubuntu Edgy.  I hope it's fixed soon... maybe I'll finally try to patch an open source app and fix this myself!
Comment 10 Isaiah Damron 2007-05-03 05:35:32 UTC
In order to solve this bug cleanly, it'll require a reworking of how QueryBuilder works.  Specifically, QueryBuilder will need to be able to support joining on a single table multiple times, i.e. "SELECT * FROM tags LEFT JOIN labels AS labels_1 ON labels_1.[...] = tags.[...] LEFT JOIN labels AS labels_2 ON labels_2.[...] = tags.[...]".

This is functionality that will need to be added to QueryBuilder at some point no matter what, but it's something one of the higher ups should decide on how to implement it.

I'm gonna say this'll definitely be fixed, but it'll probably be a while.
Comment 11 Maximilian Kossick 2007-09-03 13:23:12 UTC
*** Bug 145925 has been marked as a duplicate of this bug. ***
Comment 12 07 2007-09-23 17:31:51 UTC
To solve the SQL part is really easy. 
This SQL-Statement is one of many possible solutions:
 
  "select distinct t.* from tags as t        /* or what is needed to return */
       inner join tags_labels as tl          /* relations from tag to label */
            on t.url = tl.url and t.deviceid = tl.deviceid
       inner join labels as l                /* convert labelname to labelid */
            on tl.labelid = l.id
  where l.name in ('jazz','soft','any else..')"   

Can be quite simpler if Amarok already knows the labelid's

Comment 13 Seb Ruiz 2007-09-26 05:40:12 UTC
*** Bug 147298 has been marked as a duplicate of this bug. ***
Comment 14 Eric Vaandering 2007-09-26 05:52:02 UTC
Bug 147298 describes something a little different and in fact I verified that it works differently on SQLite and MySQL. Maybe rewriting the query builder will fix both bugs, though
Comment 15 Joey Richards 2007-10-31 00:24:49 UTC
I'm especially keen to see a solution to the total uselessness of label "does not contain" as described in Bug 145925.  It's still a problem for Ubuntu's Amarok 1.4.7.
Comment 16 Seb Ruiz 2007-10-31 01:00:10 UTC
Unfortunately this problem is not easy to solve. The sql code is easily fixed, but getting that into the logic which parses the smart playlists is just about impossible. Obviously there were a few shortcomings in the design of this code, but hopefully the rewrite for Amarok 2 will solve these problems.
Comment 17 Joey Richards 2007-11-04 02:38:21 UTC
I'd suggest removing the option for 'label does not contain X' until it's fixed.  As it is, I don't see how it's possibly useful.  Having such a severe bug in software is sort of amateurish.  I don't mean to insult the amarok developers -- it's a fantastic piece of software and I appreciate the efforts of everyone who's worked on it.  However, this function is completely broken and, IMO, software features should at least mostly work or be left out.
Comment 18 Lydia Pintscher 2008-03-15 13:01:00 UTC
As Seb said we can not fix this in Amarok 1.4.x.
Closing as wontfix therefore.
Please check this again in Amarok 2 once it is released and open another bugreport if needed.

Thank you for your report.
Comment 19 Manuel Amador (Rudd-O) 2008-09-29 05:11:37 UTC
Can anyone explain to me how hard is it do do a stupid LEFT JOIN or perhaps adding a "or label NULL" to the query when doing label-based queries?
Comment 20 Seb Ruiz 2008-09-29 05:21:01 UTC
@Rudd-O

Our queries are automatically built and were not designed well enough to handle these cases. Trust me, I have looked into this problem many times and it is not a trivial solution. 

Amarok 2 totally resovles this issue.
Comment 21 Felix Dietze 2008-12-07 14:37:48 UTC
I don't know how QueryBuilder exactly works, but with a query like this:
SELECT url,labels FROM
(
SELECT url, group_concat(labels.name) as labels
FROM tags_labels
LEFT OUTER JOIN labels WHERE tags_labels.labelid = labels.id
GROUP BY url
)
WHERE labels LIKE '%mainstream%'
AND labels LIKE '%dance%'

The subquery will always be the same and can passed as a constant for a tablename. So the query just looks like the form:

SELECT url,labels FROM table
WHERE labels LIKE '%mainstream%'
AND labels LIKE '%dance%'

Is QueryBuilder able to handle this?