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

Get help for different MediaMonkey v5 / v2024 Addons.

Moderatori: jiri, drakinite, Addon Administrators

fishnet37222
Messaggi: 47
Iscritto il: mar mar 23, 2010 9:11 pm

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

Messaggio da 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
Messaggi: 923
Iscritto il: mar ago 18, 2009 2:56 pm

Re: Specify fixed case words for Case Checker addon

Messaggio da 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

Codice: Seleziona tutto

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

Codice: Seleziona tutto

var forceCapString = "SuidAkra|AC|EBN|OZN|...
I recommend to backup original file, so you can restore it, if something bad happens.
Lowlander
Messaggi: 59385
Iscritto il: sab set 06, 2003 5:53 pm

Re: Specify fixed case words for Case Checker addon

Messaggio da 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
Messaggi: 988
Iscritto il: mar mag 12, 2020 10:06 am

Re: Specify fixed case words for Case Checker addon

Messaggio da 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
Immagine
Data scientist, 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
Messaggi: 5
Iscritto il: dom nov 21, 2021 6:03 pm

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

Messaggio da 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):

Codice: Seleziona tutto

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
Messaggi: 988
Iscritto il: mar mag 12, 2020 10:06 am

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

Messaggio da 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.
Immagine
Data scientist, 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
Messaggi: 5
Iscritto il: dom nov 21, 2021 6:03 pm

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

Messaggio da vocikag991 »

drakinite ha scritto: dom 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:

Codice: Seleziona tutto

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:

Codice: Seleziona tutto

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
Messaggi: 59385
Iscritto il: sab set 06, 2003 5:53 pm

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

Messaggio da 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
Messaggi: 5
Iscritto il: dom nov 21, 2021 6:03 pm

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

Messaggio da vocikag991 »

Lowlander ha scritto: lun 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
Messaggi: 988
Iscritto il: mar mag 12, 2020 10:06 am

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

Messaggio da drakinite »

vocikag991 ha scritto: lun 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
Immagine
Data scientist, 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
Messaggi: 5
Iscritto il: dom nov 21, 2021 6:03 pm

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

Messaggio da vocikag991 »

drakinite ha scritto: lun nov 22, 2021 10:07 pm
vocikag991 ha scritto: lun 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
Messaggi: 988
Iscritto il: mar mag 12, 2020 10:06 am

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

Messaggio da 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.
Immagine
Data scientist, 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
Messaggi: 5
Iscritto il: dom nov 21, 2021 6:03 pm

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

Messaggio da vocikag991 »

drakinite ha scritto: dom 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
Messaggi: 988
Iscritto il: mar mag 12, 2020 10:06 am

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

Messaggio da drakinite »

vocikag991 ha scritto: mar 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.
Immagine
Data scientist, 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.
Rispondi