INTERACT FORUM

Please login or register.

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

Author Topic: Reverse [Actors] Name Order  (Read 2862 times)

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Reverse [Actors] Name Order
« on: April 27, 2013, 09:40:33 pm »

MrC... You helped craft an expression to smartly reverse the name order for [Artist] and [Composer] and other similar things.  I'd like to make an Expression Field that does the same thing for [Actors].  The data that comes back from TMDB is, of course, in the format Firstname Lastname, and I want to add a category to Theater View where it is shown as Lastname, Firstname.

The problem is, that [Actors] is a semicolon delimited list of strings, which doesn't work with the expression from that other thread.

It should be possible to do, I'd think, but the issue is that I don't know how many entries each file's tag contains (they vary).  Any help?
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: Reverse [Actors] Name Order
« Reply #1 on: April 27, 2013, 09:44:30 pm »

I'd also like to handle [Director].  Of course, if one is possible, so is the other...
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: Reverse [Actors] Name Order
« Reply #2 on: April 28, 2013, 12:33:51 am »

We don't have a way to massage arbitrary numbers of elements via RE's, and have no global substitution, so there's no general way to handle this.  A few items can be handled (albeit, painfully).
Logged
The opinions I express represent my own folly.

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: Reverse [Actors] Name Order
« Reply #3 on: April 28, 2013, 03:11:09 am »

Would it be possible to count how many are in that field (or pick a safe number), process it all for that amount and then clean up the empty values afterwards?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Reverse [Actors] Name Order
« Reply #4 on: April 28, 2013, 08:30:14 am »

We don't have a way to massage arbitrary numbers of elements via RE's, and have no global substitution, so there's no general way to handle this.

Bummer.  I thought that might be the case.

You can count the number of items in a List, and you can extract a given numbered item, but I can't think of a good way to iterate across the list without any looping functions.  I'd hoped there was a way to do it with some kind of recursive expression but that I was too numb to figure it out.
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: Reverse [Actors] Name Order
« Reply #5 on: April 28, 2013, 10:47:03 am »

If you wanted to export / import, we could do this.
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Reverse [Actors] Name Order
« Reply #6 on: April 28, 2013, 12:02:05 pm »

If you wanted to export / import, we could do this.

Yeah, I thought of that.  I want it "ongoing" though.

I could relatively simply write a small applet that would parse the [Actors] field and write the [Actors (Reversed)] field live (without import/export) via the COM interface.  The problem is that these get tagged automatically as they import. I could certainly auto-run them through my external processing command after import.  But then if I lookup any manually (say they didn't auto-tag properly, or I tweak the tagging somehow and redo the lookup), then they'd get out of sync with the "scripted reverser".  The only way to avoid that would be to have my applet re-process all [Actors] tags across the whole library each time (or compare the current contents, which would be the same thing, basically).  Maybe you could store a quick hash of the current contents of the field and compare to speed it up, but you'd still have to check all the files in the Library.

If I wrote a plugin, I could probably catch the tagging event and check it to see if it impacted a field I want to reverse, but...

All of that's way too much effort for something I'd only use occasionally.
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: Reverse [Actors] Name Order
« Reply #7 on: April 28, 2013, 12:18:07 pm »

Exactly, there are no easy solutions currently outside of mass import/export or plug-in processing.

It's time to apply the thumbscrews wrt. feature #1 on the MrC: MC Feature / Fix List (beta thread).   :)
Logged
The opinions I express represent my own folly.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re: Reverse [Actors] Name Order
« Reply #8 on: April 29, 2013, 03:49:43 pm »

Maybe an expression like Order(...) with modes:

Order([Artist], NameLastFirst) // Ludwig van Beethoven > Beethoven, Ludwig van
Order([Artist], ArticlesLast) // The Beatles > Beatles, The
Order([Artist], Normalize) // Beethoven, Ludwig van > Ludwig van Beethoven; Beatles, The > The Beatles
Logged
Matt Ashland, JRiver Media Center

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Reverse [Actors] Name Order
« Reply #9 on: April 29, 2013, 04:46:54 pm »

Seems useful, but difficult to implement reliably maybe?  Will it be able to handle artists such as:

   4 Non Blondes
   Ablaye Cissoko & Volker Goetze
   Ace of Base
   Alejandro de Pinedo
   Blu Lu Barker
   Nusrat Fateh Ali Khan

Seems like you'll need a very large artists table.  Or perhaps you're thinking it will be selectively employed by users to populate an Artist Sort field (from Artist).
Logged
The opinions I express represent my own folly.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re: Reverse [Actors] Name Order
« Reply #10 on: April 29, 2013, 04:55:36 pm »

It would have basic rules.

If you have exceptions, it would be your problem.

For actors, it would be quite reliable.
Logged
Matt Ashland, JRiver Media Center

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Reverse [Actors] Name Order
« Reply #11 on: April 29, 2013, 04:56:29 pm »

Maybe an expression like Order(...) with modes:

Order([Artist], NameLastFirst) // Ludwig van Beethoven > Beethoven, Ludwig van
Order([Artist], ArticlesLast) // The Beatles > Beatles, The
Order([Artist], Normalize) // Beethoven, Ludwig van > Ludwig van Beethoven; Beatles, The > The Beatles

Something like this would be incredibly handy.  It would reduce our reliance on MrC's RegEx wizardry, for sure.  ;)
Logged
"Some cultures are defined by their relationship to cheese."

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

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Reverse [Actors] Name Order
« Reply #12 on: April 29, 2013, 05:50:18 pm »

It would have basic rules.

If you have exceptions, it would be your problem.

I am not sure how useful that would actually be for music, with a lot of Order, New & Division, Joy & Halen, Van in my collection.

Would it work on lists as well? If so, it might be worth doing =Order(...) in a custom field and see how many manual corrections would be needed.

How would artist images work with such function?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re: Reverse [Actors] Name Order
« Reply #13 on: April 29, 2013, 06:35:13 pm »

How would artist images work with such function?

It would be a bad idea to actually store your main Artist column backwards (as opposed to doing it at display time for some purpose).
Logged
Matt Ashland, JRiver Media Center
Pages: [1]   Go Up