Skip to main content
Topic: (Masstagger) functions do not work (Read 574 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

(Masstagger) functions do not work

I just can’t understand how the function of replacing values and deleting



I want to replace the square brackets + and change the capitalization of the first character after the bracket

01. Title [remix] > 01. Title (Remix)

Re: (Masstagger) functions do not work

Reply #1
Just a tip - all changes can be easily done from Properties window without Masstagger.

Get Properties.
Control/right click  on field to edit, e.g. TITLE, and select "Format from Other Fields"
enter title formatting functions as required: https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference
e.g. $replace(%title%,'[r','(R',']',')')

multiple replaces can be included in the same function as shown.

or for example:
make articles lower case:
$replace($caps2(%title%), A , a , An , an , The , the , And , and , But , but , Or , or , Nor , nor , At , at , By , by , For , for , From , from , In , in , Into , into , Of , of , Off , off , On , on , Onto , onto , Out , out , Over , over , To , to , Up , up , With , with , As , as , & , and )

use subscripts for playcount:
$replace($max(%play_count%,%lastfm_play_count%),1,$char(185),2,$char(178),3,$char(179),4,$char(8308),5,$char(8309),6,$char(8310),7,$char(8311),8,$char(8312),9,$char(8313),0,$char(8304))

Re: (Masstagger) functions do not work

Reply #2
That replace value masstagger function is not meant to be used like that. It's meant for replacing multivalue tags. For example field name Performer with value LSO; Karajan; Chorus. Old Value LSO, new value London Symphony Orchestra will change all values of LSO within a multivalue field to London Symphony Orchestra.
If you wanted to use Masstagger for replacing values like you wanted to do you'd use the format value function and use $replace.

However, I'd go with mjm716 suggestion.

Re: (Masstagger) functions do not work

Reply #3

Thanks, my friend, I use similar table replacements in the Total commander compared with mine, in my version there is "Unto"

bad for replacing prepositions at the beginning of the album title "2018 - The Lost Of Sample" >>> "2018 - the Lost of Sample"

Re: (Masstagger) functions do not work

Reply #4


I tried the code, it works - it does not touch the beginning of the line, but it does not replace the second entry ("The")



Re: (Masstagger) functions do not work

Reply #6



Re: (Masstagger) functions do not work

Reply #7


As I mentioned to you before.
Use masstagger Format value with $replace.

Masstagger replace value is meant for multivalue fields as illustrated in the image.


Re: (Masstagger) functions do not work

Reply #8
I tried to replace pieces of text in different fields - nothing changes! WTF
The term "value" means the entire single tag. The %title% value in your test example is "Wrong Direction" - therefore no match on "Wrong".

See the Masstagger documentation for more info.


Re: (Masstagger) functions do not work

Reply #10
In your case no need to use masstager as you can do it with Format from other fields with properties window.

In your example type pattern as shown in image
foobar2000 plays music

Re: (Masstagger) functions do not work

Reply #11
In your case no need to use masstager as you can do it with Format from other fields with properties window.

I tested this solution and it works. The problem is that I set the values of the buttons on my own panel, Masstagger has its menu items in the scripts and I would perform the same replacement of buttons with one click

Re: (Masstagger) functions do not work

Reply #12
By the selection method I have already established that only the word WHOLE is replaced. It is not clear why I replaced the part in " LSO; Karajan; Chorus"???
"LSO; Karajan; Chorus" is 3 separate values, displayed separated by a semicolon and a space. Internally, they are 3 values, "LSO", "Karajan", and "Chorus".

Re: (Masstagger) functions do not work

Reply #13
By the selection method I have already established that only the word WHOLE is replaced. It is not clear why I replaced the part in " LSO; Karajan; Chorus"???
"LSO; Karajan; Chorus" is 3 separate values, displayed separated by a semicolon and a space. Internally, they are 3 values, "LSO", "Karajan", and "Chorus".
look at the screenshot as if everything is in one field, albeit with scattered punctuation marks

Re: (Masstagger) functions do not work

Reply #14
Your screenshots (reply #5 and #6) show you are using Masstagger: 'Replace Value'.

As jazzthieve told you (reply #7) you need to use Masstagger: 'Format Value From Other Fields'.

'Add' button
'Format value from other fields...'
TITLE
$replace(%title%,'[','(',']',')')

Not every Masstagger action supports using title formatting functions, most only accept text. To use a function like $replace(), use the 'Format Value...' action. It works exactly the same as Properties: 'Format From Other Fields' (reply #1 and #10).

If this does not help, perhaps you could restate exactly what you are trying to do.

Cheers :)

Re: (Masstagger) functions do not work

Reply #15
Your screenshots (reply #5 and #6) show you are using Masstagger: 'Replace Value'.

As jazzthieve told you (reply #7) you need to use Masstagger: 'Format Value From Other Fields'.


I'm inattentive !! It works, thanks

There are versions of the solution to the problem of replacement "The" in reply 4

Re: (Masstagger) functions do not work

Reply #16
I'm inattentive !! It works, thanks
I'm glad you got it working! :)

Quote
There are versions of the solution to the problem of replacement "The" in reply 4

So, to recap...

make articles lower case:
$replace($caps2(%title%), A , a , An , an , The , the , And , and , But , but , Or , or , Nor , nor , At , at , By , by , For , for , From , from , In , in , Into , into , Of , of , Off , off , On , on , Onto , onto , Out , out , Over , over , To , to , Up , up , With , with , As , as , & , and )

This is a tricky one. This $replace() function seems to not work correctly when two search patterns overlap. So in the example "Pyres On The Coast", because the first replace is " On ", it does not detect the space before " The " - the same space. (Not sure if this is an unintended bug that can maybe be addressed?)

Removing either of the spaces from the pattern introduces other problems. If you remove all second spaces, it works, but words beginning with " A" get renamed to lower case. If you remove all first spaces, beginnings of tracks get renamed because "The "...

Perhaps someone knows a way to make it catch all (?)

Perhaps remove the $caps2() and make that a separate script -

$caps2(%title%)

Then another script -

$replace(%title%, ... )

Then you can run this one a second time on such files if it does not catch everything.

(I'm not at my foobar computer to test anything so you'll just have to experiment - have fun!)

Cheers :)


Re: (Masstagger) functions do not work

Reply #18
You can achieve that with a single command by wrapping the replace lines.
Code: [Select]
$replace($replace($replace($caps2(%title%), ,  ,'[','('), A , a , An , an , The , the , And , and , But , but , Or , or , Nor , nor , At , at , By , by , For , for , From , from , In , in , Into , into , Of , of , Off , off , On , on , Onto , onto , Out , out , Over , over , To , to , Up , up , With , with , As , as , & , and ),  , )

Re: (Masstagger) functions do not work

Reply #19
You can achieve that with a single command by wrapping the replace lines.
Code: [Select]
$replace($replace($replace($caps2(%title%), ,  ,'[','('), A , a , An , an , The , the , And , and , But , but , Or , or , Nor , nor , At , at , By , by , For , for , From , from , In , in , Into , into , Of , of , Off , off , On , on , Onto , onto , Out , out , Over , over , To , to , Up , up , With , with , As , as , & , and ),  , )


amazing solution it works!

 
SimplePortal 1.0.0 RC1 © 2008-2018