Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Request: Titleformat $caps3() (Read 2888 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Request: Titleformat $caps3()

I have a feature request concerning titleformat:
$caps() converts to "Proper Case" ("Blah Blah Blah").
A useful thing to expand titleformat would be to convert to "Sentence case" ("Blah blah blah"). Only the first character of the first word in sentence is in upper case.

Re: Request: Titleformat $caps3()

Reply #1
Could use the following, no? Admittedly a dedicated function would be simpler but at least is possible currently.

Code: [Select]
$caps($left(%title%,1))$substr(%title%,2,$len(%title%)) 

or

Code: [Select]
$upper($left(%title%,1))$substr(%title%,2,$len(%title%)) 


 

Re: Request: Titleformat $caps3()

Reply #3
You probably could write a really long script with $strstr() searching for "! ", ". ", "? ", repeat each of them about three times for multiple sentences. Insert a unique 'marker' after the punctuation mark. Capitalize at the position found. Remove the markers at the end. For operations like this, I wish we had functions. But you also lose capitalization of proper nouns.

Maybe $capss() for "sentence" is easier to remember.

Re: Request: Titleformat $caps3()

Reply #4
But you also lose capitalization of proper nouns.

Maybe $capss() for "sentence" is easier to remember.

For symmetry with $caps and $caps2, what about
$capss() does sentence capitalization and converts "everything else" to lowercase (compare $caps())
$capss2() does sentence capitalization and leaves all other letters as they are (compare $caps2())

Or $scaps / $scaps2

Re: Request: Titleformat $caps3()

Reply #5

For symmetry with $caps and $caps2, what about
$capss() does sentence capitalization and converts "everything else" to lowercase (compare $caps())
$capss2() does sentence capitalization and leaves all other letters as they are (compare $caps2())

Or $scaps / $scaps2

Very good idea. That would be very helpful in organizing my library.

Re: Request: Titleformat $caps3()

Reply #6
It is more complicated.
Sentence case: "Blah! Blah blah"

It gets even more complicated: "The first men on the moon were the Americans. Who will be the first on Mars?"


Personally, rather than a new titleformatting function, I'd rather have one more option in the masstagger component to mimic functions, something like "FORMAT values from input dialog...".
For example, I have a masstagger script to stylize english titles according to musicbrainz rules. I wanted to use it for both track and album titles, so I had to make an exact copy of it and replace all %title% occurrences with %album% and if I wanted to use it for any other field I'd have to make a third copy (and remember to keep track of eventual edits for all three of them). Maybe there could be a special notation to replace the field indicator with the one received from an input dialog box, triggered by the command to run the script.
I'm late

Re: Request: Titleformat $caps3()

Reply #7
Have you tried something like this?
Code: [Select]
$puts(mystring,%title%)
$get(mystring)
Put the first line in front, then replace all occurences of %title% in your script with the second line. Then you only have to edit one instance instead of all.

Have not tested if it actually works with masstagger, so your mileage may vary. Also obviously this is just a slight optimization of a process you probably already don't like.

Re: Request: Titleformat $caps3()

Reply #8
It gets even more complicated: "The first men on the moon were the Americans. Who will be the first on Mars?"

Sure, but if you want to do as much correct automatically first to minimize manual patchwork, then converting
the first men on the moon were the americans. who will be the first on mars?
into
The first men on the moon were the americans. Who will be the first on mars?
would be an improvement. If you are German, you need a bit more work though.

(And can someone please tell the idiots at Discogs that Capitalizing Every Word In Every Language Is Damn Wrong?)