INTERACT FORUM

More => Old Versions => Media Center 12 (Development Ended) => Topic started by: MusicHawk on April 05, 2008, 07:20:37 pm

Title: Rename files from properties quirk with Rating property.
Post by: MusicHawk on April 05, 2008, 07:20:37 pm
A vote for a small change in how the Rating property is used in Rename files from properties.

The Rating property can be set to no value, or 1 to 5 stars.

When I use this property in Rename files from properties, for a Rating of 1 to 5 I get that value in text as part of the file name. A Rating of 3 stars results in text "3" in the file name.

But when the Rating value is blank, the text used in the file name is "_stars". The word "stars" is not added to a Rating of 1 to 5, only to a "no rating" Rating.

My vote is that "not 1 to 5" be translated to "0" when used to Rename files.

For instance: The song "Yesterday" with Rating of 5 might be renamed to: "5-Yesterday.mp3".

But the song "Yesterday" with no Rating would be renamed to: "_stars-Yesterday.mp3". Wouldn't it be cleaner if it was "0-Yesterday.mp3"?

The annoyance is that the "_stars" files don't group or sort logically with similarly-named files with a Rating of 1 to 5.

I suppose the "_stars" behavior is because "no rating" is considered a null value, important in database design to distinguish "no data" from an intentional value of 0 or blank. But in MC's Rating property the user can't specify 0 -- the only choices are 1 to 5 and "x" which blanks out the ratings field. So, a "not 1 through 5" Rating specified by the user is indistinguishable from a null value. Therefore, why not just treat it as "0"?

Just a thought...
Title: Re: Rename files from properties quirk with Rating property.
Post by: MusicHawk on May 02, 2008, 11:37:06 am
Follow-up:

I tried to override the "rename files from properties" behavior that converts a blank/0 [Rating] into path/filename text "_stars" rather than "0", by using the Replace function.

My Directories rule expression contains this (in a more complex expression): Replace([Rating],_stars,0)

However, when applied to a file that has a Rating of 0 but a folder named "_stars", MC tells me "no change".

Maybe MC's Rename tool sees "_stars" and "0" as equal; why?

Or maybe the value-to-text conversion happens later in the process, beyond user control. Perhaps the database stores "0" for a blank Rating, but the Rename process, AFTER applying any user expressions (such as Replace), then converts a Rating of "0" to "_stars". If this is what's happening, it seems arbitrary and undesirable.

Can anyone clarify what's happening? Is there a sure-fire way to do this?

I still think that a Rating of 0/blank should result in "0" when using [Rating] in Rename, just as a Rating of 1 results in "1", etc.

But a strong second choice is to respect the user's entire Rename expression, and not override it behind the curtain. (With the exception of not allowing "illegal" filename characters.)

Title: Re: Rename files from properties quirk with Rating property.
Post by: marko on May 02, 2008, 12:27:55 pm
In tests I made just now, it's "_ stars" not, "_stars" (note the space) does it work now?

If not, try incorporating this: if(isequal([rating],stars,8),0 - [name],[rating] - [name])

It works for me like that, but it does not work if I used underscore instead of stars. ?

-marko.
Title: Re: Rename files from properties quirk with Rating property.
Post by: MusicHawk on May 02, 2008, 01:19:12 pm
Your workaround is clever, thanks. Sorry about my typo, but in the actual Replace expression I used "_ stars" (and also tried other variations just in case) with no success.

In my tests, Replace sees a blank Rating value as equal to text "_ stars" so won't alter it. I tried "stars" rather than "_ stars" in the Replace expression, but that results in "_ 0". The underscore-space seems hard-wired in, or is applied after Replace is evaluated.

However, in your expression MC treats a Rating of blank as equal to "stars", and not equal to "_ stars" -- another mystery.

If Replace and IsEqual evaluate Rating-related values differently, that seems like a bug.

I see this as another reason to output "0" as the expression/text value of a blank Rating, consistent with how other Rating values are handled.
Title: Re: Rename files from properties quirk with Rating property.
Post by: marko on May 03, 2008, 02:11:05 am
Quote
However, in your expression MC treats a Rating of blank as equal to "stars", and not equal to "_ stars" -- another mystery.

No mystery. the ,8 that follows stars tells the expression editor to use a case-insensitive sub-string compare, ie. if the output value contains 'stars', then use 0, otherwise, use [rating].

The same expression works if you use an escaped space, "/ ", instead of 'stars', but does not work if you use an underscore.
I think you may have found a bug there in that respect, as the tool's failure to pick up the underscore is the most likely reason that your replace() function is not working.

-marko.
Title: Re: Rename files from properties quirk with Rating property.
Post by: MusicHawk on May 03, 2008, 11:40:21 am
Sorry to be unclear, I understand the syntax of IsEqual and what the 8 means.

The mystery is why MC seems to output/handle the Rating value differently in Replace vs. IsEqual, perhaps a bug, coupled with the "peculiar" output of "_ stars" for Rating = blank/0 when otherwise the output is a text number ("1", etc). Both behaviors make it difficult to work with Rating in an expression.

Thanks to your suggestion, I have a workaround, but maybe an MC developer will reconsider how this works.