INTERACT FORUM

Please login or register.

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

Author Topic: [key] for albums...?  (Read 2269 times)

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
[key] for albums...?
« on: July 18, 2015, 11:41:08 am »

I'm sure I remember this being asked before but I can't find the old thread

Wondering if anyone has a good way of assigning a [key] to a complete album?

I use a lot of expressions with variables (to calculate averages mostly) but because those variables only update with a smartlist, I'd love to eliminate the variables by using the new [# tracks] field, but of course I can only do that by somehow specifying what makes an album

Is this possible (without manually assigning a custom field to each album...or making an [album key] variable?)

If anyone happens to have that old thread bookmarked too

Thanks for any insight
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: [key] for albums...?
« Reply #1 on: July 18, 2015, 05:45:49 pm »

I'm unfamiliar with the thread you mention.  I'm also not super clear on what you're trying to do.  Could you give a little more detail about what you're trying to do?

For uniquely identifying an album I would think some sort of composite field would be the solution.  Something like [Album]-[Album Artist (auto)]-[Year] or something along those lines.

Brian.
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: [key] for albums...?
« Reply #2 on: July 19, 2015, 11:08:21 am »

Thanks Brian.  i use the "composite field" quite a bit

But...I'd like to be able to specify an album through one field, similar to how each file has a [key]...and I'd like it to auto assign an album "key" on import, which can't be done through variables (at least I don't know how to get the last number used and count up from there)

I know it's not a simple concept because MC can't know an album is actually complete, or what happens if you add a song...

im working on a variable based smartlist to fill a custom field for the existing stuff

Just for reference, I found that old thread.  A user (Fredele) had made a small Perl script that did the auto assignation to all the albums...unfortunately it didn't work quite right
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: [key] for albums...?
« Reply #3 on: July 19, 2015, 11:34:02 am »

There is an AlbumKey() function, but it doesn't do what you want.  It returns a composite key, as opposed to a unique integer.

http://wiki.jriver.com/index.php/Expression_Language#AlbumKey

I wonder though, even though it's not unique:  Would that help with your task?  I'm unclear as to why it's helpful to have a unique number for an album key, as opposed to the composite field returned by AlbumKey().

If you truly need a unique key, you could do something to make use of the first file's FileKey.  File Keys are unique across then entire corpus of files in your library, so it will certainly be unique per album.  You could do something like combine the [Album] field with the filekey of the first file.  But I'm unsure how you would tell JRiver to take the filekey of the first file in the album and then save that into a calculated field (like My_Album_Key).  In a procedural language, you would write a little bit of code to find the first file and then go from there.  I'm not sure how it would be done in MC.  Or even if my idea is workable.

I'll be curious to hear what you come up with on this.

Brian.
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: [key] for albums...?
« Reply #4 on: July 19, 2015, 02:12:07 pm »

Brian,

with all apologies, but since you've posted in my thread ;)

is there a way to arbitrarily iterate a regex search?  for example, if i want to pull out the album title but ONLY the first letters (so the Rolling Stones becomes tRS, Beggars Banquet becomes BB), but of course artist and album titles have an arbitrary number of words, so the same regex that matches tRS won't find tB for the Beatles, or TMBG for They Might Be Giants

i've found \b(\w) works to find the matches no matter how many, but it only captures the first match




Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: [key] for albums...?
« Reply #5 on: July 19, 2015, 03:53:38 pm »

^ Regarding the Regex:  I spent about 20 minutes trying to figure that out and now my head is swimming.  I was not successful.  :(

Sorry I couldn't help with that.

Brian.
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: [key] for albums...?
« Reply #6 on: July 19, 2015, 04:35:08 pm »

FWIW I've solved it with a nested ifelse(listcount(regex))) which picks the right regex based on the amount of space delimited words in the artist / album field.  It's unwieldy and requiring a few smart lists and tricks but I think it will work...

Thanks for the help!
Logged
Pages: [1]   Go Up