MusicHawk
Re: Possibly more bugs in .529 (sorry)
« Reply #6 on: Today at 11:33:37 AM » Quote Modify Remove Split Topic
--------------------------------------------------------------------------------
if(isequal([RecVer],unknown,8),,/ ~[RecVer]) does the job.
Thank you very much for clarifying the situation and providing a workaround!
On my soapbox...
I think MC's behavior of sometimes inserting a value of "unknown" should be documented in the Wiki on the Expression Language page, noting that MC does this substitution in one use of IsEmpty but not other uses. I spent hours chasing this "bug" ...
Also, this statement on the Wiki page is not the full explanation of spaces in expressions:
"Spaces are interpreted literally in all areas, except immediately after a comma in a function."
It should say something like this:
"Spaces are interpreted literally in all areas, except immediately after a comma in a function. However, a space can be inserted immediately after a comma by precediing it with a / escape character."
Why do I want a space in this position? It's peculiar to my library's use of custom fields and folder/file naming expressions. It allows me to change how I identify multiple recording versions, by moving that info from the end of the Name value to a separate field, and have it yield exactly the same file names so I end up renaming thousands of them.
Back to MC inserting "unknown", sure, Rename/Move can't result in a folder or file name that is ONLY a space, or starts/ends with a space. BUT a space IS allowed and is common in other character positions in the folder/file name. So ALWAYS adding "unknown" in a folder/file expression is over-doing it a bit. It's frustrating to not have control over the "unknown..." behavior.
Why not insert "unknown" only AFTER the expresssion is evaluated, and only when truly necessary? A function would then work as-documented in all cases, but MC would adjust the result when the evaluation yields an "illegal" Rename/Move value. (In my expression, an empty/null/space in RecVer would not cause any harm because I'm trapping it via a function). I know, building in logic to consider the full resulting string would be extra overhead. Maybe just auto-trim the final folder or file name value so there's no space at either end?
More opinion: Is the word "unknown" the best term? It's stating that MC doesn't know something internally, yet it's being applied to external folder/file names where it seems like a peculiar "statement". A blank value isn't necessarily unknown to the user; often its simply not applicable or relevant to the track.
And adding the field name after "unknown" might seem to be helpful to the user, but is it? It's obvious in the database that a tag field/column is empty; who would look to their folder/file structure to discover that they have "unknown" info?
If MC must sometimes insert a value for "empty" data, it would be terrific to let the user specify via Options the string, and whether the field name gets appended to it. I'd likely use just "none" or "empty" or some other term that is stated from MY perspective.
Re Bug #3, it is confusing but probably just a harmless misstatement by MC. I don't see that is actually changing the file name of two files when I only select one. But it's difficult to be sure, so it likely merits investigation.
marko
--------------------------------------------------------------------------------
Quote from: MusicHawk on Today at 11:33:37 AM
Also, this statement on the Wiki page is not the full explanation of spaces in expressions:
"Spaces are interpreted literally in all areas, except immediately after a comma in a function."
It should say something like this:
"Spaces are interpreted literally in all areas, except immediately after a comma in a function. However, a space can be inserted immediately after a comma by precediing it with a / escape character."
Done.
I'll try and get around to the IsEmpty vs IsEqual thing soon. I've got some half-finished stack pages laying around here that need to take priority, once I've finished "The Fly"....
Not enough hours in the day!!
-marko.
--------------------------------------------------------------------------------
Alex B
Re: Possibly more bugs in .529 (sorry)
« Reply #8 on: Today at 12:14:52 PM » Quote Modify Remove Split Topic
--------------------------------------------------------------------------------
Quote from: MusicHawk on Today at 11:33:37 AM
if(isequal([RecVer],unknown,8),,/ ~[RecVer]) does the job.
Out of curiosity, what is your full string now?
I figured out that
Quote
if(isequal([RecVer],unknown,8), FixCase(Mid([Artists],0,20) - [Name],4), FixCase(Mid([Artists],0,20) - [Name]/ ~[RecVer],4))
should work (I tested it with my custom fields).
I tried to simplify it, but I couldn't make it work when "if(isequal" was not in the beginning. Though, it is quite possible that I did a typo when I quickly tested different variations.
--------------------------------------------------------------------------------
The Cosmic Bird – a triple merger of galaxies:
http://www.eso.org/public/outreach/press-rel/pr-2007/pr-55-07.html MusicHawk
--------------------------------------------------------------------------------
Here's my complete Rename/Move file name expression:
FixCase(Mid([Artists],0,20) - [Name]if(isequal([RecVer],unknown,8),,/ ~[RecVer]),4)
It works to have FixCase evaluate the overall result, reliably converting the whole thing to lowercase (so my files are compatible with all types of storage systems).
I'd been using a Name suffix of ~SOMETHING to identify song versions, until I added the RecVer field (after reminding myself that smart database design separates logical elements). So I'm now transferring whatever follows ~ into the new field, then deleting it from Name. Because Name has always been part of my file name expression, ~SOMETHING ended up in the filename, as desired.
My goal was to split off the ~SOMETHING text from Name to RecVer, then use both to determine the file name IF RecVer has a value, but not alter existing filenames unnecessarily. For example...
Before:
Name = Lotus Blossom ~1967
Filename = m:\music\jazz\e\ellington, duke - lotus blossom ~1967.mp3
After:
Name = Lotus Blossom
RecVer = 1967
Filename = m:\music\jazz\e\ellington, duke - lotus blossom ~1967.mp3
Before:
Name = Lotus Blossom ~TAKE1
Filename = m:\musicminor\jazz\e\ellington, duke - lotus blossom ~take1.mp3
After:
Name = Lotus Blossom
RecVer = TAKE1
Filename = m:\musicminor\jazz\e\ellington, duke - lotus blossom ~take1.mp3
With the revised expression it renames correctly whether RecVer has a value or not. Thanks again.