INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Strategy for replacing "\" with ";" for multiple Artists  (Read 2788 times)

Spike1000

  • Citizen of the Universe
  • *****
  • Posts: 641
Strategy for replacing "\" with ";" for multiple Artists
« on: June 25, 2016, 10:07:49 am »

http://yabb.jriver.com/interact/index.php?topic=105660.0

This thread made me think about my library. . . I have a good number of tracks that have multiple artists and the separator used varies tremendously ie "|" "-" "," "\" and maybe an occasional ";"  :) 

The best separator for MC is ";" as it will properly distinguish between the individual artists in searches.

In my library I have a good number of different separators with "\" being the most common. I'd love to do a global search and replace of
" \ " with "; "
"\ " with "; "
"\" with "; "
using 'Find' 'Next' and 'Replace' buttons like you have in typical windows applications. This would allow me to asses each situation before making a change. Now that option is not available in MC as it doesn't work that way.

What would be a good strategy to try and sort out my database? I don't feel comfortable making global changes (I don't want AC \ DC to become AC; DC for example), I don't fancy doing all the edits manually but I don't quite know how best to tackle this little conundrum.

I'm assuming I'm not the first person to want to fix this issue.

Spike

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Strategy for replacing "\" with ";" for multiple Artists
« Reply #1 on: June 25, 2016, 10:30:50 am »

I would build a view that has saved searches for each of your candidate patterns.  Like a search for comma, or for slash.  See the attached screen shot for an example.

So you just click on your saved search and it shows you all of the matching files.  In my example, I also have it filter-able by Artist and Album in their own Panes.  Once you find ones you want to change, you highlight them and open the tagging window.  Then just do a replace expression on the [Artist] field.  For example:

Code: [Select]
=replace([Artist],/,,;)
That would replace a comma with an semi-colon.

You can work your way through your collection with this technique adding patterns as you figure them out, or removing ones that don't match on any files.  Might be a fun view to develop actually.  :)

Brian.

Logged

Spike1000

  • Citizen of the Universe
  • *****
  • Posts: 641
Re: Strategy for replacing "\" with ";" for multiple Artists
« Reply #2 on: June 26, 2016, 04:36:22 am »

Thanks for your help once again Brian.

Took me a while to get my head around the view as I hadn't made a 'search' based view before, was stuck in the 'expression' cul-de-sac (abyss? :) ) for a while but then worked out I needed to use the 'search list' type and everything fell into place. Just a touch of the old MC steep learning curve  :)

Was fun sorting out some tagging mistakes and inconsistencies; it's surprising what you find when you start looking.

Just to help the youngsters playing along at home; I tweaked your replace expression, the slash needed escaping with a second slash

Code: [Select]
=replace([Artist],//,; )
Cheers

Spike

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Strategy for replacing "\" with ";" for multiple Artists
« Reply #3 on: June 26, 2016, 07:20:34 am »

Took me a while to get my head around the view as I hadn't made a 'search' based view before, was stuck in the 'expression' cul-de-sac (abyss? :) ) for a while but then worked out I needed to use the 'search list' type and everything fell into place.

Great to hear you got something working!

Quote
Just to help the youngsters playing along at home; I tweaked your replace expression, the slash needed escaping with a second slash

Code: [Select]
=replace([Artist],//,; )

My expression above replaces a COMMA with a semicolon.  It looks funny because there are two commas stacked together:

([Artist],/,,;)

The slash escapes the comma, making it literal.  Then the next comma is interpreted as a normal expression field separator.  Finally the semi-colon is literal.

Anyway, it sounds like you know how to do what you want, which is awesome.  :)  Good luck on your project.

Brian.

Logged

aviateur

  • World Citizen
  • ***
  • Posts: 159
Re: Strategy for replacing "\" with ";" for multiple Artists
« Reply #4 on: February 26, 2017, 11:18:50 am »

Brian & Spike:

I also want to clean up the multiple separators used within the [Artist] field. How do you state the search criteria for the semi-colon? Answering this one type should make the other separators that Brian has listed fairly straightforward to address.

Spike, as you stated earlier in a similar manner, I have been "spinning my wheels" in the Expression Language cul-de-sac for quite some time. So I thought I asked two experts on the subject how to do this. I have no problem starting the creation of the view by selecting Panes, then Category:Search List but that is far as I get. When I attempt to create a specific search on a specific field like [Artist], I am unable to determine the required syntax. I have tried the standard rule of 'Artist | contains | ;'. That doesn't work. I have tried the CUSTOM field with the following expression: isequal([Artist],/;,8) with the thought that the forward slash escape character would be necessary for the literal interpretation of the semi-colon. That doesn't work. I'm sure the solution is simple. I'm just haven't stumbled upon it  yet.

Thanks,
Lawrence
Logged
Two Cows Walk Into a Bar ...
Pages: [1]   Go Up