Filter Property against a part of the filename

Discussion related to "Everything" 1.5 Alpha.
Post Reply
data
Posts: 25
Joined: Sat Jun 17, 2017 8:17 am

Filter Property against a part of the filename

Post by data »

Hi

I've indexed my MP3 with Properties like Title and Artist.
The filename shows like "dummy - Title.mp3". The title ist the last part of the filename after the last hyphen.

But sometimes the field title contains only a part from the "title" of the file name.

Can i Filter this files? i need some ideas.

best regards
Martin
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Filter Property against a part of the filename

Post by void »

Please try matching the title in the filename with regex:

regex:" - (.*)\.mp3$" addcolumn:regmatch1

This will show a Regular Expression Match 1 column
Values in this column will show the title from the filename.

To find files where the title in the filename doesn't match the title property, include the following in your search:
regex:" - (.*)\.mp3$" addcolumn:regmatch1 title:!=regmatch1:



You can use the multi-file renamer to rename your files with the title property.
The title property can be referenced with $title:
data
Posts: 25
Joined: Sat Jun 17, 2017 8:17 am

Re: Filter Property against a part of the filename

Post by data »

Good idea with NOT Match the column

But the RegEx is not matching after the last hyphen.

Please have a look at the attachment.
It matches the last hyphen of the path (Fullpath).
Even if i change it to
regex:name:"- (.*)\.mp3$" addcolumn:regmatch1
It matches after the first hyphen.

I have tried with lookbehind but with no luck.
Attachments
regex.jpg
regex.jpg (593.37 KiB) Viewed 1152 times
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Filter Property against a part of the filename

Post by NotNull »

That is because the pattern you specified -- "dummy - Title.mp3" -- contains one hyphen and your filenames contain two.
Wrong pattern, wrong matching ...

This should do. It matches whatever comes after the last hyphen (+ space) and before the .mp3 file extension

Code: Select all

regex:"^.* - (.+)\.mp3$
data
Posts: 25
Joined: Sat Jun 17, 2017 8:17 am

Re: Filter Property against a part of the filename

Post by data »

very nice.
I use it with the ending Quotionmarks.


As you pointed out that multiple hyphens can occur, I got the idea to separate all parts of the filename.
So the regex would have to recognize if it starts with a digit, then other parts could follow like Artist and Title. But always separated with the hyphen.
So there is
Artist - Title.mp3
Track(1-3digit) - Title.mp3
Track(1-3digit) - Artist - Title.mp3

But I don't manage to formulate these three matches and put them in their own columns if necessary.

I have a hard time with regex because I don't understand it properly.
Already alone to show in Everything only the file name, so without extension, in an own column, I do not manage. (even without regex)

best regards
Martin
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Filter Property against a part of the filename

Post by NotNull »

data wrote: Sun Jun 25, 2023 8:36 am I use it with the ending Quotionmarks.
Good! That is how it was meant.
data wrote: Sun Jun 25, 2023 8:36 am Already alone to show in Everything only the file name, so without extension, in an own column, I do not manage. (even without regex)
Add column stem: (right-click result list header, select Add Columns, search for stem )

data wrote: Sun Jun 25, 2023 8:36 am Artist - Title.mp3
Track(1-3digit) - Title.mp3
Track(1-3digit) - Artist - Title.mp3
The following could (and should!) be optimized, but it is 30 degrees over here and both my braincells are already boiling, so this has to do for now:

Code: Select all

regex:"^(\d{1,3}) - (.+?) - (.+)\.[^.]+$"   |   regex:"^(\d{1,3}) - ()(.+)\.[^.]*$"   |   regex:"^()([^0-9].+?) - (.+)\.[^.]*$"   addcolumn:regmatch1;regmatch2;regmatch3
match1 = tracknr
match2 = artist
match3 = title

(there is no solution for tracks like "01 - Shine On You Crazy Diamond (Parts I - V).flac" or artists like "Sophie Ellis - Baxter" )



Don't know what your ultimate goal is, but you could also add columns for tracknr, artist and title based on the mp3 tags instead of parsing the filename for that. (Add columns, select Audio in the left pane to see available properties)
Post Reply