getmusicbee.com

Support => Questions => Topic started by: cynflux on February 26, 2018, 11:59:20 PM

Title: multiple search and replace for multiple tracks
Post by: cynflux on February 26, 2018, 11:59:20 PM
Hello,
I am trying to update a tag in multiple tracks, but the update information is dependent on what is initially in the tag before it is changed.

The tag is Initial Key and the entry will vary from 1A (1B, 2A, 2B, and so on) to 12B.

If the original Initial Key tag entry is 1A, then I would like to replace it with "1A / A♭ Minor".
If the original Initial Key tag entry is 1B, then I would like to replace it with "1B / B Major", and so on.

Is there a way to automate this process with Advanced Search and Replace?

Thank you in advance.


Title: Re: multiple search and replace for multiple tracks
Post by: psychoadept on February 27, 2018, 02:55:13 AM
The additional tagging & reporting tools plugin can do this for you.  Just be sure to test on a few files (or duplicates) to make sure you're getting the result you want.
Title: Re: multiple search and replace for multiple tracks
Post by: redwing on February 27, 2018, 09:35:18 AM
I am also looking for such feature. I'll ask boroda74 to support that with the plugin.
Title: Re: multiple search and replace for multiple tracks
Post by: hiccup on February 27, 2018, 09:55:47 AM

The tag is Initial Key and the entry will vary from 1A (1B, 2A, 2B, and so on) to 12B.

If the original Initial Key tag entry is 1A, then I would like to replace it with "1A / A♭ Minor".
If the original Initial Key tag entry is 1B, then I would like to replace it with "1B / B Major", and so on.

Is there a way to automate this process with Advanced Search and Replace?

If you only need to have it displayed like that within MusicBee, it might be easier to use a virtual tag for that.
Then you wouldn't need to re-write tags at all.

e.g.:
$IsNull(<Initial Key>,,$Replace($Replace(<Initial Key>,1A,"A♭ Minor"),1B,"B Major"))


It's not difficult to add the additional required replacements.

Just paste:
$Replace(
right behind the second comma

and paste the values that you want to be replaced just before the second-last parenthesis at the end, using this syntax:
),2A,"E♭ Minor"
(to replace 2A with E♭ Minor)

So the next step after having created:
$IsNull(<Initial Key>,,$Replace($Replace(<Initial Key>,1A,"A♭ Minor"),1B,"B Major"))

would result in:

$IsNull(<Initial Key>,,$Replace($Replace($Replace(<Initial Key>,1A,"A♭ Minor"),1B,"B Major"),2A,"E♭ Minor"))

etc.
Title: Re: multiple search and replace for multiple tracks
Post by: cynflux on March 01, 2018, 03:15:10 AM
Thank you for all the responses.
I am having limited success with Advanced Search and Replace.
It can't tell the difference between 1A and 11A, apparently.
It seems I am getting a major program error every other time I select Advanced Search and Replace option.
I'll post the error when it happens again.
Title: Re: multiple search and replace for multiple tracks
Post by: cynflux on March 01, 2018, 04:13:40 AM
MusicBee v3.1.6590.32668 (Win6.1), 28 Feb 2018 23:12:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'AdvancedSearchAndReplacePlugin'.
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Form.CreateHandle()
   at System.Windows.Forms.Control.get_Handle()
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at MusicBeePlugin.PluginWindowTemplate.display(Boolean modalForm)
   at MusicBeePlugin.Plugin.asrEventHandler(Object sender, EventArgs e)
   at #=zOctyNPMpBP9L_Vg0tXadst$vbvh5.#=zlHThRIc=(Object #=zjHM6LIc=, EventArgs #=zK_CBPjQ=)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Title: Re: multiple search and replace for multiple tracks
Post by: redwing on March 01, 2018, 04:52:13 AM
I am having limited success with Advanced Search and Replace.
It can't tell the difference between 1A and 11A, apparently.

My guess is you didn't use word boundary in your search pattern: https://www.regular-expressions.info/wordboundaries.html

Also post the error on the plugin thread along with what exactly you did at that time.
Title: Re: multiple search and replace for multiple tracks
Post by: hiccup on March 01, 2018, 12:09:31 PM
It seems you are not interested in using a virtual tag for this. And looking at my suggestion, I see that 1A vs. 11A would indeed pose a problem there too.
As an exercise, and perhaps for others stumbling onto this thread, I adjusted and completed the formula. This should work:

Code
$IsNull(<Initial Key>,,$Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace($Replace(<Initial Key>,11,C),12,D),1A,"A♭ Minor"),2A,"E♭ Minor"),3A,"B♭ Minor"),4A,"F Minor"),5A,"C Minor"),6A,"G Minor"),7A,"D Minor"),8A,"A Minor"),9A,"E Minor"),10A,"B Minor"),CA,"F♯ Minor"),DA,"D♭ Minor"),1B,"B Major"),2B,"F♯ Major"),3B,"D♭ Major"),4B,"A♭ Major"),5B,"E♭ Major"),6B,"B♭ Major"),7B,"F Major"),8B,"C Major"),9B,"G Major"),10B,"D Major"),CB,"A Major"),DB,"E Major"))
Title: Re: multiple search and replace for multiple tracks
Post by: cynflux on March 01, 2018, 04:35:53 PM
 :)
Title: Re: multiple search and replace for multiple tracks
Post by: boroda on March 01, 2018, 06:23:11 PM
now its possible with new asr preset (this preset can be used as function as well). enter the following string in 'custom text 1' field:

11\C|12\D|1A\A♭ Minor|2A\E♭ Minor|3A\B♭ Minor|4A\F Minor|5A\C Minor|6A\G Minor|7A\D Minor|8A\A Minor|9A\E Minor|10A\B Minor|CA\F♯ Minor|DA\D♭ Minor|1B\B Major|2B\F♯ Major|3B\D♭ Major|4B\A♭ Major|5B\E♭ Major|6B\B♭ Major|7B\F Major|8B\C Major|9B\G Major|10B\D Major|CB\A Major|DB\E Major
Title: Re: multiple search and replace for multiple tracks
Post by: cynflux on March 01, 2018, 11:54:11 PM
Redwing, you were right. I needed a word boundary in the search pattern.


Boroda74, This is fantastic!
I did not realize you could also do functions.


11\C|12\D

CB\A Major|DB\E Major

Thank you all so much.