simon-weber/Autoplaylists-for-Google-Music

"playlist title" condition don't combine correctly

simon-weber opened this issue · 2 comments

An autoplaylist with a condition like "playlist title contains ..." works fine on its own. However, adding a second "playlist title does not contain ..." to exclude some playlists does not work: the autoplaylist will instead return the songs in the excluded playlist.

This seems to apply to combining "playlist equals" conditions as well.

The queries I'm forming look fine. I'm worried this may end up being a bug in lovefield like #109. . .

Nope, I'm a dingus: this is a problem on my end.

The matches condition currently works like this:

  • first, find all playlists with titles matching the input (or not matching, for "not" conditions)
  • then, get all the track ids from the matching playlists
  • finally, either include (or exclude, for "not" conditions) all of those tracks to fulfill the condition

The way step 1 and 3 combine turns out to not work as expected. As an example, imagine a library with three playlists:

  • Chris A: has track 1
  • Chris B: has track 2
  • Christmas music: has track 3

Here's an all query that yields 0 tracks:

  • playlist title contains 'Chris': Chris A and Chris B contain Chris, so include track 1 and 2
  • playlist title does not contain 'Christmas': Chris A and Chris B do not contain Christmas, so exclude track 1 and 2

I think just removing the inversion on the initial match fixes this, but I'll have to come back to it with a clear head before settling on it (since it is technically a breaking change for anyone currently using this condition).