INTERACT FORUM

Please login or register.

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

Author Topic: Some questions on using expressions to control file locations  (Read 986 times)

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231

I have a couple of related questions so I am posting them as one thread rather than multiple...

Lets say I want to include discnumber in the destination when ripping if the field is present, i.e. artist\album\discnumber

is this the correct way?

[Artist]\[Album]ifelse(!isempty([disc #]), \[disc #])\

i.e. I don't have to enclose the expression in a block of some kind to tell it "evaluate this expression, include the results" & I don't have to do anything special to concatenate strings.

Taking that a step further, what if I want different paths for a TV Show vs a film? It doesn't seem like I can tell it the media subtype until after the rip completes which then means it is in the "wrong" place. Do I have to then manually go into library tools/move and sort it out or is there a setting I'm missing to set the subtype and then include an appropriate set of ifelse blocks in the rip path expression?

Finally there is no switch/case type statement here is there?

Thanks
Matt
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: Some questions on using expressions to control file locations
« Reply #1 on: May 10, 2014, 07:54:52 am »

I would probably use:

[Album Artist (auto)]/\[Album]Delimit([Disc #,0],,/\)/\
 
Delimit()
IsEqual()

Code: [Select]
If(IsEqual([Media Sub Type], TV Show, 0),/\TV/\,
If(IsEqual([Media Sub Type], Movie, 0),/\Movies/\,
/\Other/\))

In plain English, what the rule is doing, is:
 
If [Media Sub Type] is equal to "TV Show", output \TV\
If [Media Sub Type] is not equal to "TV Show", but is equal to "Movie", output \Movies\
If [Media Sub Type] is not "TV Show" or "Movie" output \Other\
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Some questions on using expressions to control file locations
« Reply #2 on: May 10, 2014, 10:50:49 am »

Finally there is no switch/case type statement here is there?

You might want to use IfElse to most closely approximate a switch/case statement:

IfElse(
   IsEqual([Media Sub Type], TV Show), \/TV/\,
   IsEqual([Media Sub Type], Movie, 0), /\Movies/\,
   1, /\Other/\
)

i.e. I don't have to enclose the expression in a block of some kind to tell it "evaluate this expression, include the results" & I don't have to do anything special to concatenate strings.

That's correct.  You can think of the expression language as a string-based, token/macro replacement language of sorts.

Taking that a step further, what if I want different paths for a TV Show vs a film? It doesn't seem like I can tell it the media subtype until after the rip completes which then means it is in the "wrong" place. Do I have to then manually go into library tools/move and sort it out or is there a setting I'm missing to set the subtype and then include an appropriate set of ifelse blocks in the rip path expression?

It depends on how you rip.  If you use MC to do any ripping, you can set tags before the rip and these tags get carried forward to the physical files.  (The tags you do pre-rip affect the normally hidden entry in the CD database; your ripped assets are in the Main database).
Logged
The opinions I express represent my own folly.

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Some questions on using expressions to control file locations
« Reply #3 on: May 10, 2014, 11:37:44 am »

Ah that's great, I didn't realise you could just tag the discs like that. It's perfectly logical really but I think I am conditioned not to expect a piece of media software to behave logically :)
Logged
Pages: [1]   Go Up