Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Query Pattern Syntax: distinguish "OST" from "lost" (Read 2093 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Query Pattern Syntax: distinguish "OST" from "lost"

I'm trying to construct a query pattern for an autoplaylist, that gives me a playlist of all my Soundtracks, which all have "OST" somewhere in the path.

I tried:
Code: [Select]
%path% HAS "OST"

But this will also get any song, that has *ost* somewhere in the path/filename like e.g.: E:/Music/Someband/Love Lost.mp3, or E:/Music/Someband/Postman/*.mp3

So I tried:
Code: [Select]
%path% HAS "OST" AND NOT (%path% HAS "*ost*")

But the "*ost*" doesn't work as intended.


So how do I archieve this distinction?

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #1
Would be easier if the genre/style indicated OST.

Just stating the obvious...

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #2
Would be easier if the genre/style indicated OST.

Just stating the obvious...

You're right. But I'd still like to be able to do it with a path search, because it would be less work for me.


UPDATE:
I was able to remove all the false positivs, that had ost in the filename with:
Code: [Select]
%path% HAS "OST" AND NOT %filename% HAS "ost"


Now, only the ones where ost is in the path are left. So the fundamental problem (as described above) of distinguishing ost from *ost* remains.
Anyone?

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #3
Code: [Select]
"$strstr(%path%, OST)" EQUAL 1

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #4
Code: [Select]
"$strstr(%path%, OST)" EQUAL 1

doesn't work. It won't give me any search results.

I tried chaining yours to the end of mine with AND NOT.
Code: [Select]
%path% HAS "ost" AND NOT %filename% HAS "ost" AND NOT ("$strstr(%path%, OST)" EQUAL 1)


Didn't work. It seemed reasonable though, but I'm not very familiar with functions like $strstr(), so I don't know if it makes sense.

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #5
Could you please provide an example of a path, which should be found?

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #6
Could you please provide an example of a path, which should be found?

"E:\MUSIC\07. SOUNDTRACKS\OST\OST Braveheart\06-REVENGE.mp3" should be included. Something like:
"E:\MUSIC\Braveheart\Braveheart-OST-06-REVENGE.mp3" should also be included.

"J:\MUSIC_J\Pantera\(1994) Pantera - aLIVE and hostile e.p\01 - Domination.mp3" should NOT be included. But it is, because of the "ost" in "hostile".

I need something that specifically searches for occurences of "ost" and discards things like "osteal", "most", "hostile" ...

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #7
Either of these should work as is. No need to tack on anything else to either. I assumed there would be a space before OST in my previous post but I can see you have no standardized naming pattern so removed the space.

Code: [Select]
"$strstr(%path%,OST)" EQUAL 1

"$if($strstr(%path%,OST),1,0)" IS 1

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #8
Either of these should work as is. No need to tack on anything else to either. I assumed there would be a space before OST in my previous post but I can see you have no standardized naming pattern so removed the space.

Code: [Select]
"$strstr(%path%,OST)" EQUAL 1

"$if($strstr(%path%,OST),1,0)" IS 1


The second one works! The first one still doesn't give any results.

Thank you so much. This was a nice lesson in function use for me. And i'll probably need this particular one more often.

Thank you so much!

[/SOLVED]

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #9
The second one works! The first one still doesn't give any results.
The first one should be this: "$strstr(%path%,OST)" GREATER 0

But note: This doesn't work, if the OST in the path is not stored with uppercase letters, e.g. "E:\MUSIC\Braveheart\Braveheart-ost-06-REVENGE.mp3" wouldn't be found.

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #10
But note: This doesn't work, if the OST in the path is not stored with uppercase letters, e.g. "E:\MUSIC\Braveheart\Braveheart-ost-06-REVENGE.mp3" wouldn't be found.

Is there a way to make it case insensitive? (With the help of $stricmp(s1,s2) maybe?)


Query Pattern Syntax: distinguish "OST" from "lost"

Reply #12
But note: This doesn't work, if the OST in the path is not stored with uppercase letters, e.g. "E:\MUSIC\Braveheart\Braveheart-ost-06-REVENGE.mp3" wouldn't be found.

Is there a way to make it case insensitive? (With the help of $stricmp(s1,s2) maybe?)
Not really. You could use %path% HAS OST (using of HAS is case insensitive) but then you have the problem again, that you'll find also any files you wanted to exclude. If you have only a few cases with OST surrounded by special characters you could use: %path% HAS /OST OR %path% HAS -OST- OR ...

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #13
This should work:
Code: [Select]
"$strstr($lower(%path%),ost)" GREATER 0
But it would be the same as %path% HAS OST, which doesn't exclude unwanted results.

 

Query Pattern Syntax: distinguish "OST" from "lost"

Reply #14
But it would be the same as %path% HAS OST, which doesn't exclude unwanted results.

Hmm true. I jumped to his last request without checking the rest of the thread so I couldn't tell what he asked did not make sense in the first place.

Guess that's what I get for skimming through the topic for once.