Bug with LIKE?

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Bug with LIKE?

Post by trixmoto » Fri Oct 25, 2013 8:43 am

My "ImportM3U" script works by checking the path of tracks in the library against the paths in an M3U file. For example, this...

Code: Select all

SELECT Songs.ID FROM Songs WHERE Songs.SongPath LIKE '%\10%The%Blues%Brothers%B%Movie%Box%Car%Blues%'
...which should match with the path ":\Music\The Blues Brothers\Briefcase Full Of Blues (1995)\10_The Blues Brothers_'B' Movie Box Car Blues.mp3". This definitely used to work, but for some reason, it no longer is in the latest version (and maybe a few versions now). However, if I run this command...

Code: Select all

SELECT Songs.ID FROM Songs WHERE Songs.SongPath LIKE '%Blues%'
...then it does find this track. It looks like you can only have two "%" characters in a LIKE!? :-?
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

jiri
Posts: 5390
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Bug with LIKE?

Post by jiri » Fri Oct 25, 2013 9:13 am

The currently Like implementation hasn't been changed for quite a long time and yes, it's a little limited. We don't plan to change it atm, but MMW5 (rather early in the development atm) will probably support regular expressions, i.e. will be much more powerful.

Jiri

Mizery_Made
Posts: 2283
Joined: Tue Aug 29, 2006 1:09 pm
Location: Kansas City, Missouri, United States

Re: Bug with LIKE?

Post by Mizery_Made » Fri Oct 25, 2013 4:48 pm

jiri wrote:MMW5 (rather early in the development atm)
:D

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Bug with LIKE?

Post by trixmoto » Sat Oct 26, 2013 1:17 am

But this definitely used to work, this script would never have worked without that, nor would my RecreateM3U, or quite a few of my other scripts!
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Bug with LIKE?

Post by trixmoto » Sat Oct 26, 2013 2:30 am

I'm working around this issue now with syntax like this...

Code: Select all

SELECT Songs.ID FROM Songs WHERE Songs.SongPath LIKE '%10%' AND Songs.SongPath LIKE '%The%' AND Songs.SongPath LIKE '%Blues%' AND Songs.SongPath LIKE '%Brothers%' AND Songs.SongPath LIKE '%B%' AND Songs.SongPath LIKE '%Movie%' AND Songs.SongPath LIKE '%Box%' AND Songs.SongPath LIKE '%Car%' AND Songs.SongPath LIKE '%Blues%'
It seems to work ok, although obviously the logic is a little different now, as the order of the parts is no longer correct.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

ZvezdanD
Posts: 3087
Joined: Thu Jun 08, 2006 7:40 pm

Re: Bug with LIKE?

Post by ZvezdanD » Sat Oct 26, 2013 3:58 am

Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1 / 5.4  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.7 / 4.0  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.3 / 2.2.2  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

Post Reply