Smartplaylist plugin

I have been using the smartplaylist plugin to make simple genre playlists. I see in the documentation that multiple queries on the same line are ANDed. However, when I do the same thing in a query for smartplaylist it seems to always OR them. Here is the relevant portion of my config.

 playlists:
    - name: all.m3u
      query: ''
    - name: 50s.m3u
      query: ['original_year:1950..1959', 'recording_year:1950..1959']
    - name: 60s.m3u
      query: ['original_year:1960..1969', 'recording_year:1960..1969']
    - name: 70s.m3u
      query: ['original_year:1970..1979', 'recording_year:1970..1979']
    - name: 80s.m3u
      query: ['original_year:1980..1989', 'recording_year:1980..1989']
    - name: metal.m3u
      query: 'genre:metal'
    - name: pop.m3u
      query: 'genre:pop'
    - name: oldies.m3u
      query: 'recording_year:1950..1989 ^genre:metal'

The last one is the problem. I want to exclude specific genres from my oldies playlist. What is happening is that it is finding ALL songs that are not metal and adding them to the playlist as well as, presumably, the songs from the first query.
I have never heard of an oldies radio station with AC/DC on it unless it is a rock station.

Hmm… my reading of the source code:

Is that queries that are a single string, like this one:

query: 'recording_year:1950..1989 ^genre:metal'

should do you want, i.e., should be joined by “and.”

Any chance you could try debugging this by running the query on the command line?

beet ls recording_year:1950..1989 ^genre:metal

Too true! :laughing:

It was actually a problem with a “custom tag.” I have another plugin that creates a tag named recording_year and I was trying to use that in the query. I can use queries containing that custom field on the command line, but the playlist fails to create until I remove it from the smartplaylist query line. To side-step that issue I have updated the plugin to also overwrite the original_year tag, which is supported.

Thanks for looking into it.

1 Like