Replace ampersand with word 'and' or visa-versa

I’m sure there is a simple way to do this, I just cant find it. With folks entering data different ways concerning the & and the word “and”, is there a simple way to change everything to one or the other?
Thanks in advance.

Is this a Picard related question? If yes it should be as simple as using $replace in the scripting section

3 Likes

@chaban Thanks for the reply

Yes, Picard. Kinda new to using Picard. I use the $replace in the File Naming script I am using??

Here is what I am using now:
%albumartist%/%album% ($if(%date%,$left(%date%,4)))/Disc %discnumber% of %totaldiscs%/$num(%tracknumber%,2). %artist% - %title%

That depends on whether you want to make the changes in the file name only, or whether you also want it changed in the tags saved in the files. See the Note in the section on Scripting. If you do the replacement in your file naming script, it will only be applied to the file name generated and not to the tags. To also save the changes to the tags, the replacement must be done in a tagging script.

1 Like

@rdswift Thanks, looks like I am in for some reading and experimenting…not sure what would be the best approach on this. The main purpose of doing this is for scanning into Kodi (my fork of). So it no longer shows pretty much every artist a couple times that have the & or “and” in the artist or group name.

Suppose I might need to test which way scrapes better with the scrapers Kodi uses before I get to far into it.

Before you get too far into it, you might want to check out the article:

KODI v18 is using the MBID so should group the artist together using the MBID no matter what the way they are written in the artist field.

Older versions of KODI I just hit the whole artist folder with MP3TAG.de and reset the artist field to swap “&” and “and”. MP3TAG is handy for batch fixes as you can load up a whole raft of tracks and fix a few thousand tracks in one hit.

How old is that article? Why don’t people date things or at least say which version they are working with? There have been some huge changes in the last few versions of KODI as their music dev has taken things more seriously and integrated to MB much better. I only skimmed the article but the way it is talking about “black sabbath featuring Tony Iommi” at the end is clear this is talking about the older versions of KODI which didn’t fully use the Artist MBID like now.

4 Likes

Still haven’t gotten this one working, I am only trying to use the $replace to replace the word “and” with a “&” in the naming or visa-versa. Any help would be much appreciated.

I have tried things like:
($if(and)$replace,&)

$set(artist,$replace(%artist%, and , & )

I did not fully understand the end goal and how this relates to Kodi, but the above script does replace any " and " with " & " in the artist tag. Do the same for any other tag you want to handle, such as maybe albumartist.

@outsidecontext Awesome, thanks I’ll give it a try.

I went the opposite route:

$set(artist,$replace(%artist%, & , and ))
$set(albumartist,$replace(%albumartist%, & , and ))
$set(artistsort,$replace(%artistsort%, & , and ))
$set(albumartistsort,$replace(%albumartistsort%, & , and ))

I have found that ampersands in filenames can be problematic, and for the media player I use (GoneMad) it helps if the file/folder names match the tags.

1 Like

@highstrung . Wow, I was just about to start searching if it would be better to do that, concerning scrapers and all. Thanks for posting that.

1 Like