INTERACT FORUM

Please login or register.

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

Author Topic: Testing for [Varies]  (Read 7222 times)

ssands

  • Galactic Citizen
  • ****
  • Posts: 457
Testing for [Varies]
« on: October 08, 2015, 04:43:05 pm »

Hi all,

As I fine tune by Audio view, I would like to be able to test when a particular field = [Varies] and then choose a particular alternate field for Thumbnail text. In this case, at the album level, I want to test if the [Composer] field = [Varies].

I've tried a few different ways but I didn't get it to work.

Any ideas?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42444
  • Shoes gone again!
Re: Testing for [Varies]
« Reply #1 on: October 08, 2015, 04:56:37 pm »

An expression like this should work:
If(IsEqual([Comment], /[Varies/]), My Text Here!, [Comment])

That's testing the comment field, but just change it to the right field for your use.
Logged
Matt Ashland, JRiver Media Center

ssands

  • Galactic Citizen
  • ****
  • Posts: 457
Re: Testing for [Varies]
« Reply #2 on: October 08, 2015, 05:05:54 pm »

An expression like this should work:
If(IsEqual([Comment], /[Varies/]), My Text Here!, [Comment])

That's testing the comment field, but just change it to the right field for your use.
Thanks! I tried something similar, but must have done it wrong. I'll try tonight.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Testing for [Varies]
« Reply #3 on: October 08, 2015, 05:20:37 pm »

Wow, I totally misunderstood the question.

I thought you were asking how to find albums where Composer is different on at least 2 songs and then somehow change it to a single value.  I figured out how to find them, then I came back here and figured out you don't need that!  :)

Brian.
Logged

ssands

  • Galactic Citizen
  • ****
  • Posts: 457
Re: Testing for [Varies]
« Reply #4 on: October 09, 2015, 12:19:24 am »

Matt,

So I did try something similar to what you wrote and I can't get it to work.

I've attached two screen clips.
The first shows a clip of the tagging window where I am using your code (modified for the field I want).
The second shows the result.

I feel like I'm missing something really obvious, but don't know what it is. It seems to me that the expression ought to evaluate to true but I'm not getting that.

(and thanks, blgentry!)
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Testing for [Varies]
« Reply #5 on: October 09, 2015, 01:25:33 am »

I get the same result you do, "No" every time, regardless of which standard (existing) field I put the expression into. Using =If(IsEqual([Composer], /[Varies/]), My Text Here!, No)

Even when I created a new calculated User field called ComposerText and put the Expression into that, the answer came back as "No".

The IsEqual([Composer], /[Varies/]) expression always evaluates as "0", and never as "1". Same for modes 1, 7, and 8. i.e. =IsEqual([Composer], /[Varies/], 1)

It seems that the value [varies] isn't available to test as a string. Although if I use the expression =[Composer] in the comment field, then it is filled correctly with "[varies]".

A mystery. There must be something special about the [Composer] field in reference to an Album, where it summarises the values of each track. I thought it would work.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

ssands

  • Galactic Citizen
  • ****
  • Posts: 457
Re: Testing for [Varies]
« Reply #6 on: October 09, 2015, 02:21:15 am »

It seems that the value [varies] isn't available to test as a string. Although if I use the expression =[Composer] in the comment field, then it is filled correctly with "[varies]".

That is what I suspect also. I'm hoping Matt (or someone) will be able to provide a way to test for [Varies]. I suspect there is some underlying value and that is what needs to be in the test.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Testing for [Varies]
« Reply #7 on: October 09, 2015, 02:48:52 am »

There are a lot of fields that are filled with [varies] in lots of views, so I am interested to see what the answer might be. (That's why I stuck my nose in when I didn't know the answer.  ;D)
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: Testing for [Varies]
« Reply #8 on: October 09, 2015, 05:30:14 am »

i think it wont work with the tag window. Or that you can write it to an other library field, or even an expression in the library. the fields are one on one even when you change the amount of files selected. there are places though where it does work, like underneath a thumbnail. i used
If(IsEqual([composer], /[Varies/]), My Text Here!, [composer])
the output is in the screenshot

Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: Testing for [Varies]
« Reply #9 on: October 09, 2015, 05:36:59 am »

btw.. i think it is possible using global variables.  :P
http://yabb.jriver.com/interact/index.php?topic=72049.0
it might be a bit of a puzzle to get that to work though...

 :)
gab
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: Testing for [Varies]
« Reply #10 on: October 09, 2015, 07:36:34 am »

since i thought this was an interesting puzzleand i wanted to know i was right, i gave it a try. in the two screenshots you see a field called Comp test. this gives the composer when they are all the same for an album, and no when not.

this is how to do that.
make a smartlist and put this in there via import
Code: [Select]
[Media Type]=[Audio] [=save([composer],_Comp[album artist (auto)][album])1]=1 [=save(if(isequal([composer],Load(_Comp[album artist (auto)][album]),1),[composer],No),_Comp[album artist (auto)][album])1]=1
make a new library field and make it a calculated field. and put in there load(_Comp[album artist (auto)][album])

what does the smartlist do: first it looks only at audio. then it makes a global variable called _Comp with the composer filled in. then it checkes if its the first track and fills the composer in. in the next rule is checked if this is the same composer for that song of the same album.

there are a few things.. first im sure it could be done more elegant. i only know the old fashion way (and that is not only true for global variables :) ).
i dont file my albums as multiple disk albums, but just count the tracks up from the first song to the last. so when there are more disks it will complicate the smart list a bit, but not much.
you can change the 'no' in the smartlist, and you can change the [composer] field to any field you wanna check, but dont change the [composer] field in a string. if you want that just add an if etc expression to the new library field.

the expression should also always been run once you startup mc, or after you changed some. a way to do this is add the smartlist to rules of a view..

have fun
 :)
gab

edit.. i changed the smartlist rules to something more elegant.. :)

Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Testing for [Varies]
« Reply #11 on: October 09, 2015, 09:01:42 am »

ssands:  What are you trying to accomplish?  We have several different approaches to this, but they are mostly just guesses based on what each person thinks you are trying to do.

Gappie has showed what Matt was thinking:  Thumbnail text that's generated based on testing [Varies] in that section.  He's also shown a more advanced way of detecting different composers using variables.  I've got yet ANOTHER way of doing that, but without any global variables.

So.... give us some more info and maybe we can come up with a good solution. 

Brian.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42444
  • Shoes gone again!
Re: Testing for [Varies]
« Reply #12 on: October 09, 2015, 10:21:23 am »

This brought to the surface another strange issue that typing [Varies] in the edit would get eaten.

So next build that will be fixed:
Fixed: Typing the value [Varies] into a field for editing didn't work.
Logged
Matt Ashland, JRiver Media Center

ssands

  • Galactic Citizen
  • ****
  • Posts: 457
Re: Testing for [Varies]
« Reply #13 on: October 09, 2015, 11:54:05 am »

ssands:  What are you trying to accomplish? 
I have a situation where I have a classical compilation album. MC fills in [Composer] with the value [Varies], which is correct.
I'd like the thumbnail text to show the album name when it is classical and composer is [Varies]. Normally I sort by artist for Rock, but classical I sort by composer. For a compilation I'd just like to sort by album name.

Appreciate all the replies so far. Since I'm mobile I can't play (yet) with the suggestions above.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Testing for [Varies]
« Reply #14 on: October 09, 2015, 12:55:38 pm »

I propose that what you would like as a solution is to have [Album Composer] and [Album Composer (auto)].  These fields would function in a very similar analogous way to [Album Artist] and [Album Artist (auto)].

1.  [Album Composer (auto)] would be a calculated field that takes the value of [Album Composer] if it exists and if it doesn't it takes the value of [Composer].
2.  [Album Composer] would be a field that you fill in manually with whatever you want; just like you can with [Album Artist].

To start you off with nice populated values for [Album Composer], you would use the view (or smartlist) that Gappie provided to find all of your albums with more than one composer.  I have a version of this also, but I don't know if it's any better or worse than his.  Mine doesn't use global variables.

You would use this view or smartlist to find your multiple composer albums, and then fill in [Album Composer] with [Album] if that's what you want to standardize on.  You could selectively edit these if you wanted to; if [Album] didn't make sense in some circumstances; or even if you just felt like it for some titles.  The key point is that you can find all of your candidate albums and have a place to put the value that YOU want used for [Album Composer].

Since [Album Composer (auto)] will have values for everything in your library, you would then use this as the sorting and display field for your classical music.

I think this will give you what you want and a good degree of flexibility.

Brian.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Testing for [Varies]
« Reply #15 on: October 09, 2015, 07:11:06 pm »

I'm surprised not only that the original simple solution doesn't work, but also that people don't expect it to work in tags. After all, it is just an expression using values that are already in tags, and writing the result to a tag. Besides, one of my tests used a new Calculated User field which is slightly different, but still didn't work.

Actually I am less interested in the real requirement here than the MC capability, which I could apply to other requirements. As always, the simplest solution is always best, and the original expression applied to a tag would have been the simplest solution. I guess I am too used to working with databases, and the MC library isn't really a database, in the sense of Oracle, DBII, Progress, etc. Or maybe the value [varies] is in fact calculated on the fly for presentation on screen, and is never actually written to the tag.

For this requirement, Brian's suggestion is a good one. But it means adding another two tags/fields to MC, one of which is calculated for all records, for all users, rather than just calculating an expression for one user as per the requirement. Maybe lots of people would like to have the capability provided by the new tags/fields, but I think that smells a lot like software bloat.

This brought to the surface another strange issue that typing [Varies] in the edit would get eaten.

So next build that will be fixed:
Fixed: Typing the value [Varies] into a field for editing didn't work.

So will this change affect whether the original expression will work or not Matt?
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Testing for [Varies]
« Reply #16 on: October 09, 2015, 09:04:46 pm »

Makes sense to me, Varies isn't a value (like say multiple artists, which is a value).  It's a calculated display value which says X>1.  While I certainly don't know how the behind the scenes code works, it makes sense that the thumbnail text doesn't share the issue, as I assume that text is a string capture of [varies] and not the actual calculation.  If you type the value [varies] in any field, it's now a string and not a calculation so that should work to calculate on

Brian's suggestion is a good one, but really doesn't need any interference (or bloat as has been said) from MC IMO, it's a pretty simple expression field to make.  Unless of course you want it to share the special functions that album artist (auto) enjoys.  But of course, composer isn't supported by the majority of portable devices or any other programs so that functionality is only useful in the MC ecosystem anyways

The solution is not to test for [varies] but to actually test for X>1, which I can't think of how to do without variables
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Testing for [Varies]
« Reply #17 on: October 10, 2015, 09:37:52 am »

I'm surprised not only that the original simple solution doesn't work, but also that people don't expect it to work in tags.

Quote
Actually I am less interested in the real requirement here than the MC capability, which I could apply to other requirements. As always, the simplest solution is always best, and the original expression applied to a tag would have been the simplest solution. I guess I am too used to working with databases, and the MC library isn't really a database, in the sense of Oracle, DBII, Progress, etc. Or maybe the value [varies] is in fact calculated on the fly for presentation on screen, and is never actually written to the tag.

I agree with your general idea in computing that simple is best, consistent is best, and general functionality is better than specific add-on functionality.  I think that's what you were saying anyway.  :)

In this case, you're missing something about how MC's tagging works.  So it seems like it's broken, when in fact it's working exactly as it's supposed to.  Your last sentence above is the key:

Quote
Or maybe the value [varies] is in fact calculated on the fly for presentation on screen, and is never actually written to the tag.

As I understand it, [Varies] is just a display that tells you:  "This field has several underlying values for the files that are selected."  When you write an expression in *another* field and use it to test, it looks at EACH FILE INDIVIDUALLY.  The tests never see "[Varies]" because the tests are applied to every file and see the individual values for every file.  That's why putting something like "I really love [Album] don't you?" in a field works.  Because it sees the individual value for [Album] for each file and can substitute it.

The question then becomes, is there some way MC could be modified to test for [Varies] in an intelligent way that wouldn't break the existing functionality?  ...and would it be useful for more than just cases like this one?

Right off, I can't think of anything this would break.  But it seems like it would be weird to code it.  Though [Varies] is displayed now so...  It still seems like it would be some strange special case code to make this work in the Tagging Pane.  Would it be useful for other stuff?  Almost certainly.

Note that the original requirement of just showing something based on [Varies] does seem to work in an albums view.  Also note that to do any kind of sorting, etc, you would still need another field like I've suggested.  Unless I'm missing something.

Interesting problem and discussion.  :)

Brian.
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Testing for [Varies]
« Reply #18 on: October 10, 2015, 11:22:16 am »

Among others, I've requested the ability to add a "database entry" for albums (folders?) as well as files

This would eliminate the need for variables when doing math on albums (I.e. Album DR) but would also "solve" this and any other [varies]

On the surface it seems easy since an album can already be tested for completeness, but as an amateur hobbyist coder I've fallen into the "it seems easy" trap a lot :)
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Testing for [Varies]
« Reply #19 on: October 10, 2015, 06:40:16 pm »

As I understand it, [Varies] is just a display that tells you:  "This field has several underlying values for the files that are selected."  

Yep I actually understand the concept of a temporary value used for display which isn't stored and therefore can't be queried.

However I thought the expression should work for two reason:
1. Matt suggested the expression. He is the man. If the contents of the field wasn't available to query, then he should know.
2. Putting =[Composer] into the [Comment] field, for example, returns the result of [Varies], the same as the [Composer] field. So the value can be queried. But it seems not from an expression. Maybe the code behind the [Composer] field is being copied to the [Comment] field when I do that.


Maybe it is just because there is no database record for an Album, and all info on an Album is just an accumulation of info from the files.

Hey Matt, please educate us!
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: Testing for [Varies]
« Reply #20 on: October 12, 2015, 04:11:12 am »

Yep I actually understand the concept of a temporary value used for display which isn't stored and therefore can't be queried.

However I thought the expression should work for two reason:
1. Matt suggested the expression. He is the man. If the contents of the field wasn't available to query, then he should know.


Maybe it is just because there is no database record for an Album, and all info on an Album is just an accumulation of info from the files.

Hey Matt, please educate us!

well the expression does work. the original question was about thumbnail text. you can do it on some other places also..
Quote
2. Putting =[Composer] into the [Comment] field, for example, returns the result of [Varies], the same as the [Composer] field. So the value can be queried. But it seems not from an expression. Maybe the code behind the [Composer] field is being copied to the [Comment] field when I do that.
no, the value varies is not queried. when you put =[Composer] in the comment field it just copies all the values from every file selected from the composer fields to the comment field. the [varies] is not copied because it is not a value, it is just telling you that for the files selected that value is not the same for every file in other words, Varies.

Quote
Actually I am less interested in the real requirement here than the MC capability, which I could apply to other requirements. As always, the simplest solution is always best, and the original expression applied to a tag would have been the simplest solution. I guess I am too used to working with databases, and the MC library isn't really a database, in the sense of Oracle, DBII, Progress, etc. Or maybe the value [varies] is in fact calculated on the fly for presentation on screen, and is never actually written to the tag.
mc is a real database, and actually fairly flexible. its not a relational database though, as the ones you mentioned (search the forums and you will find some threads with discussions about this). but that is uninteresting in this case because in all cases the databases would give you the output [varies]. you could see it as calculated on the fly, but in the end it just tells you the value varies for the fields selected. that is how databases work.

 :)
gab 
Logged
Pages: [1]   Go Up