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

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Specify fixed case words for Case Checker addon [#18292] [#18575]

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

by drakinite » Wed Dec 01, 2021 4:16 pm

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.

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

by vocikag991 » Tue Nov 30, 2021 5:34 pm

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.

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

by drakinite » 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.

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

by vocikag991 » Sun Nov 28, 2021 7:43 pm

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?

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

by drakinite » 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

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

by vocikag991 » Mon Nov 22, 2021 7:25 pm

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?

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

by Lowlander » 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.

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

by vocikag991 » Mon Nov 22, 2021 12:47 pm

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..

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

by drakinite » 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.

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

by vocikag991 » Sun Nov 21, 2021 6:20 pm

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?

Re: Specify fixed case words for Case Checker addon

by drakinite » Mon Sep 13, 2021 2:21 pm

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

Re: Specify fixed case words for Case Checker addon

by Lowlander » Mon Sep 13, 2021 9:53 am

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.

Re: Specify fixed case words for Case Checker addon

by MiPi » Mon Sep 13, 2021 5:40 am

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.

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

by fishnet37222 » Mon Sep 13, 2021 3:58 am

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?

Top