INTERACT FORUM

Please login or register.

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

Author Topic: Core Command - Set a tag based on another tag field.  (Read 709 times)

cowboydude99

  • Junior Woodchuck
  • **
  • Posts: 66
Core Command - Set a tag based on another tag field.
« on: November 23, 2022, 02:13:26 pm »

Hi there,
I am looking for some help/ideas on how to accomplish setting a tag in one field, based on the results of another.

I have a field called 'Audio Codex Play', which tells MC what codec video to play when I use 'ShowTime'.

I manually populate this field with "Dolby Atmos" or some other codec depending on the source audio codec.

I get this information by running SoT (Swag of Tools) to get the media info.
-Running this adds the codec to the end of the Compression field in MC.

If the compression field contains 'Atmos', I want to automatically set the Audio Codex Play tag to "Dolby Atmos".

Does MC have a core command or some other way to query and write tag values?
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Core Command - Set a tag based on another tag field.
« Reply #1 on: November 23, 2022, 03:50:29 pm »

You could e.g. make your 'Audio Codex Play' field a calculated field with rule

Code: [Select]
if(IsEqual([Compression],atmos,8),Dolby Atmos,)Meaning if compression field has string atmos then show Atmos. This is just an example and rule can be expanded to show also other stuff sourced from Compression field or from more SoT scraped mediainfo fields
Logged

cowboydude99

  • Junior Woodchuck
  • **
  • Posts: 66
Re: Core Command - Set a tag based on another tag field.
« Reply #2 on: November 30, 2022, 02:18:29 pm »

Hi!  Thank you.

Is there a reference I could read through to expand this function?

I have multiple IF statements, but I'm not sure how to get this to work.  Missing character or something?
if(IsEqual([Compression],+atmos,8),Dolby Atmos,)
if(IsEqual([Compression],truehd,8),Dolby TrueHD,)
if(IsEqual([Compression],ac3,8),Dolby Digital,)
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Core Command - Set a tag based on another tag field.
« Reply #3 on: November 30, 2022, 03:39:19 pm »

You may use ifelse structure here:

IfElse(
    IsEqual([Compression],+atmos,8),
        Dolby Atmos,
    IsEqual([Compression],truehd,8),
        Dolby TrueHD,
    IsEqual([Compression],ac3,8),
        Dolby Digital
)

https://wiki.jriver.com/index.php/Conditional_Functions#IfElse

You could achieve the same with If structure but it would be a lot messier

I'm personally saving audio codecs to custom field "Audio Formats (MediaInfo)" instead of compression as MC only shows first tracks codec and also because that "+atmos" disappears from compression field if you do update from tags
Logged

cowboydude99

  • Junior Woodchuck
  • **
  • Posts: 66
Re: Core Command - Set a tag based on another tag field.
« Reply #4 on: December 01, 2022, 12:44:29 pm »

Thank you.  If it isn't too much trouble, can you tell me how you saved the output from MediaInfo into a field, I'd appreciate it. 

If not, that's OK.  The IF logic you provided is working as I need it!
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Core Command - Set a tag based on another tag field.
« Reply #5 on: December 01, 2022, 01:30:34 pm »

I'm using MCUtils but in SoT it would mean adding mapping to text box fron top to bottom:
Audio Languages (MediaInfo)
Format
Audio

You need to of course create "Audio Languages (MediaInfo)" field in MC.

Your above mapping to text expression will be then somewhat more complex as it needs to handle multiple audio types especially if you want to pretty print more codecs than your current expression does
Logged

cowboydude99

  • Junior Woodchuck
  • **
  • Posts: 66
Re: Core Command - Set a tag based on another tag field.
« Reply #6 on: December 01, 2022, 01:45:51 pm »

Here's the final statement:
IfElse(
    IsEqual([Compression],+atmos,8),
        Dolby Atmos,
    IsEqual([Compression],+dts:x,8),
        DTS X,
    IsEqual([Compression],truehd,8),
        Dolby TrueHD,
    IsEqual([Compression],dts-hd,8),
        DTS-HD MA,
    IsEqual([Compression],DTS,8),
        DTS,
    IsEqual([Compression],eac3,8),
        Dolby Digital,
    IsEqual([Compression],pcm,8),
        Dolby Atmos,
    IsEqual([Compression],ac3,8),
        Dolby Digital,
    IsEqual([Compression],aac,8),
        Dolby Digital
)


Thanks for the SoT info and all of your help... it is working now! 
Logged
Pages: [1]   Go Up