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: Single-letter album titles don't get recognized as titles? (Read 4528 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Single-letter album titles don't get recognized as titles?

Hmmm... Just ripped Vreid's new album, "V". My tags are fine, Like Album Artist == "Vreid", Date == "2011", Album == "V", but when I try to move the folders, using,

$meta(ALBUM ARTIST)\$if($longer($trim($meta(ALBUM)),''),$if($longer($trim($meta(ORIGINAL RELEASE DATE)),''),$meta(ORIGINAL RELEASE DATE)' - ',$if($longer($trim($meta(DATE)),''),$meta(DATE)' - '))$meta(ALBUM)$if($longer($trim($meta(ALBUM SUBTITLE)),''),' - '$meta(ALBUM SUBTITLE))$if($longer($trim($meta(RELEASETYPE)),''),' ('$meta(RELEASETYPE)')')$if($and($longer($trim($meta(ORIGINAL RELEASE DATE)),''),$longer($trim($meta(DATE)),'')),$if($equal(ORIGINAL RELEASE DATE,DATE),'',' ('$meta(DATE)')'))$if($longer($trim($meta(CATALOG ID)),''),' ('$meta(CATALOG ID)')')\[Disc $meta(DISCNUMBER)[ - $meta(SETSUBTITLE)]\])[[$meta(DISCNUMBER)]$num($meta(TRACKNUMBER),2)' - ']$if($strcmp($meta(ALBUM ARTIST),$meta(ARTIST)),,[$meta(ARTIST)' - '])$if($longer($trim($meta(CONTENT GROUP)),''),$meta(CONTENT GROUP)' - ')$meta(TITLE)$if($longer($trim($meta(SUBTITLE)),''),' - '$meta(SUBTITLE))$if($longer($trim($meta(ORIGINAL ARTIST)),''),' (Originally by '$meta(ORIGINAL ARTIST)')')

foobar2000 wants to put them in /Vreid/XX - Title.mp3 etc...

If I change the album title to "V V", foobar wants to put them in /Vreid/2011 - V V/XX - Title.mp3 etc...

What gives?

Cheers

Single-letter album titles don't get recognized as titles?

Reply #1
A double single quote ('') produces a single quote ('), it is to allow the escaping of that character when you need it. All of your $if($longer( conditions are checking if the text is longer than 1.

The $meta function returns false if the value is not found, although if you are looking for present but empty tags then $ifgreater($len(),0,,) or $if($greater($len(),0),) would probably be a more elegant solution.

On a side, the context menu item Clean Up in the properties dialog will remove leading and trailing white space, so $trim is really only needed if you have bad tags.

Single-letter album titles don't get recognized as titles?

Reply #2
Hmm... I just tried replacing all apostrophies with quotes, the result is not exactly good, e.g. 01 - " - " Arche.mp3

I'm not looking for empty tags, not sure what you mean really?

Cheers

Daniel

Single-letter album titles don't get recognized as titles?

Reply #3
What is that giant lump of syntax supposed to be doing?

Are you querying whether fields are longer than one character because you want to only display them if they exist (i.e. to avoid the ? usually displayed when they do not)? If so, just put them in square brackets.

Ugly pseudo-code example:
Code: [Select]
%always_displayed% - [%everything_in_brackets_is_only_displayed_if_this_exists% extra stuff] - %always_displayed

Also, what PM said.

Single-letter album titles don't get recognized as titles?

Reply #4
What is that giant lump of syntax supposed to be doing?


Well, what is specified in the docs that they're capable of doing... Without an "empty()" function, you need this. I wrote this for myself in my expr docs,

// The $longer($trim($meta(FIELD)),'') notation is kludgy as hell, but without an
// $empty() function, I find it's a bulletproof way to ensure that only fields with
// non-all-whitespace values are used. E.g. $meta(FIELD) is true when FIELD is empty.
// Not trying to be religious here, I simply want something that Just Works. Always.

Are you particularly pointing at something not covered by the documentation, or...?


Are you querying whether fields are longer than one character because you want to only display them if they exist (i.e. to avoid the ? usually displayed when they do not)? If so, just put them in square brackets.

Ugly pseudo-code example:
Code: [Select]
%always_displayed% - [%everything_in_brackets_is_only_displayed_if_this_exists% extra stuff] - %always_displayed

Also, what PM said.


Square brackets don't always work. But they're really great when they do.

This is my expression for file renaming, with comments,

// General notes: There are no %% automagic field tokens being used. Explicit $meta()
// all the way. Keeps it simple, and I don't have to worry about which field values
// are automatically substituted with other ones when missing. If I forgot to tag a
// field, I would like to know, and this way the move operations preview tells me.
//
// The $longer($trim($meta(FIELD)),'') notation is kludgy as hell, but without an
// $empty() function, I find it's a bulletproof way to ensure that only fields with
// non-all-whitespace values are used. E.g. $meta(FIELD) is true when FIELD is empty.
// Not trying to be religious here, I simply want something that Just Works. Always.

// I always add album artist, so if missing (no automagic substition), the move
// should fail:
$meta(ALBUM ARTIST)\
// Only create album and disc sub-directories when the album has been named:
$if($longer($trim($meta(ALBUM)),''),
   // When ORIGINAL RELEASE DATE is set (e.g. for a remastered album), we want that
   // put first, so that filesystem sorting reflects the time the album was originally
   // released rather than when it was re-released. If neither is specified, skip it:
   $if($longer($trim($meta(ORIGINAL RELEASE DATE)),''),$meta(ORIGINAL RELEASE DATE)' - ',$if($longer($trim($meta(DATE)),''),$meta(DATE)' - '))
   $meta(ALBUM)
   // Subtitle only when present, e.g. "An Elektion of Elektrifying Elektropop":
   $if($longer($trim($meta(ALBUM SUBTITLE)),''),' - '$meta(ALBUM SUBTITLE))
   // RELEASETYPE is a custom tag used to signify when the type of the release is
   // non-standard, e.g. '12" White Label Vinyl' or '1,000 Copy Limited Edition':
   $if($longer($trim($meta(RELEASETYPE)),''),' ('$meta(RELEASETYPE)')')
   // Similar to album date logic above, when and original release date has been
   // specified, we want to write the date of the re-release in parentheses. There's
   // and extra check here to skip it if the two dates are identical:
   $if($and($longer($trim($meta(ORIGINAL RELEASE DATE)),''),$longer($trim($meta(DATE)),'')),$if($equal(ORIGINAL RELEASE DATE,DATE),'',' ('$meta(DATE)')'))
   // CATALOG ID is a custom tag, used for catalog identifiers, e.g. "WARPCD 001":
   $if($longer($trim($meta(CATALOG ID)),''),' ('$meta(CATALOG ID)')')\
   // Add an extra disc # subdirectory with the disc title appended if present:
   [Disc $meta(DISCNUMBER)[ - $meta(SETSUBTITLE)]\]
)
// Disc and track numbers when present:
[[$meta(DISCNUMBER)]$num($meta(TRACKNUMBER),2)' - ']
// If the track artist differs from the album artist, add it:
$if($strcmp($meta(ALBUM ARTIST),$meta(ARTIST)),,[$meta(ARTIST)' - '])
// If we have a TIT1 tracks group value, write it before the track title:
$if($longer($trim($meta(CONTENT GROUP)),''),$meta(CONTENT GROUP)' - ')
$meta(TITLE)
// TIT3 track subtitle (e.g. "Live at Vega 2009") goes after:
$if($longer($trim($meta(SUBTITLE)),''),' - '$meta(SUBTITLE))
// And if and original artist has been specified, add it at the very end:
$if($longer($trim($meta(ORIGINAL ARTIST)),''),' (Originally by '$meta(ORIGINAL ARTIST)')')

// ...in one line:
$meta(ALBUM ARTIST)\$if($longer($trim($meta(ALBUM)),''),$if($longer($trim($meta(ORIGINAL RELEASE DATE)),''),$meta(ORIGINAL RELEASE DATE)' - ',$if($longer($trim($meta(DATE)),''),$meta(DATE)' - '))$meta(ALBUM)$if($longer($trim($meta(ALBUM SUBTITLE)),''),' - '$meta(ALBUM SUBTITLE))$if($longer($trim($meta(RELEASETYPE)),''),' ('$meta(RELEASETYPE)')')$if($and($longer($trim($meta(ORIGINAL RELEASE DATE)),''),$longer($trim($meta(DATE)),'')),$if($equal(ORIGINAL RELEASE DATE,DATE),'',' ('$meta(DATE)')'))$if($longer($trim($meta(CATALOG ID)),''),' ('$meta(CATALOG ID)')')\[Disc $meta(DISCNUMBER)[ - $meta(SETSUBTITLE)]\])[[$meta(DISCNUMBER)]$num($meta(TRACKNUMBER),2)' - ']$if($strcmp($meta(ALBUM ARTIST),$meta(ARTIST)),,[$meta(ARTIST)' - '])$if($longer($trim($meta(CONTENT GROUP)),''),$meta(CONTENT GROUP)' - ')$meta(TITLE)$if($longer($trim($meta(SUBTITLE)),''),' - '$meta(SUBTITLE))$if($longer($trim($meta(ORIGINAL ARTIST)),''),' (Originally by '$meta(ORIGINAL ARTIST)')')

Single-letter album titles don't get recognized as titles?

Reply #5
I sort of see what you mean, but. . .

Without an "empty()" function, you need this.
There is an 'empty function'; it's performed by the square brackets! I guess you have chosen this particular syntax because of the (rare) possibility of fields that do exist but are empty or whitespace-only?

Either way, I think PM's suggestion of "$ifgreater($len(),0,,) or $if($greater($len(),0),)" might be better.

Square brackets don't always work. But they're really great when they do.
I guess this is in case of empty or whitespace-only fields, as above?

I now understand better what you're trying to do, just wondering if there's any way to simplify it - but you and others probably know more about titleformatting than me.

Single-letter album titles don't get recognized as titles?

Reply #6
I sort of see what you mean, but. . .

Without an "empty()" function, you need this.
There is an 'empty function'; it's performed by the square brackets! I guess you have chosen this particular syntax because of the (rare) possibility of fields that do exist but are empty or whitespace-only?


Exactly. You know, I had 1500 files that I wanted to sort after a very bad crap attack from JR Media Center, and this was what I was left with that worked for all. I know that the square brackets notation works for properly tagged files, but for the ones that JRMC left me with, apparently they weren't all that kosher  So I ended up with that dirty kludge  It was much simpler to begin with, but I had to mod it to work for all of it. And then I thought, what the hell, better keep it, it's more resistant anyway

Either way, I think PM's suggestion of "$ifgreater($len(),0,,) or $if($greater($len(),0),)" might be better.


Yeah, but with regards to this, I mean, I haven't had any issues with any album before now, is it really my move expression or is it a bug? Maybe it's just my expression, but being a regular expression hacker I simply cannot pinpoint any problem...?

Square brackets don't always work. But they're really great when they do.


I guess this is in case of empty or whitespace-only fields, as above?

Quote
I now understand better what you're trying to do, just wondering if there's any way to simplify it - but you and others probably know more about titleformatting than me.



Single-letter album titles don't get recognized as titles?

Reply #7
You have been told what the problem is in the very first reply.

Single-letter album titles don't get recognized as titles?

Reply #8
Quote
I haven't had any issues with any album before now, is it really my move expression or is it a bug? Maybe it's just my expression, but being a regular expression hacker I simply cannot pinpoint any problem...?

Well, your code only displays fields if they are longer than one character in length. And your issue is that "Single-letter album titles don't get recognised as titles". Sound familiar?

Single-letter album titles don't get recognized as titles?

Reply #9
You have been told what the problem is in the very first reply.


Hi Franck  (With headphones just like mine, if your pic is accurate  )

How do you mean? Because I tried exchanging apostrophes for quotes, with the result I reported...

Do you have more info? If so, please elaborate, because I'm not sure what you mean.

Thanks

Daniel

Quote
I haven't had any issues with any album before now, is it really my move expression or is it a bug? Maybe it's just my expression, but being a regular expression hacker I simply cannot pinpoint any problem...?

Well, your code only displays fields if they are longer than one character in length. And your issue is that "Single-letter album titles don't get recognised as titles". Sound familiar?


Argh, yes, sounds very familiar!  But how is '' longer than 0 chars?

Single-letter album titles don't get recognized as titles?

Reply #10
From Purple Monkey's first reply:
Quote
A double single quote ('') produces a single quote ('), it is to allow the escaping of that character when you need it. All of your $if($longer( conditions are checking if the text is longer than 1.
PM's alternative suggestions enable proper checking of whether the length is >0.

Single-letter album titles don't get recognized as titles?

Reply #11
I mean, my expr is saying, "If something longer than '' counted at chars...."

I'm thinking, regexpwise, ".+" ? No?

Single-letter album titles don't get recognized as titles?

Reply #12
Your expression is specifying that fields (and associated text) should only be expressed if their length is >1 character, because '' is translated to '. That's why the album title V (and associated text) is not being added to your file paths. I'd bet that PM's code would fix the problem, because it enables proper checking for fields of a length >0.
Edit: I didn't realise your reply was only 1 min after my previous post, so you may not have read it, in which case the above is probably redundant.

Single-letter album titles don't get recognized as titles?

Reply #13
Hmmm... Okay, so I'm seriously confused here...

Hehe  sorry, dv

But how would I escape characters in my expressions? '' is like MSSQL I quess... Or???

Okay, this still doesn't work... Am I being retarded, or...? So If I want to compare something with an empty string... What?

And why does it work for everything except 1-char strings?

Single-letter album titles don't get recognized as titles?

Reply #14
Because the exact purpose of your code is to not display anything if the field being checked is shorter than two characters!
Escaping characters is done by preceding them with a single quote. Thus, two single quotes map to one single quote.
$len would allow you to check for fields whose length is non-zero.

Purple Monkey said all of this in the second post . . . !

Single-letter album titles don't get recognized as titles?

Reply #15
So the standard for specifying a string value is to enclose it in double-quotes? The search-n-replace thing apparently has to be done manuallly  I'll try that!

Single-letter album titles don't get recognized as titles?

Reply #16
No, double-quotes are just displayed as double-quotes. There is no way to insert a zero-length string, so the only way to check for one is to use $len.

Single-letter album titles don't get recognized as titles?

Reply #17
Yeah.... Len would/should return 0 on any string empty.... I'm confused... What's wrong here?  Why is $longer wrong... Or why is $longer detecting >0 on an empty string?

Are you saying that when comparing you have to create some kind of string, even if empty?

Single-letter album titles don't get recognized as titles?

Reply #18
Quote from: DanielSmedegaardBuus link=msg=750487 date=
Yeah.... Len would/should return 0 on any string empty.... I'm confused... What's wrong here?  Why is $longer wrong... Or why is $longer detecting >0 on an empty string?
I don't know how many times we'll have to go over this.

'' (two single quotes) is not an empty string. It is escaped to ' (one single quote).
Your code specifies "Don't display any of this unless [field] has more characters than [one single quote = 1 character]", i.e. don't display fields of fewer than 2 characters.
Thus, your code rejects single-character fields - such as V.
PM provided a proper way of checking whether a field is longer than 0 characters, which would result in V being displayed properly.

If this isn't clear enough, I have to give up.

 

Single-letter album titles don't get recognized as titles?

Reply #19
Ahhh... Well, for anyone specific about notation, like programmers like me, here's the explanation:

When specifying a match criterion, the anchors aren't apostrophes or quotes as usual, they're commas and/or parentheses with usual notation explicitly omitted. I.e., don't quote anything :

Anything is a literal, including ' which is supposed to be escaped.

Thanks everyone