Pausing in a multi-function button

Porc,

Count me in if you need testers. And if you've got it covered already, let me know when the "final" version is out. :smiley:

Thanks!

--chriscrutch

Feel free to write bigger better titlecase renamers. No toes to be trod on here. :slight_smile:

Without looking too hard at the code, allowing exclusions like ", The" at the end of a filename would require a complete re-write of the filename parsing stuff.

I will give some thought to this, but don't hold your breath. :slight_smile:

It looks like Porc has a solution anyway.

Hi Chris,
I definitely need your help.
Since this was you're idea to start with, I can't think of anyone better qualified to write some of the documentation for this.

Can you tell me an email address or send me an email to the address listed in 'All about Porcupine' ?

:opusicon: porcupine

chriscrutch [at] gmail.com

By the way, your "All about porcupine" page doesn't list an e-mail address. :slight_smile:

Thanks again.

--chriscrutch

I wrote a quick little TitleCase alternative that seems to work for the specific file handling you're looking for as well chris... Not to contest with Porc (:-)) but if you'd care to give it a whirl you can grab it from here... and write yourself a button that runs the following commands:

runmode hide
Rename PATTERN="(.)(- [0-9][0-9] - )(The|A)( )(.).(.*)" TO "\1\2\5, \3.\6" REGEXP
@NODESELECT
pseudoCase.exe {f}

I'm guessing that your filenames are otherwise generated with 'pseudo Title Case' where all words are captialized (like Dopus rename does) from freedb or gracenote or wherever, and that you're just looking for the tweaking to proper case for a 'little' bit of filename adjustment.

So that's what pseduoCase does, and ONLY that. Despite being twice as large as Tanis app, pseudoCase does NOT do all of the extra work he does... where he's got it replacing underscores and '%20' strings and such with spaces, as well as stripping out extra spaces next to each other. He's probably using StrConv or TextInfo stuff covered under .NET and VB, whereas pseudoCase is using straight C and Win32 calls in a Win32 console app, plus tons of unnecessary debug stuff that is just a matter of habit for me but which could be stripped out, and is limited to the following 'casing':

"A " "An " "And " "At " "For " "In " "Of " "On " "Or " "The "...and so I 'think' should work for most cases, and has easy room for other word and parsing changes. I won't be hurt if you don't bother with it, Porc got there first, and I had some time to kill during a boring meeting :slight_smile:.

edit note- you could add an optional:
Rename CASE=allwords
@NODESELECT

in addition to the button command just after the runmode hide, in case (like me) you get some CD's that are entered into freedb with all lower case letters... this way, let Dopus due it's 'pseudo Title Case' rename, then 'fix' it with pseudoCase.exe...

Hi Steje,

pseudocase works really well Steje.
It made a few mistakes in my test album, but Titlecase made a couple too.
Titlecase did strip out my underscores though.

I'm writing a second version of mine that operates on selected files only instead of all files in the directory.
It's really a stripped down version of the one I wrote yesterday.

Well, I'll let Chris have a look at mine and see what he thinks.
He may like your solution better.

:opusicon: porcupine

Hi Steje,

The good news is that your program works and does what it says it does.
The button works fine for an album, but suppose we have a DVD of mp3's in one directory or even more.
The bad news is that my system gets Blue Screens of Absolute Death when running your button on many, many music files.

I have to bow out here as I'm really running an old system.
However, it does seem flawed.

When I combine your program with mine all works well.
A couple little result bugs, but nothing deadly.

When I use TitleCase with mine all still works well.

:opusicon: porcupine

[quote]He may like your solution better[/quote]Yikes... no way, not if it blue screens your machine. I admit to only having tested it on an album by album level and not enmasse to a but-load of files, though I'm not sure why it would actually bluescreen :frowning: that's what I get for dabbling in Win32 - out of my element :slight_smile:. What kind of project is your app - maybe you want my code (busted-up as it is LOL) to combine into your app and make a single stand-alone way of doing things lie this?

Steje:

I like the program. I don't really have any use for stripping of underscores anyway, so that "missing" feature didn't bother me. It works nicely, but I've found a few flaws. For one, there are certain words ("in" for example) that your program puts into lowercase even when they are the first word in the song title. That's incorrect title casing. The program doesn't do it to all the words, just some of them. Second, your program is also changing artist names and album titles. That feature is great, but if the artist or album title begins with one of the words that should be lower-cased, it gets lower cased. Example: Budgie - In For The Kill - 01 - In For The Kill.mp3. Should produce: Budgie - In for the Kill - 01 - In for the Kill.mp3. Does produce: Budgie - in for the Kill - 01 - in for the Kill.mp3. Another example: The Ataris - So Long Astoria - 10 - The Boys Of Summer.mp3. Should produce: The Ataris - So Long Astoria - 10 - Boys of Summer, The.mp3. Does produce: the Ataris - So Long Astoria - 10 - Boys of Summer, The.mp3 It's perfect aside from a few hiccups, and I thank you! And I only tested it on a dozen or so songs at a time, too, so I didn't see any blue screens. I do eventually want to run whatever solution comes out looking best on a couple thousand files at the same time, though, so I'm a bit queasy about doing that now....

Porc:

Your solution worked great on my test files. Not all of the files ended up with correct names at the end, but they were related to faults in TitleCase, not in your program. Of course, there won't be a computer program any time soon to correctly change filenames to true title case, because there are some words that get capitalized sometimes and not capitalized other times, depending on how they are used grammatically (example: "up" used as a preposition should be lowercase, but "up" functioning as a particle should be capitalized). It would be near impossible to write a program to handle that. But I do need to convince Tanis to add a word or two to his program. :slight_smile:

Nice work to both of you, and thank you very much. Porc, let me know about the next step.

--chriscrutch

P.S. I just found another "flaw" in TitleCase. Of course, the program wasn't really supposed to be used like this, so it's not really a flaw. If I run Porcupine's solution TWICE on files that originally had a "The" or an "A" to move, the casing gets a bit messed up. The first run works great, just like it should, and puts the "The" or the "A" at the end. Running it a second time causes TitleCase to lower-case the final word. Example (with shortened filenames for the sake of space): "The Boys of Summer.mp3" run through twice produces "Boys of Summer, the.mp3"

Yeah - like I said, quick and dirty. And with Porcs note about blue screen, worthless. And if it still needs work anyway for it's parsing Porcs way is probably the way to go...

Just for your info Steje, the list of words which should be lower case in true titlecase:

a
an
at
and
but
by
for
in
into
is
of
off
on
onto
or
the
to
it

There could well be more but that's the list I came up with when researching true titlecase.

Chris,

Given the string:

boys of summer, the

True titlecase renaming should result in:

Boys of Summer, the

as it currently does with Titlecase.exe.

Anything other than this is no longer true titlecase.

Whilst I understand you need this for your method of music naming, it doesn't suit all titlecase renaming needs to just convert any instances of "the" or "a" which follow a comma to Capitals.

Afaik there are no articles, prepositions or conjunctions missing from Titlecase so no words need to be added :slight_smile:

Thanks for the info Tanis - clearly my memory of articles, prepositions, and conjunctions is not not what my old English teacher would have liked :slight_smile:.

Hi Steje,

I don't think it was your program's fault.
Your program works great enmasse when used sync: with mine.
My program replaces the regular expression part.

Chris, can you verify my blue screen result ?

The next step is to write an introduction to this for the program documentation.
Why are we doing this ?
How is it useful ?
What is so flexible about this ?
How would other users benefit by adopting this system ?

And keep beta testing, try to screw the program up.
The program shouldn't rename folders for instance.
I'll write the Selected File version soon, but I probably won't find time for a few days.

:opusicon: porcupine

Porc:

You got it. I'm on it. Will have it this weekend sometime. I'll keep trying to get the program to do stuff it shouldn't do.

Tanis:

While I really don't want to get into an argument about what true title casing is, perhaps you and I are using two different styles.

The style of title casing that I have always known says that (among other things of course) the first and last word of a title should always be capitalized, regardless of other rules. Thus, title casing for "Boys of Summer, The" should keep the capitalization of the word "the," whether or not it's my particular convention of naming files. If it really is (and should be thought of as) the first word of the title, then it should be capitalized. If it is thought of as the last word in the title, which just happens to be preceded by a comma, then it should still be capitalized as the last word in a title.

As far as adding words, again, I don't know the particular style that you've adopted. There are styles that say that all prepositions, for example, be lowercase, while others say that only "short" (i.e. 4 letters or less) prepositions should be lowercase. Using either style, there are some prepositions missed by your program. Here is a list of ones that I know of:

With, From, As (an acceptable omission because when used as a subordinate conjuction it should be capitalized), About, Like, Between, After, Over, Under, Around (although it's not always a preposition), Without, Within, During, Towards, Upon, Including, Among, Across, Behind.

Again, please don't think that I'm insulting you or your work. I had actually been beginning to think that no one used true title case anymore until I came across your program. It's fantastic, and I'm very glad that I found it. Just trying to clarify my earlier statements. Please feel free to tell me to go straight to hell. :smiley:

--chriscrutch

Steje,

Any chance you could expand your 'pseudocase' program to include the list of prepositions Chris has pointed out ?

I don't think there is anything wrong with your program.
You have a far better start on it than I do.

We could then use both of ours together with sync: preceding each of them.

:opusicon: porcupine

Sure, I'll do it tomorrow and also make sure it doesn't miscase the leading preposition as well...

Thanks much Steje !

An option to remove underscores would be sweet.

:opusicon: porcupine

Hey there...

I made some late night posts last night after a very long day but just did not have the juice to go messing with the changes to pseudoCase, but I just banged it out and the update is posted on my site at the same link as before. If you run it with no options it should say version 1.01 to let you know it's the latest rev.

Porc/chris... if you have any time to mess around with it (try and break it etc) then great. As long as it looks ok I'll ask Tanis to post it as a TitleCase 'alternative' :slight_smile:.

Basic rundown:

  • expects all words capitalized already (i.e. Dopus capitalize all word rename)
  • checks for all the articles, prepositions, and conjunctions mentioned in this thread by both Tanis and chris, plus replaces underscores with spaces: "_" "A " "About " "Across " "After " "Among " "An " "And " "Around " "As " "At " "Behind " "Between " "But " "By " "During " "For " "From " "In " "Including " "Into " "Is " "It " "Like " "Of " "Off " "On " "Onto " "Or " "Over " "The " "To " "Towards " "Under " "Upon " "With " "Within " "Without "- allows for the following string match exceptions: will NOT lower case first word of the filename or any of the screened for strings occurring directly after a hyphen or a hyphen and then a space.

Example Dopus button config with pseudoCase:
runmode hide
Rename CASE=allwords
@NODESELECT
Rename PATTERN="(.)(- [0-9][0-9] - )(The|A)( )(.).(.*)" TO "\1\2\5, \3.\6" REGEXP
@NODESELECT
pseudoCase.exe {f}

Original filename:
Led Zeppelin - Houses Of The Holy - 01 - The Song Remains The Same.mp3
New filename:
Led Zeppelin - Houses of the Holy - 01 - Song Remains the Same, The.mp3

Original filename:
Led Zeppelin - Houses Of The Holy - 03 - Over The Hills And Far Away.mp3
New filename:
Led Zeppelin - Houses of the Holy - 03 - Over the Hills and Far Away.mp3

Bad news
I just just realized that I based the string matching on the problem chris had with TitleCase where the trailing ",The" was getting lowercased. Now that I'm actually writing this stuff down, I just realized that the string match will cause any word at the end song title NOT to be lowercased :frowning:. Pain in the ass - no wonder Tanis didn't jump at the prospect of modifying TitleCase... I'll figure out a better way maybe tomorrow.

Hi Steje,

That's great news Steje ! I'll look into it.
I have a new version of mine too.
I realized that flac files were not being processed correctly.
I fixed the bug and it now processes files with any extension length except 0.

My program replaces the regular expression part.
We can then just use sync: before each to run them together.
It might be better to run yours first and then run mine to shift The and A to the end.
That way your underscore removal has a chance to operate first.

Perhaps we can combine our results and submit it to Tanis as one download ??

:opusicon: porcupine