INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Switching composer listings to "Lastname, Firstname"  (Read 10517 times)

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Switching composer listings to "Lastname, Firstname"
« on: February 14, 2013, 02:23:09 pm »

Is there an automated way to switch "Franz Joseph Haydn" to "Haydn, Franz Joseph?" I have thousands of composers in my library and would rather not switch them all individually. There's got to be a way to do this. Any ideas?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #1 on: February 14, 2013, 02:31:45 pm »

Use this to assign to Composer:

  =if(regex([Composer], /#^(.+)\s+(.*?)$#/), [R2]/, [R1], [Composer])

Test it first in a panes column:

   if(regex([Composer], /#^(.+)\s+(.*?)$#/), [R2]/, [R1], [Composer])
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Switching composer listings to "Lastname, Firstname"
« Reply #2 on: February 14, 2013, 02:45:27 pm »

So awesome. Thank you!

Now, there are about 100 or so composers which I've already manually edited the new way. Is there a way to make that expression skip composers that already have a "," in the name?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #3 on: February 14, 2013, 02:48:16 pm »

if(regex([Composer], /#^([^,]+)\s+([^,]*?)$#/), [R2]/, [R1], [Composer])
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Switching composer listings to "Lastname, Firstname"
« Reply #4 on: February 14, 2013, 02:58:05 pm »

You just saved me many hours worth of work. Can't thank you enough!

For others who want to implement this, here's how I did it. There may be a better way?

1. Go to Tools>Options>Library & Folders and select "Manage Library Fields"
2. "Add New Field", third button from the bottom, left side of window
3. Name the new field whatever you want, I just did "Composer Swapped"
4. Under Data, select "Calculated data" and paste MrC's code into the "Expression" field.
5. Click OK, look through the new data in the "Composer Swapped" field. You'll have to add that field to your panes or details columns.
6. If everything looks good, select all tracks you wish to edit, and go to Tools>Library Tools>Move/Copy Fields.
7. Choose Source: "Composer Swapped (or whatever you named it)", Destination: "Composer", action: "Flip Flop" (in case you want to switch everything back to how it was)

Cheers!
Logged

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Switching composer listings to "Lastname, Firstname"
« Reply #5 on: February 14, 2013, 03:09:57 pm »

Actually, the "flip flop" won't work since your new "composer swapped" field is populated according to MrC's code and can't be edited manually. So if you want to save your old "composer" listings, copy that data to an unused field before you copy your new "composer swapped" info over to "composer."
Logged

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Switching composer listings to "Lastname, Firstname"
« Reply #6 on: February 14, 2013, 04:21:19 pm »

I've been thinking about just these issues lately.

In the specific case of Composers, I decided to use the last name only, i.e. Mozart, Bach, Beethoven, etc.

One big reason is that Classical Music has a LOT of information - Composer, Performer, Work, Album, DateComposed, DatePeformed, and so on.

So, using the last name allows enough screen space for all the other information.  ;D

And, I know who these guys are.   When there are "collisions", such as Bach's sons, I'll just use "Bach,JC" .

In the case of Popular Music, being coherent with the Tagging Universe is important, and I think that the general consensus is to use "Bob Dylan" rather than "Dylan, Bob", simply because half of the artists names are fictional, and thus do not represent a First and Last Name - for example, "Jethro Tull" has to be under "J", even though it is a person's name, because it is fictional.  And, of course, same with "Jefferson Airplane".

Of course, the flexibility of MediaCenter allows everyone to do it exactly as they like on their system...

... but then please don't upload your tags to an online database.   ;D ;D

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #7 on: February 19, 2013, 07:19:14 pm »

In the specific case of Composers, I decided to use the last name only, i.e. Mozart, Bach, Beethoven, etc.

One big reason is that Classical Music has a LOT of information - Composer, Performer, Work, Album, DateComposed, DatePeformed, and so on.

So, using the last name allows enough screen space for all the other information.  ;D

I've been struggling with this (and waffling back and forth) for a long time.

You've convinced me.  I'm switching to this method.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #8 on: February 19, 2013, 07:53:45 pm »

Just one tip to anyone who stumbles upon this thread.  An easy way to use this tool is to just make a custom calculated field that contains the expression MrC posted above.  That way, when you want to use it, you can just edit the field and paste in =[Your Custom Field Name], rather than having to remember or copy/paste the expression in each time.

So, for example, you could just make a field in your database called:

[Composer Name Swap]
Make it a calculated field, and then paste in MrC's expression from above:
Code: [Select]
if(regex([Composer], /#^([^,]+)\s+([^,]*?)$#/), [R2]/, [R1], [Composer])
Also, it works just as well for the [Artist] field as well.  In this case, you could make a field:
[Artist Name Swap]
Make it a calculated field and paste in:
Code: [Select]
if(regex([Artist], /#^([^,]+)\s+([^,]*?)$#/), [R2]/, [R1], [Artist])
Then, when you want to actually use it, just select the file(s) in question, edit the proper field, and type:
=[Artist Name Swap]

And it'll do it for you.

The way I'm doing it is I just made a Playlist called "Utility\Swap These Names".  As I encounter badly formatted ones in my Library, I'm "fixing" them by adding them to the list (Send To > Playlists).  Then, when I feel like it, I'll go in and just open that list up, Control-A, and do them all in one fell swoop.

Another little note:  This expression doesn't work well with people's names with suffixes like "Newton Grovington Stuffypants III."  But screw that guy anyway.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #9 on: February 19, 2013, 08:44:55 pm »

This expression doesn't work well with people's names with suffixes like "Newton Grovington Stuffypants III."  But screw that guy anyway.

I love that guy! :-)

Here's a way you can handle a suffix such as Jr., Sr. III, etc.  The trick is to reverse the items, grab the possible suffix, the next word (which will be the last name), and the remainder:

if(!regex([Artist], /#^([^,]+)\s+([^,]*?)$#/),
   [Artist],
   regex(listclean([Artist], 2, / ),
         /#^(?:(I+|[JS]r\.?)\s+)?(\S+)(.*)$#/, -1)[R2]/,/ listclean([R3], 2, / )[R1]
)

The regular expression to handle this all by itself is gross, so massaging the input data first is easier. :-)

If you want to have both Last, First and First Last it is best to store Last, First for values where it is appropriate, and then use that to drive First Last (easy and automatic transformation).
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #10 on: February 19, 2013, 09:04:22 pm »

Alright, MrSmartyPantsC, since you poked me...  ;) ;D

How about this?

Instead of having to make a special [Artist Name Swap] calculated field, and [Composer Name Swap] calculated field, I'd rather have just a [Name Swap] calculated field that I could apply to ANY field, and have it take the current contents and "name swappify" it.  It could require me to include the parameter for the field to transform, if that's somehow possible (is there a way to pass parameters to calculated fields?), but it sucks to have a bunch of these defined for [Artist], [Composer], [Conductor], and every other possible "name field" a classical connoisseur might dream up.

So... I challenge you, sir!

Is there a way with the current Expression and Field system, o' master of masters?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #11 on: February 19, 2013, 09:19:50 pm »

There's really no way around having more than a single field, because band names and human names are indistinguishable, but require different treatment.  Thus, there needs to be at least one more field per, to designate how to handle the field itself (hence, Artist Sort, etc.).  A strategy could be to encode a sort key marker in the single field to indicate how to treat a field:

   Newton Grovington||Stuffypants||II
   Led Zeppelin
   Brian||Eno||

but few are interested in doing this since it a) requires all usages to be parsed, and b) other software may not have sufficient prowess to handle such an encoded field.

Regarding parametrized user expressions, no real way to do this, since user expressions are simply evaluated and there are no formal parameter passing constructs.  You could use global variables within a user expression, but they have to be set before the expression is used, but that's tantamount to hardcoding the expression itself.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #12 on: February 19, 2013, 09:26:40 pm »

No, I don't mean something I could apply universally to all of the files, still targeted as I described above.

So, I'm not ever going to actually display the calculated field anywhere, or use it for anything, really.  It is just used to edit the [Artist], or [Composer], or [Whatever] to make it switch the order on those particular files.  I'm using the calculated field like a "method" that I'm applying to a particular value as shorthand (so that I don't have to remember a complicated expression, or use a copy/paste "handy expressions" notepad file).

But, you're right... I don't think it can be done, because the calculated fields weren't really designed to be used this way, and so can't (I suspect) take an input parameter of another field to "use" to output their result.  But, you know, sometimes there's the whiskey and then you and Matt start chit-chatting on Sunday night at 1:30am in some obscurely named thread, and suddenly there's this amazing new feature I didn't know about that popped in there.*

What I was hoping for was some way to do something like this:

if(!regex([InputValue], /#^([^,]+)\s+([^,]*?)$#/),
   [InputValue],
   regex(listclean([InputValue], 2, / ),
         /#^(?:(I+|[JS]r\.?)\s+)?(\S+)(.*)$#/, -1)[R2]/,/ listclean([R3], 2, / )[R1]
)

where you call it (to assign the results to the, say, [Conductor] field, like so:

=[Name Swap]([Conductor])

Or some such expression-language syntax nonsense.

* - I recognize this behavior from having participated in it myself in the past.  Aka... I know your tricks, mister.

EDIT:

If I'd read with my eyes open instead of closed, I'd have seen this:

Regard parametrized user expressions, no real way to do this, since user expressions are simply evaluated and there are no formal parameter passing constructs.  You could use global variables within a user expression, but they have to be set before the expression is used, but that's tantamount to hardcoding the expression itself.

Yeah, I thought so.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #13 on: February 19, 2013, 09:34:26 pm »

In my defense, I did say...

My brain hurts today.

It's not really getting better.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #14 on: February 19, 2013, 09:38:35 pm »

No sweat - the last part I added, complete with typos, after the fact.  You must have seen the post prior to my edit.

If an expression gets complex, and refers to a field a number of times, you could use an expression such as:

   complex expression using [field] over and over

   save([field],var)/
   complex expression using [var] over and over

Thus, you only need to change the field in the save() each time you paste.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #15 on: February 19, 2013, 09:40:55 pm »

No sweat - the last part I added, complete with typos, after the fact.

Ha ha!  I'm quicker than the average bear, not just a bit loopy.  ;)
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #16 on: February 19, 2013, 09:50:06 pm »

If an expression gets complex, and refers to a field a number of times, you could use an expression such as:

   complex expression using [field] over and over

   save([field],var)/
   complex expression using [var] over and over

Thus, you only need to change the field in the save() each time you paste.

Hmmm... Now, I don't get the save() expression thing, or the variables, very well at all, though I'd like to...  I've read the stuff in the wiki (though, I admit, I didn't follow those threads or I'd probably get this better), but... Where would you use that Function?

Are the global variables really global (ie. across all future activities with MC, future expressions that haven't been "run" yet), or is it "global" in the sense that it applies over and over within the same "expression" (which might have multiple components)?

If it is the former (I'm very excited, but), how long to they last?  Is the current value written to the Library?  Do they persist across restarts of the application?  And where do you "set" them?  Do you just pull up any old field, or use the search box, or something?  What happens if they're unset, and is there a tricky trick that people are using to "set" these within the UI somehow (without typing)?  Can you set variables to BE expressions, so making the calculated field isn't even necessary?

If it is the latter (which is, I guess, what I suspected before), then how the heck would you use such a thing, other than to copy/pasta it in from a Notepad++ file?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #17 on: February 19, 2013, 09:56:50 pm »

Vars stored with Save() last the duration of the program run.  They can be set at any time.  So the expression above would save a value into the variable every time it is evaluated.  Since we're discussing using such an expression for display or assignment, just setting the correct field inside the save() will result in the right thing.

As I've used it there, think of it as macro substitution.

So

   =Replace([Artist], -, _)

could also be achieved as:

  = save([Artist],var)/
     Replace([var], -, _)

Note: [var] is a new shortcut for load(var).

It doesn't eliminate the need to copy/paste.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #18 on: February 19, 2013, 10:00:26 pm »

... but you could save the complex expression using the global var, and then just set the global var and use the field:

calculated field using var:     Replace([var], -, _)

=save([artist], var)[calculated field using var]
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #19 on: February 19, 2013, 10:18:38 pm »

Okay, got it.  But only the duration of the program run, so you'd have to reset those each time before you used them, which is only worthwhile if you really need the feature.  We could, if we were crafty, automate it by calling the Automation commands on MC and have a script run save() commands to "load it up" with some useful tools (or defaults, at least).  But that sounds like a pain in the butt, again, unless you really need it.

In my case, I don't, I was curious about it as an exercise.  Thanks for explaining.

In the case of Popular Music, being coherent with the Tagging Universe is important, and I think that the general consensus is to use "Bob Dylan" rather than "Dylan, Bob", simply because half of the artists names are fictional, and thus do not represent a First and Last Name - for example, "Jethro Tull" has to be under "J", even though it is a person's name, because it is fictional.  And, of course, same with "Jefferson Airplane".

Of course, the flexibility of MediaCenter allows everyone to do it exactly as they like on their system...

... but then please don't upload your tags to an online database.   ;D ;D

I actually use [Artist] as my "what I want it filed under" container.  All the other fields are informational, so I fill them if I have time, but I just fill them as Firstname Lastname (which is searchable, so good enough).  But, I use [Artist] to construct my Views, so that contains what I want it to contain (which is based on where I'm going to go if I'm looking for it), not what is necessarily "right".  So, for example, I know sometimes Béla Fleck plays with the Flecktones, and sometimes he is solo (and sometimes he probably plays with other dudes too).  I don't care.  If I'm in the mood (usually) I'll copy this information into the [Band] tag, but I tag all of these as [Artist] = Fleck, Béla.  Because that's how I'm going to go looking for them.

I chose the reverse name order "rule" a long, long time ago well before there were good standards for these things (and certainly before there were nice file-based databases available).  And, no, I generally don't submit things like that to online databases, even though my way is better, because it would probably pollute the results.

But, I like the last-name-first rule.  It makes it easier to find certain people, and sometimes I don't know or remember their first names very well (so looking up Harry Mclintock is easier because maybe I can't remember if his name is Harry or Henry or... maybe even Gary?).  It does lead to gray areas, especially with things like The Del McCoury Band or George Clinton and Parliament-Funkadelic/P-Funk All Stars/Whatever He's Calling The Spaceship this Week, but I generally prefer "larger groupings" to "smaller groupings" when I'm browsing, so I usually just pick one style for a particular artist and stick with it, and if I want to "record the truth" I do it in a different tag (usually [Band] but it depends on the situation).  I go by "what I know them as better" and default to the last name, first name (band suffix removed and stashed in [Band]) style if I don't know them very well.

So, The Del McCoury Band is in my Library as The Del McCoury Band, and George Clinton and all of his merry men are just called Parliament-Funkadelic, while Henry Allen & His New York Orchestra is in there as just Allen, Henry with [Band] set to "Henry Allen & His New York Orchestra".

But, that's me.  To each their own, even if you're clearly wrong.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #20 on: February 19, 2013, 10:22:04 pm »

... but you could save the complex expression using the global var, and then just set the global var and use the field:

calculated field using var:     Replace([var], -, _)

=save([artist], var)[calculated field using var]

Ahh, I see.  :)

So, If I did this:

My calculated Field: [Name Swap]
Expression:
Code: [Select]
if(!regex([Swapper], /#^([^,]+)\s+([^,]*?)$#/),
   [Swapper],
   regex(listclean([Swapper], 2, / ),
         /#^(?:(I+|[JS]r\.?)\s+)?(\S+)(.*)$#/, -1)[R2]/,/ listclean([R3], 2, / )[R1]
)

Then, the first time I use it, I could just do (for the [Artist] field):

=Save([Artist], Swapper)[Name Swap]

From then on, I could just use =[Name Swap] until I either restart MC, or want to use it on [Composer]?

That's pretty slick.  Okay, thanks for that last bit.  That gelled it for me.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #21 on: February 19, 2013, 10:29:05 pm »

Right-o!
Logged
The opinions I express represent my own folly.

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Switching composer listings to "Lastname, Firstname"
« Reply #22 on: February 19, 2013, 10:35:28 pm »

I actually use [Artist] as my "what I want it filed under" container.  All the other fields are informational, so I fill them if I have time, but I just fill them as Firstname Lastname (which is searchable, so good enough).  But, I use [Artist] to construct my Views, so that contains what I want it to contain (which is based on where I'm going to go if I'm looking for it), not what is necessarily "right".  So, for example, I know sometimes Béla Fleck plays with the Flecktones, and sometimes he is solo (and sometimes he probably plays with other dudes too).  I don't care.  If I'm in the mood (usually) I'll copy this information into the [Band] tag, but I tag all of these as [Artist] = Fleck, Béla.  Because that's how I'm going to go looking for them.
I do exactly that.

What I am trying out is to use the List datatype of the Artist field, so if I came across an album that was tagged by the online database as "Béla Fleck and the Flecktones", then I will type into the Artist area of Tag:

=Béla Fleck ; [Artist]

(Thanks to MrC for that formulation), and so then the Artist will be:

Béla Fleck ; Béla Fleck and the Flecktones

and will then appear under both entries.

The same applies for many jazz artists, as album covers will have:

Joe Blow
The Joe Blow Quartet
Joe Blow and his All-Stars

etc etc

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #23 on: February 19, 2013, 10:42:07 pm »

Now, I'm getting crafty...

So, can you pre-load those Variables with any tricks?  So, what I'm thinking is this:

You make a smartlist that does uses some nonsense filters to cause it to return zero results, like [Media Type]=[] and [qrjhgjqhergkqhjerjfnnsdfh4]=1, or something, but which then also (perhaps before applying the nonsense filters) runs a bunch of Save() expressions.  Then, all you'd have to do to "set a bunch of default values" would be to "run that smartlist" (which would always return zero results).  You could automate that with a script (and just run it daily, or make a "wrapper script" to launch MC).

Or, maybe you could add that Smartlist as a "Playlist is not" filter (or maybe Playlist is and you return all results, either way) to your Startup Views (or all of your top-level views, whatever).  Hmm... Except that would reset the variables to the defaults each time you opened that particular view.  That wouldn't work.

But would embedding Save() commands like that in a Smartlist work?  Or any other View?  If so, you could use those triggers to load different "setups" (actually, I think rick.ca may have been doing some of that).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #24 on: February 19, 2013, 10:52:57 pm »

I do exactly that.

What I am trying out is to use the List datatype of the Artist field, so if I came across an album that was tagged by the online database as "Béla Fleck and the Flecktones", then I will type into the Artist area of Tag:

I've considered doing the same.

I haven't because what about file renaming via Rename, Move, and Copy Files?  What folder is MC going to use for that [Artist] value?  And if it is stupid and just dumps in the whole thing, then I'll have these silly folders strewn about my filesystem:

Bela Fleck ; Bela Fleck and the Flecktones
Bela Fleck
and probably
Bela Fleck and the Flecktones ; Bela Fleck


Even if it isn't dumb, and uses the first entry in the field, then it would still be somewhat random which one it would use unless I was careful to always use one of the shiny new list-sorting functions too.

So, I'd have to make a calculated field to get the proper artist name for file storage, and then use that in my Rename, Move, and Copy Files profiles.  But that's a pain, so it is the path of least resistance to just "nudge" the edge cases one way or the other.

I might change my mind at some point, but probably not.  It also makes "listings" on screen in Theater View more redundant.

Right now, for example, it doesn't matter that Crosby, Stills, and Nash only sometimes included Young (and were, IMHO, better without him), they all get filed under "Crosby, Stills, Nash, & Young".  If I feel like some CSN, I'm probably also okay with looking at CSN&Y too, so they get grouped.  If I was stricter, I'd have to remember which album is which (actually, easy for me in this case, but it is just an example) if I want to browse to a particular album easily.  I could do it with adding them both and using [Artist] as a List, but then I have to look at both CSN and CSN&Y in Theater View which contain just duplicates of one another (except for the random ones I forgot, so it would also be inconsistent).

So...

I don't know.  I waffle on it quite a bit, but I've continued to stick with a simpler [Artist] structure.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #25 on: February 19, 2013, 10:53:45 pm »

So, can you pre-load those Variables with any tricks?  So, what I'm thinking is this:

Nah, that won't work.  The expression we created needs to be evaluated against each file.  So its:

 foreach file
    save var
    evaluate exp that uses var

While you can use Save() in custom file searches (via Set rules for file display), the final Save() evaluated will be the single value you get:

  foreach file
     save var

Only the last value is stored in var, so later:

  foreach file
     use var (but var is only the last value stored above).
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #26 on: February 19, 2013, 11:11:07 pm »

Only the last value is stored in var, so later:

  foreach file
     use var (but var is only the last value stored above).

Hmm... Then that seems like it wouldn't work the way I stated above either, if I'm understanding it correctly.

I'm not trying to retrieve the value of [Artist] in my imaginary fancy defaults-loading Smartlist, I'm only trying to make it so I don't have to remember to type =Save([Artist], Swapper) the first time before using [Name Swap], assuming that 95% of the time I want to use it on the [Artist] field.  So, in that Smartlist, the Save() expressions wouldn't actually produce any kind of useful file listing filter.  If I have to, to get them in there, I'd just make the results answer false so that it couldn't actually result in a resulting file.  I just want it to basically run an Init() method.

I can see the issue (and I thought of that before you posted) that it would have to evaluate this Init() method foreach entry in the database, which would suck, but you could maybe end-run that by making the preceeding filter in the Smartlist only return one "example file" you know is always in the database (a dummy), and then the Init() would only run against that one file (and thereby only one time).

But...

It seems like what you're saying is that if I take a file that is tagged [Artist]="Tori Amos".  ...
=Save([Artist], Swapper)[Name Swap]
It'll spit out "Amos, Tori".

But, then later I go and pick one that is labeled "Pat Benatar" and I type:
=[Name Swap]
It'll still spit out "Amos, Tori" because that variable is set to the specific value of [Artist], not as a pointer to [Artist] itself?  In other words, the difference between a reference type and a value type.

Is that correct?

Then, if so, my plan to use:

So, If I did this:

My calculated Field: [Name Swap]
Expression:
Code: [Select]
if(!regex([Swapper], /#^([^,]+)\s+([^,]*?)$#/),
   [Swapper],
   regex(listclean([Swapper], 2, / ),
         /#^(?:(I+|[JS]r\.?)\s+)?(\S+)(.*)$#/, -1)[R2]/,/ listclean([R3], 2, / )[R1]
)

Then, the first time I use it, I could just do (for the [Artist] field):

=Save([Artist], Swapper)[Name Swap]

From then on, I could just use =[Name Swap] until I either restart MC, or want to use it on [Composer]?

Would be pretty useless.  Unless, I wanted to do it over and over on individual files, but that's not the case, I'm just using it on big groups of files at a time.  So you'd have to use the =Save() syntax each time you used it, and only change it if you wanted to swap in [Composer] or whatever.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #27 on: February 19, 2013, 11:15:14 pm »

If that's not what you meant, then I don't get it at all.  Why couldn't you preload them with a crafty smartlist used as an "excuse" to run a set of Save() commands for various purposes (set global startup variables)?

Who cares what it spits out.

You could, maybe, even craft it to spit out a "status report" of the variable's default values, if you were crafty.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #28 on: February 19, 2013, 11:18:55 pm »

Right.  What you're looking for is delayed evaluation of symbolic references, but MC doesn't have these.  You want to use essentially [load(var)] where var contains "Artist" or "Composer", and MC would late evaluate load(var) to obtain "Artist or "Composer" and then later evaluate [Artist] or [Composer].

There's no problem loading variables in Set rules for file display.  This is how we do the Statistics generation.  The rules run essentially as no-ops with side effects.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #29 on: February 19, 2013, 11:27:12 pm »

Right.  What you're looking for is delayed evaluation of symbolic references, but MC doesn't have these.  You want to use essentially [load(var)] where var contains "Artist" or "Composer", and MC would late evaluate load(var) to obtain "Artist or "Composer" and then later evaluate [Artist] or [Composer].

Right, okay.  That's why I was momentarily excited.  I thought there was way, maybe.

That Statistics thread is cool.  I hadn't really looked at it before.  Thanks.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #30 on: February 19, 2013, 11:29:28 pm »

There is a way that's just as easy as all this - new custom fields! :-)  And here we are full circle.

Or maybe you can ask for parametrized user functions in MC19 or MC20.  :-)
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #31 on: February 19, 2013, 11:33:36 pm »

Or maybe you can ask for parametrized user functions in MC19 or MC20.  :-)

Hah.  That would be sweet, no?

Agreed.  I'm just going to stick with my current =[Artist Name Swap] and =[Composer Name Swap] methods and be done with it.  ;) ;D
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

AndyV

  • Recent member
  • *
  • Posts: 10
Re: Switching composer listings to "Lastname, Firstname"
« Reply #32 on: February 20, 2013, 02:11:29 am »

Why doesn't MC populate these fields when you rip in the first place?

I rip all my cds with dBpoweramp (to FLAC), it populates the tags ComposerSort, ArtistSort automatically. I added these sort fields to MC, the values get picked up fine, and they are very useful for getting Views to behave nicely. iTunes has similar Sort fields. Should they not be 'standard' MC tags?
Logged

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Switching composer listings to "Lastname, Firstname"
« Reply #33 on: February 20, 2013, 03:12:03 pm »

I've considered doing the same.

I haven't because what about file renaming via Rename, Move, and Copy Files?  What folder is MC going to use for that [Artist] value?  And if it is stupid and just dumps in the whole thing, then I'll have these silly folders strewn about my filesystem:

Bela Fleck ; Bela Fleck and the Flecktones
Bela Fleck
and probably
Bela Fleck and the Flecktones ; Bela Fleck


Even if it isn't dumb, and uses the first entry in the field, then it would still be somewhat random which one it would use unless I was careful to always use one of the shiny new list-sorting functions too.

So, I'd have to make a calculated field to get the proper artist name for file storage, and then use that in my Rename, Move, and Copy Files profiles.  But that's a pain, so it is the path of least resistance to just "nudge" the edge cases one way or the other.

I might change my mind at some point, but probably not.  It also makes "listings" on screen in Theater View more redundant.

Right now, for example, it doesn't matter that Crosby, Stills, and Nash only sometimes included Young (and were, IMHO, better without him), they all get filed under "Crosby, Stills, Nash, & Young".  If I feel like some CSN, I'm probably also okay with looking at CSN&Y too, so they get grouped.  If I was stricter, I'd have to remember which album is which (actually, easy for me in this case, but it is just an example) if I want to browse to a particular album easily.  I could do it with adding them both and using [Artist] as a List, but then I have to look at both CSN and CSN&Y in Theater View which contain just duplicates of one another (except for the random ones I forgot, so it would also be inconsistent).

So...

I don't know.  I waffle on it quite a bit, but I've continued to stick with a simpler [Artist] structure.

If you are going to use MC18 to rename or create folders based on Artist information, then you can use "Album Artist" and "Album Artist (Auto)" for that.   The folders should be created based on "Album Artist (auto)", and then when there is a List in Artist, and Album Artist (auto) is not the right one, just put it into "Album Artist" to get the right thing in the folder name.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #34 on: February 20, 2013, 06:31:00 pm »

If you are going to use MC18 to rename or create folders based on Artist information, then you can use "Album Artist" and "Album Artist (Auto)" for that.   The folders should be created based on "Album Artist (auto)", and then when there is a List in Artist, and Album Artist (auto) is not the right one, just put it into "Album Artist" to get the right thing in the folder name.

Hmmmmmm.....
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Switching composer listings to "Lastname, Firstname"
« Reply #35 on: February 21, 2013, 07:02:19 pm »

So, I'd have to make a calculated field to get the proper artist name for file storage, and then use that in my Rename, Move, and Copy Files profiles.  But that's a pain, so it is the path of least resistance to just "nudge" the edge cases one way or the other.
Actually Matt addressed this issue when Artist was changed to List:

I think it's reasonable to store stuff under the primary's artist folder.  So next build:
Changed: When building a filename from file information, only the primary / first artist or genre will be used from a list.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #36 on: February 21, 2013, 07:27:19 pm »

Primary is "first" I assume.  This time I was reading with my eyes closed.  Sorry.

Thanks for looking it up.  I would have been too lazy.

I don't know... Maybe.  You're making me waffle on it, that's for sure.  :P
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Switching composer listings to "Lastname, Firstname"
« Reply #37 on: February 21, 2013, 07:38:16 pm »

I'm not trying to retrieve the value of [Artist] in my imaginary fancy defaults-loading Smartlist, I'm only trying to make it so I don't have to remember to type =Save([Artist], Swapper) the first time before using [Name Swap], assuming that 95% of the time I want to use it on the [Artist] field.

I actually just thought of a simple way to do this, without having to worry about presetting the variables.

You could just test [Swapper] for an entry first, right?  And do basically: If(IsEmpty([Swapper]), Artist-based Expression, Variable-based expression)

I think that'd work.  You still have the issue of it remembering a specific Composer or whatever when you do it that way, though...  So, nah.  I'll stick to what I have.  I only need [Artist] and [Composer] anyway.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: Switching composer listings to "Lastname, Firstname"
« Reply #38 on: February 21, 2013, 07:43:00 pm »

Primary is "first" I assume.

Thanks for looking it up.  I would have been too lazy.

I don't know... Maybe.  You're making me waffle on it, that's for sure.  :P
Actually, I was thinking more about the [Artist] issue as a whole, and so I found and read that original thread where Matt asks for opinions on List data type for [Artist].  I just happened to note that his comment there was relevant to this thread.

It appears that MC17 uses the first entry in the [Artist] List whenever it needs one string - Album Artist (Auto) is another one.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Switching composer listings to "Lastname, Firstname"
« Reply #39 on: February 21, 2013, 08:04:31 pm »

Another technique occurred to me, regarding how you can use a single field to encode both the presentation name and the sort name.  If you add, when necessary, any desired sort name as the last entry in a field such as Artist:

   John Doe; Doe, John
   Dredd Zeppelin

then, you can always use the first name as our presentation and the last entry of the list as your sort order.  This will also provide both keys in a tree or list.
Logged
The opinions I express represent my own folly.

RSleith

  • Junior Woodchuck
  • **
  • Posts: 57
Re: Switching composer listings to "Lastname, Firstname"
« Reply #40 on: February 27, 2013, 08:00:50 pm »

Why doesn't MC populate these fields when you rip in the first place?

I rip all my cds with dBpoweramp (to FLAC), it populates the tags ComposerSort, ArtistSort automatically. I added these sort fields to MC, the values get picked up fine, and they are very useful for getting Views to behave nicely. iTunes has similar Sort fields. Should they not be 'standard' MC tags?

Hi

I use dBpoweramp also, but I do not see these tags. Is there an option within dBpowerabmp to enable these tags? Or if they are enabled by default, how does one view them (I downloaded some sourceforge software [tag, metaflac] but I do not see these tags)?

Many thanks,
Rod
Logged

RSleith

  • Junior Woodchuck
  • **
  • Posts: 57
Re: Switching composer listings to "Lastname, Firstname"
« Reply #41 on: February 28, 2013, 09:23:36 pm »

Hi

I use dBpoweramp also, but I do not see these tags. Is there an option within dBpowerabmp to enable these tags? Or if they are enabled by default, how does one view them (I downloaded some sourceforge software [tag, metaflac] but I do not see these tags)?

Many thanks,
Rod

Found it...
Logged
Pages: [1]   Go Up