INTERACT FORUM

Please login or register.

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

Author Topic: Avoiding doubles [name] - [series] to be displayed  (Read 1027 times)

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Avoiding doubles [name] - [series] to be displayed
« on: September 06, 2019, 05:14:59 am »

Great day all,

Specific question, TV Recordings related but it's a general topic to me:

What would be the expression to compare and make sure two fields, in my case the [Name] and [Series] fields having different values.
More detailed: I'm using both these fields to label TV Recordings.
Sometimes the broadcoaster sends the same value for the programtitle [=name] and as series aswell.
It looks not so cool when p.e. the Recording shows The Simpsons - The Simpsons.

Even in extension to the above it would like to to the following:
if the check comes out as identical the [Date Recorded], but without the time notification, field would be used instead of the program name.
So instead The Simpsons - The Simpsons it would display The Simpsons - 3 September 2019.

Thanks in advance,
Appreciated.
Logged

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #1 on: September 07, 2019, 08:23:28 am »

I made it work like this, guessing not the most elegant way:

[Series]
if(isequal([Name], [Series], 1), [Date Recorded dd MM yyyy], [Name])

And using a new/custom field called [Date Recorded dd MM yyyy] in order to get rid of the time notification inside the [Date Recorded] field.
This by using the following expression it:

formatdate([date imported,0],dd MM yyyy)

Now trying how the make this also work in Theater View .... Anyone any pointers?

Setting up Theater View is much different to Standard, would be great to have some kind of matrix where you select which rules are used and leading/copied towards other Views.

Maybe MC offers such 'constant' customizing already, could somebody point me out how to do.

Thanks !
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #2 on: September 07, 2019, 11:41:49 am »

Looks like you pretty much figured out the basics. If(IsEqual()) is pretty much the way to go with this kind of task. To make sure you were aware, you could, of course, have embedded the date formatting right within your expression like:
if(isequal([Name], [Series], 1), formatdate([date imported,0],dd MM yyyy), [Name])

You asked about making "constants". I suspect you meant saved expressions, but in any case, that's exactly what you did. If you have a complex expression (generally one you need to use in a bunch of different places) the answer is to make it into a custom field, just as you did there with your [Date Recorded dd MM yyyy] field. If you truly meant a constant, you could do that too. Make a custom field called [Pi] with:
Data Type = Decimal
Edit Type = Cannot be edited
Calculated Data = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620 8998

Then you can just use [Pi] in your expressions or wherever you need to insert that value.

These threads are quite old, but are still pretty much valid (and describe systems I use to this day, with some modifications). They aren't explaining exactly what you're looking to do, but it should give you an idea of how fields can be used along with customizing views to give you control over what is displayed (and how) in both Standard and Theater Views:
https://yabb.jriver.com/interact/index.php/topic,85974.0.html
https://yabb.jriver.com/interact/index.php/topic,107140.0.html

You basically have two options with your core issue: (1) change the way it looks in MC when these file types display, or (2) fix the "regular" fields when you import (or record) them.

The problem with #1 is that you're going to have to change all of the Views everywhere to accommodate your "on the fly reformatting". It is usually better therefore to attempt #2. So, instead of changing what is displayed in your views, you simply change [Name] (or whatever) tag at the time of import. You may already be doing this from your post, but to make sure you've seen it: https://wiki.jriver.com/index.php/Tag_on_Import

In particular, check out the "formatted version of Date Created for a news program" in the Examples section.
Logged
"Some cultures are defined by their relationship to cheese."

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

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #3 on: September 08, 2019, 03:12:15 am »

Mandy thanks Glynor !

MC does offer sooooo many features and ways of customizing  ;D
Logged

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #4 on: September 09, 2019, 07:20:27 am »

Great day Glynor,

Another thanks for your feedback,

If you don't mind, I've got another challenge on an expression:

-Evaluation of a field. This specifically to search and divide by ":" and/or "-" markings which are within a specific field.

I've been searching for a evaluation and splitting expression, but not sure how it's done.
I thought by using the delimiter but can't find the correct expression for the following:

FYI my EPG sends quite often the name of the series followed by the program title as the program title.
P.e. The Simpsons : Lisa goes to school.
P.e. The Simpsons - Lisa goes to school.

So ideal I'm left with only "Lisa goes to school" as the program name. And "The Simpsons" as series tag.

Thanks again to all of you !
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #5 on: September 09, 2019, 10:33:21 pm »

Don't do it that way (all in one step). Make two Tag on Import rules:
Field: Series
Value: If(IsEqual([Name],Simpsons,8),The Simpsons,[Series])

That'll set the series if it finds "Simpsons" anywhere in the current [Name] field.

Make sure that one comes first in your list of Tag on Import rules (they're processed in-order). Then, since the [Series] is already filled, you don't need to "keep" the text at the beginning of the [Name] field and send it anywhere, you just need to remove it. So, make another one to do that:
Field: Name
Value: If(IsEqual([Series],Simpsons,8), ListItem([Name], 1,/ -/ ),[Name])

ListItem() will let you use any string of text as a List, and specify what delimiter to use, and then lets you pick out the particular item you want. So, that ListItem() function above "splits" the input string up at " - " into a list of items, and then spits out item I want. Item 1 corresponds to the second item in the list in this case because the list's index is zero-based (it starts at 0, then 1, then 2, and so on). The forward slashes in the delimiter argument are escape characters. They make the expression engine not ignore the whitespace around the dash, so that it is testing against " - " and not just "-" (which would catch hyphenated words in the episode title).

If your EPG is really not consistent about whether it prefixes it with a colon or a dash, but if the prefix is always the same length, it might be easier to just do:
Field: Name
Value: If(IsEqual([Series],Simpsons,8), RemoveLeft([Name],15),[Name])


If you need to, you could get really fancy with the ListItem() expression call, and do a thing where you use FirstNotEmpty() to detect what delimiter was used. I didn't test it, but I think this would work (barring a misplaced comma or parenthesis):
Field: Name
Value: If(IsEqual([Series],Simpsons,8), FirstNotEmpty(ListItem([Name], 1,/ -/ ),ListItem([Name], 1,/ :/ ),[Name]),[Name])


Each item that FirstNotEmpty() tests would be empty if the delimiter isn't found at all, since you're extracting the second value from the string (if it doesn't find the delimiter, FirstNotEmpty() dumps everything out as index 0). Then, if neither of them match, it just gives up and dumps out [Name]. If you need to add additional possible delimiters to look for, you can just add more ListItem() elements to the pattern above, and keep [Name] as the last fallback.

If you had to do it on the first value, you'd have to do more wizardry and test for the existence of the delimiter substring first, but even that could be done I think. FirstNotEmpty() is super-cool.
Logged
"Some cultures are defined by their relationship to cheese."

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

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #6 on: September 10, 2019, 04:00:59 pm »

Super !

Quote
FirstNotEmpty(ListItem([Name], 1,/ -/ ),ListItem([Name], 1,/ :/ ),[Name]),[Name])
Does the job perfectly.
I did some tests and created a second one for the Series field as well and the splitting works great.

Thanks again Glynor.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #7 on: September 10, 2019, 04:44:11 pm »

No problem. Glad it is working for you!

By the way, one other little tip. For the Tag on Import rule that sets the [Name] field to the Date when it is otherwise just a useless duplicate of the [Series]?

I'd recommend using [Date Created,0] instead of [Date Imported,0]. The benefit of [Date Created] is that it is going to be locked to the date (and time) the episode was actually created, rather than the somewhat random time that MC imported the file. The import is going to be, of course, typically right after the file finishes recording, but there could be exceptions (maybe Auto-Import is turned off for some reason, or whatever). Whereas [Date Created] is always going to be filled with the date and time the file was originally created (which should correspond with the air date/time and make looking up the details easier if needed).

I'd use:
Field: Name
Value: if(isequal([Name], [Series], 1), FormatDate([Date Created,0],yyyy-MM-dd HH:mm), [Name])


That'll output: 2019-09-10 13:30 for a file which started recording today at 1:30pm. You could modify it for 12-hour time format too, if you prefer of course.
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: Avoiding doubles [name] - [series] to be displayed
« Reply #8 on: September 10, 2019, 10:51:23 pm »

Oh yeah, and if you didn't know. Tag on Import will fix any new stuff you import or record, of course, but won't help you at all with your existing stuff. But, once you have the expression, you can also apply it directly to files in your Library.

0. Make a Library Backup.
1. Select a pile of files. They don't all have to be from the same "grouping" (Series or whatever), but I'd try a few before you do a bunch to make sure your expression-fu is up to snuff.
2. Open the Tag Action Window, and edit the field you want to set (the same one you'd have picked for the Tag on Import setup).
3. Paste in =Expression. For example: Edit the Name field and paste in the expression we just discussed, prefixed with =, and it'll go through and apply that expression (fixing your errant tags) to everything you have selected.

This is super-useful in everyday tagging situations too. I love doing stuff like selecting the name field and pasting in: =Episode Counter() to tag episodes without names to "Episode 1", "Episode 2", etc.
Logged
"Some cultures are defined by their relationship to cheese."

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

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #9 on: September 11, 2019, 03:01:27 am »

Greatday Glynor !

Exactly what i did :-)

So my complete lib is corrected now and future tags will be automatically corrected aswell :-)

Really amazing to find out how powerfull MC is !

Another thanks and cheers Glynor !
Logged

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: Avoiding doubles [name] - [series] to be displayed
« Reply #10 on: November 19, 2019, 03:27:46 am »

Great day Glynor,

I've got another question to you sir, based onto an earlier post from you/solved with your help,

i did posted a new topic on it, no rush :-)
Please see the post as below;

Quote
Instructions
You need to add 3 new fields to MC, via the Library Fields Manager.

1. [Date Imported (Editable)] - this is an editable version of [date Imported]. It will remain blank unless manually modified.

set the following:
Field Type: User data
Data Type: Date

2. [Date Added (raw sortable)] -
This will spit out "raw" dates meaningless to a human when displayed in a column, but you CAN sort using them. By default it will show the raw date form of [Date Imported] unless you modify [Date Importable(editable)], in which case it will return the modified value.

  Set the following:
Field Type: Calculated data
Expression Code:
ConvertDate(FirstNotEmpty([Date Imported (Editable)],[Date Imported]))

3. [Date Added] - this is a 'display' only field to convert raw sortable date to a human friendly conventional appearance

 Set the following:
Field Type: Calculated data
Expression Code:
FormatDate([Date Added (raw sortable)], DateTime)

I'm using the above additional fields and did a perfect job till lately.
Guessing something is handled differently or something i changed is causing the following :-)

With all recent cd rips (within MC) I'm getting 'varies' as [Date Imported] data.
So those aren't helpfull on sort, as also the [Date Added (raw sortable)] field is affected, and needs everytime correction via the 'edit' field.
I've looked to the lib fields but I'm not able to select 'single value per album' on these.

Surely I'm missing something, would be great to have some pointer :-)

Thanks and cheers !
Logged
Pages: [1]   Go Up