• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Groups 0
    D Offline
    1. Strawberry Music Player Forums
    2. dtw_2000

    dtw_2000

    @dtw_2000

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    dtw_2000 Unfollow Follow
    • RE: Add "contains delimited" operator to Smart Playlists

      @jamesjones

      Those are good points.

      Some of those cases are already addressed in the linked patch, while others could definitely use some refinement.

      Empty values: The current implementation splits on |, trims whitespace, and explicitly skips empty values. So Rock||Country behaves the same as Rock|Country, and a completely empty list won't generate a match-everything condition.

      Substring matching: I intentionally kept the behavior consistent with the existing contains operator. For example, searching for Rock would also match Classic Rock, Hard Rock, etc.

      In my own music library, I've worked around that limitation by formatting multi-value Genre tags like this:

      "; Rock ; Country ; Alternative Rock ;"

      That allows me to search for "; Rock ;|; Country ;" and match individual genre values rather than arbitrary substrings. It's admittedly a library-specific convention, but it works well for my purposes.

      Escaping: You're right about %, _, and literal delimiters. Those aren't explicitly handled in the current patch and would be worth addressing.

      Case sensitivity: My intention was to retain the same behavior as Strawberry's existing contains operator. I agree that this should be verified, particularly for non-ASCII characters.

      Operator compatibility: I appended the new operator enum value rather than inserting it among existing values, preserving their original IDs. Compatibility with older Strawberry versions encountering the new operator is worth considering separately.

      Background: This was an AI-assisted proof of concept, and my initial goal was to see whether this relatively simple approach was viable. I borrowed the idea from Rockbox while working on its playlist configuration, where I discovered the @~ operator, which provides similar pipe-delimited matching functionality.

      I've successfully compiled and tested the patch against Strawberry 1.2.31 with my own music collection, but haven't added automated tests or tried it against the current development branch.

      posted in Feature Suggestions
      D
      dtw_2000
    • Add "contains delimited" operator to Smart Playlists

      I've seen a few discussions about improving Smart Playlists to support more flexible AND/OR logic. I've wanted this functionality myself, so I experimented with a relatively simple enhancement that seems to offer much of that flexibility without requiring a redesign of the existing Smart Playlist interface.

      The idea

      Add a new "contains delimited" operator alongside the existing "contains", "equals", etc. operators.

      This would allow multiple pipe-separated values within a single rule, treating those values as an OR condition.

      For example, a Smart Playlist using Match ALL (AND) could contain:

      Genre contains delimited Rock|Country
      Grouping contains delimited Classic|Alternative
      Comment contains delimited Workout|Exercise

      Internally, these rules would generate SQL equivalent to:

      WHERE
      (genre LIKE '%Rock%' OR genre LIKE '%Country%')
      AND
      (grouping LIKE '%Classic%' OR grouping LIKE '%Alternative%')
      AND
      (comment LIKE '%Workout%' OR comment LIKE '%Exercise%')

      Why I think this would be useful

      The primary advantage isn't simply searching for multiple values. It's the ability to create independent OR groups within an overall AND-based Smart Playlist.

      This offers significantly more flexible filtering while preserving the existing rule-building GUI and its global AND/OR selection.

      The implementation also appends a new operator enum value without changing existing values, so previously saved operators retain their original identifiers.

      Implementation and testing

      I'm not an experienced C++ developer, but with AI assistance, I put together a patch against the Strawberry 1.2.31 source code.

      I've successfully:

      Applied the patch to a clean 1.2.31 source checkout.

      Compiled and installed the modified Strawberry application on Linux Mint 22.3.

      Tested the new operator with several combinations of delimited values.

      Verified that the operator behaves as expected in actual Smart Playlists.

      The patch modifies only two source files:

      src/smartplaylists/smartplaylistsearchterm.h

      src/smartplaylists/smartplaylistsearchterm.cpp

      I've linked the patch below in case it's useful as a starting point for an official implementation.

      I recognize that AI-assisted code may need review or refinement before being incorporated upstream, and the patch targets 1.2.31 rather than the current development branch.

      I'm sharing it in the hope that this relatively simple enhancement might be worth considering for Strawberry itself.

      https://files.catbox.moe/4s496i.patch
      

      Thanks for all the work on Strawberry!

      posted in Feature Suggestions
      D
      dtw_2000