Specify fixed case words for Case Checker addon [#18292] [#18575]

Get help for different MediaMonkey 5 Addons.

Moderators: jiri, drakinite, Addon Administrators

fishnet37222
Posts: 47
Joined: Tue Mar 23, 2010 9:11 pm

Specify fixed case words for Case Checker addon [#18292] [#18575]

Post by fishnet37222 »

When I was using MM4, the Case Checker addon allowed me to specify words that needed to be in a fixed case pattern, such as the name of the band SuidAkra. I currently don't see how I can do that with the Case Checker addon for MM5. Is it possible to do so, and if not, would it be possible to add that functionality in?
Dave F.
MiPi
Posts: 867
Joined: Tue Aug 18, 2009 2:56 pm
Location: Czech Republic
Contact:

Re: Specify fixed case words for Case Checker addon

Post by MiPi »

It is not in GUI now (was it? Which version of CaseChecker you use?), but you can open file Scripts\caseChecker\dialogs\dlgCaseChecker.js in some text editor (NotePad is enough) and add "SuidAkra" to forceCapString variable. I.e. now it begins

Code: Select all

var forceCapString = "AC|EBN|OZN|...
and then it will be

Code: Select all

var forceCapString = "SuidAkra|AC|EBN|OZN|...
I recommend to backup original file, so you can restore it, if something bad happens.
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Specify fixed case words for Case Checker addon

Post by Lowlander »

The build in CaseChecker never allowed user customization in the the interface.

Although you can edit the script itself, any customization will be lost with every MediaMonkey update.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Specify fixed case words for Case Checker addon

Post by drakinite »

As it's a relatively simple but useful addition to allow custom capitalization, I've added and tracked it here: https://www.ventismedia.com/mantis/view.php?id=18292
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
vocikag991
Posts: 5
Joined: Sun Nov 21, 2021 6:03 pm

Re: Specify fixed case words for Case Checker addon [#18292]

Post by vocikag991 »

Hi everybody, I have a similar question regarding a specific fixed case for an entire sentence.

In MM4 I tailored the old Case.vbs file to my needs: for example, if I wanted to lowercase all "del" but correctly show the name Lana Del Rey (with an uppercase "Del"), I added "del" to littleWordString and then added the following exception in the Function updateCase(s):

Code: Select all

If Instr(result,"Lana del Rey") Then result=Replace(result,"Lana del Rey", "Lana Del Rey")
This way, only the "Del" inside the singer's name would be uppercase.

Is there a way to do such thing in MM5 dlgCaseChecker.js file as well?
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Specify fixed case words for Case Checker addon [#18292]

Post by drakinite »

I believe you can simply add "Lana Del Ray" to the custom string list in the dialog, and it'll work as expected. Make sure you're using a 5.0.2 beta build for the most recent version of Case Checker.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
vocikag991
Posts: 5
Joined: Sun Nov 21, 2021 6:03 pm

Re: Specify fixed case words for Case Checker addon [#18292]

Post by vocikag991 »

drakinite wrote: Sun Nov 21, 2021 11:03 pm I believe you can simply add "Lana Del Ray" to the custom string list in the dialog, and it'll work as expected. Make sure you're using a 5.0.2 beta build for the most recent version of Case Checker.
I've tried, but that's not the case. I'm using version 5.0.1.2433 but I don't think it's a stable version issue.

In MM4 I have the following script in the Case.vbs file:

Code: Select all

Function updateCase(s)
  Dim currentWord, result, fixed, theChar, lastNonWordChars
  Dim forceIndex
  Dim i
  currentWord = ""
  result = ""
  lastNonWordChars = ""
  
  For i = 1 to Len(s)
    theChar = Mid(s,i,1)
    If alphaNum.test(theChar) Then
      currentWord = currentWord & theChar
    Else
      If currentWord <> "" Then
        fixed = fixUp(currentWord,lastNonWordChars,theChar)
        If Right(fixed,1) = theChar Then 'handle stuff like w/
          fixed = Left(fixed,Len(fixed)-1)
          lastNonWordChars = ""
        Else
          lastNonWordChars = theChar
        End If
        result = result & fixed
        currentWord = ""
      Else
        lastNonWordChars = lastNonWordChars & theChar
      End If
      result = result & theChar
    End If
  Next 'i
  If Len(currentWord) > 0 Then
    result = result & fixUp(currentWord,lastNonWordChars,"")
  End If
  If Instr(result,"Lana del Rey") Then result=Replace(result,"Lana del Rey", "Lana Del Rey")
  If Instr(result,"P!NK") Then result=Replace(result,"P!NK", "P!nk")
  updateCase = result
End Function
As you can see, it manages P!nk as well since even if I write it in the forced caps it still converts to P!NK.

In MM5, the function updateCase(s) block is the following:

Code: Select all

function updateCase(s) {
    var fixed, theChar;
    var forceIndex;
    var currentWord = "";
    var result = "";
    var lastNonWordChars = "";

    for (var i = 0; i < s.length; i++) {
        theChar = s[i];
        if (alphaNum.test(theChar)) {
            currentWord = currentWord + theChar;
        } else {
            if (currentWord !== "") {
                fixed = fixUp(currentWord, lastNonWordChars, theChar);
                if (fixed.slice(-1) === theChar) { // handle stuff like w/
                    fixed = fixed.substring(0, fixed.length - 1);
                    lastNonWordChars = "";
                } else {
                    lastNonWordChars = theChar;
                }
                result = result + fixed;
                currentWord = "";
            } else {
                lastNonWordChars = lastNonWordChars + theChar;
            }
            result = result + theChar;
        }
    };
    if (currentWord.length > 0) {
        result = result + fixUp(currentWord, lastNonWordChars, "");
    }
    return result;
};
I'm pretty sure this should be possible as well, but I don't know the correct syntax to add the exceptions..
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Specify fixed case words for Case Checker addon [#18292]

Post by Lowlander »

In MediaMonkey 5.0.2 you can set it within the tool itself. This is why it was recommended, as 5.0.1 doesn't feature this.
vocikag991
Posts: 5
Joined: Sun Nov 21, 2021 6:03 pm

Re: Specify fixed case words for Case Checker addon [#18292]

Post by vocikag991 »

Lowlander wrote: Mon Nov 22, 2021 12:49 pm In MediaMonkey 5.0.2 you can set it within the tool itself. This is why it was recommended, as 5.0.1 doesn't feature this.
Installed 5.0.2.2519, added both "Lana Del Rey" and "P!nk" to the "Recommended changes to capitalization - Update properties?" dialog box, clicked OK, but unfortunately nothing changed.

I think, the issue is really with the special charachters (eg. spaces, exclamation points, etc..).

Did you manage to succesfully add a custom string that includes a space and/or a special character that works for MM5?
If yes, could you please post the code from dlgCaseChecker.js?
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Specify fixed case words for Case Checker addon [#18292] [#18575]

Post by drakinite »

vocikag991 wrote: Mon Nov 22, 2021 7:25 pm Installed 5.0.2.2519, added both "Lana Del Rey" and "P!nk" to the "Recommended changes to capitalization - Update properties?" dialog box, clicked OK, but unfortunately nothing changed.
Thanks - Looks like that was a bug. To be fixed as: https://www.ventismedia.com/mantis/view.php?id=18575
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
vocikag991
Posts: 5
Joined: Sun Nov 21, 2021 6:03 pm

Re: Specify fixed case words for Case Checker addon [#18292] [#18575]

Post by vocikag991 »

drakinite wrote: Mon Nov 22, 2021 10:07 pm
vocikag991 wrote: Mon Nov 22, 2021 7:25 pm Installed 5.0.2.2519, added both "Lana Del Rey" and "P!nk" to the "Recommended changes to capitalization - Update properties?" dialog box, clicked OK, but unfortunately nothing changed.
Thanks - Looks like that was a bug. To be fixed as: https://www.ventismedia.com/mantis/view.php?id=18575
Thanks! Now it works! Can you please let me know in which file the custom string list is located?
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Specify fixed case words for Case Checker addon [#18292] [#18575]

Post by drakinite »

The custom string list is saved in persistent.json (in your appdata folder). But you don't need to edit it. There's a full customization menu when you click the little gear in the top right.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
vocikag991
Posts: 5
Joined: Sun Nov 21, 2021 6:03 pm

Re: Specify fixed case words for Case Checker addon [#18292] [#18575]

Post by vocikag991 »

drakinite wrote: Sun Nov 28, 2021 9:53 pm The custom string list is saved in persistent.json (in your appdata folder). But you don't need to edit it. There's a full customization menu when you click the little gear in the top right.
Thanks! :D I know there is the customization menu but I just wanted to know which files to save in case I should make a backup.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Specify fixed case words for Case Checker addon [#18292] [#18575]

Post by drakinite »

vocikag991 wrote: Tue Nov 30, 2021 5:34 pm Thanks! :D I know there is the customization menu but I just wanted to know which files to save in case I should make a backup.
I see :) No problem.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Post Reply