INTERACT FORUM

Please login or register.

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

Author Topic: Import Configuration Expression  (Read 865 times)

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Import Configuration Expression
« on: January 10, 2021, 01:57:31 pm »

I'm trying to apply a specific [Genre] tag to files imported from a particular folder, one that corresponds to various tagging views I have. The problem I've having is that if a genre tag is already present, I'll get a dual genre separated by a semicolon, e.g., "Classical;Tagging," "Tagging" obviously being the tag I want to add to what is being imported and "Classical" being the already present genre tag.

This expression would seem to work (it does in Zelda on already imported files):

Code: [Select]
Replace([Genre],[Genre],Tagging)

Can one not overwrite tags on import but only add to them? Or is there something I'm not thinking of (likely)?

I did try a two-step [Genre] overwrite by first putting this rule into the dialogue

Code: [Select]
IfElse(!isempty([Genre],0),RemoveCharacters([Genre],[Genre],0))

and then trying to simply insert [Genre] as a second rule underneath the ifelse(). The result was the same: "Classical;Tagging."

Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Re: Import Configuration Expression
« Reply #1 on: January 10, 2021, 02:07:10 pm »

Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Import Configuration Expression
« Reply #2 on: January 10, 2021, 02:59:36 pm »

I haven't played with auto import that much but did you already just try to hardcode genre on auto import config?
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Import Configuration Expression
« Reply #3 on: January 10, 2021, 03:30:57 pm »

@lepa, yes, tried that first and got the list I noted.

From Jim's suggestion of looking at the Wiki, which I am now, I'd forgotten [Genre] is a list field, so that's likely where the issue lies. I'd think, however, if I removed the [Genre] tag that came with the file as it comes into MC and then tried the hardcoding it would work; but again, I end up with "Classical;Tagging" when doing it that way.

Still using Jim's suggestion and going through the wiki (and through one of glynor's tutorials), however, and hopefully will find something.
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Import Configuration Expression
« Reply #4 on: January 10, 2021, 03:55:50 pm »

So found this on the wiki:

Quote
List Type Fields
If you add a Tag on Import rule that applies a value to a List Type field, such as [Keywords] or [Genre], the value will be added to any existing value rather than replacing the value already there (from an embedded ID3 tag, for example).

Using Expressions in Rules
The simplest Tag on Import rules apply the exact same tag value to every file imported from the selected folder. This is occasionally useful if the folder in question contains only certain types of files. However, it is often useful to apply a value to the field only conditionally based on some other characteristic of the file. For example, you might want to set the [Genre] to "Kids" only if the file imported is an episode of Dora the Explorer.

This is actually easy to do! The Value field in the Tag on Import rule dialog can be set to an Expression, using any of the features of the expression language. So, to accomplish the example given above, you check to see if [Series] tag already contains "Dora the Explorer", and then apply the tag if it does. Like this:

Can expressions override list type fields? Given the above, I'm not sure. Seems like one could, given the genre example example used under "Using Expressions in Rules," but maybe MC is set up so that we can't, even with an expression? At least I'm not able to, though of course, being pretty green at the expression language, I'm quite likely to have something wrong.
Logged

EnglishTiger

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1090
Re: Import Configuration Expression
« Reply #5 on: January 10, 2021, 10:52:34 pm »

Tim - If your view is set up to look for Genre = Tagging then until somebody can tell you how to set the Genre to Tagging on Import see if changing the parameter for the View to Genre contains Tagging allows you to do whatever it is you want to do to those tracks/files.
Logged
Apple Mac Mini Desktop Computer with M4 Pro chip with 12 core CPU and 16 core GPU: 24GB Unified Memory, 512GB SSD Storage, Gigabit Ethernet, 3 Thunderbolt5 + 2USBC ports.

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Import Configuration Expression
« Reply #6 on: January 11, 2021, 02:37:40 am »

The tags you specify on Folder Import are always *added* to the file. The file itself may contain other embedded tags such as Album Name, Genre, Track number, etc. These are also imported, and combined to the tags you manually specify. This is why you get 2 genres - one that you specify, other that the file contains on ID3 tag or similar. You can't enter any expression to remove the other tags during importing.

I think there's no option to tell MC to disregard the file tags. With such an option, however, you would also lose all other imported info, not just Genre.

To fix the tags after import, just select all the files you want and manually enter "Tagging" on the Genre field of Tag editor to change them all in a single step. No expression is needed.
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Import Configuration Expression
« Reply #7 on: January 11, 2021, 08:29:46 am »

@Zybex, yes, long time user of MC, so I know a lot about post-import tagging, but I was trying to simplify some basic tagging via the import process. Thanks for the clear explanation of tagging-on-import (which I'd never used before) though!
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Import Configuration Expression
« Reply #8 on: January 11, 2021, 12:15:57 pm »

@Zybex, yes, long time user of MC, so I know a lot about post-import tagging, but I was trying to simplify some basic tagging via the import process.
You can create a new, expression based library field, named anything you like, using the simple expression =[Genre].
Next, Create an Auto-Import rule that fills this new field with whatever it is you require, Tagging?

This value will be pushed to the regular [Genre] field, replacing whatever, if anything, is already in there.

Bear in mind that this calculated field has only one, auto import purpose, so do not show it anywhere else in your views or tag window unless you are sure you can do so without causing confusion.

-marko

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Import Configuration Expression
« Reply #9 on: January 11, 2021, 03:18:47 pm »

Thanks, marko! That sounds like what I'm looking for! Will try it out posthaste.
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Import Configuration Expression
« Reply #10 on: January 12, 2021, 12:20:02 pm »

Worked perfectly! Thanks again marko!
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Import Configuration Expression
« Reply #11 on: January 12, 2021, 02:00:53 pm »

You're welcome. Stay safe.
Pages: [1]   Go Up