INTERACT FORUM

Please login or register.

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

Author Topic: Expression Question  (Read 572 times)

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Expression Question
« on: June 08, 2020, 11:15:36 pm »

I'm wondering if this is possible via expression language in MC or if it's problematic because MC doesn't have a relational database.

Problem: I have a lot of classical albums that have [Disc #] filled with a 1 but which have no second, third, etc. album.

What I want to do: create a smartlist or maintenance view where I can see all those albums and delete the unneeded 1 because though I try to catch them when I tag, I miss some.

What I've tried: I created an expression like this for maintenance view:

Code: [Select]
If(isrange([Disc #], 1-1), Delete the disc #, Disc #'s are OK)
but obviously I get all albums containing a [Disc #] 1, whether they have a 2, 3, etc. or not. The search needs to be by album and not just by tracks--that is, for a given album, if there's a disc #, does it only go up to 1--so that's why I'm wondering if this is a database limitation or not, as I've run into this trying to do similar kinds of operations in the past. Or is there another way to tackle this I'm not seeing?
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Question
« Reply #1 on: June 09, 2020, 12:08:28 am »

[Total Discs] is the field you should start with. It should be populated for all files, because;
25.0.105 (9/25/2019)
4. NEW: Made the program go through and update the 'Total Discs' for all the files in the library at startup (files not marked dirty, so shouldn't cause tagging).

But I notice it still isn't for files with bad metadata, or for other reasons.

So read this: https://yabb.jriver.com/interact/index.php/topic,122323.0.html

GroupCount() would seem to be the right function to use, but even that can give some unexpected results. It really depends on your metadata. Also some compilation Albums give me funny numbers. Maybe GroupCountQuery(Album, Disc #).

But that might give you a start.
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

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Question
« Reply #2 on: June 09, 2020, 12:23:12 am »

GroupSummaryQuery(Album,Disc #) should do exactly what is required, but it actually doesn't work at all.  I've reported this to Matt.

[Total Discs] has an issue where it does not overwrite existing values.  So if you changed disc numbers on an album, the new count is not written to [Total Discs] at next restart, because the field already holds the old count.  You have to delete your [Total Discs] values, then restart, and it will overwrite the empty field with the correct count.  So in your case, to be safe, I would delete ALL your [Total Discs] values and let MC recount everything at next restart.

If you are unable to get it to work with [Total Discs], then it can also be done with playlists and views:
1. Create a Smartlist with a rule "Disc # is greater than 1" and modify "Expand to full Albums"
2. Add every file on this smartlist to a playlist called "multi-disc"
3. In a Panes view, add a category pane of type Search List, with a search of "Playlists is not any multi-disc"

When you click on that search, it will give you every file in the library that is NOT part of a multi-disc album.  You are then free to select and tag them.
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Expression Question
« Reply #3 on: June 09, 2020, 12:28:55 am »

Thanks much Rod! Didn't know about the [Total Discs] thing.

I looked a bit at GroupCount() but got kind of lost.

All the files I'm looking to manipulate here have been tagged via amg.pl from MCUtils, but the particular ones aren't "fully" on AMG, i.e., there are no tracks listed, so I can only get the barest album info, with no track numbers, names, disc numbers, etc. Here's an example, a multi-disc album, but it lacks a full set of metadata on AMG:

https://www.allmusic.com/album/eugene-ormandy-conducts-sibelius-mw0002886142

I therefore tag via a bunch of ids (composer, amg work/composition, etc.) again using amg.pl, but I often forget to get rid of the disc # if there's only one album, as this filled is often filled with a 1.

Anyway, I'll play around with [Total Discs] and GroupCountQuery().

Thanks again!
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Expression Question
« Reply #4 on: June 09, 2020, 12:30:20 am »

And thanks Wer! Very helpful!

I'll now play around with the Smartlist, etc. sequence and look out for GroupCountQuery changes.

Thanks again!
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Question
« Reply #5 on: June 09, 2020, 01:55:44 pm »

I mis-typed in my earlier post: it's GroupSummaryQuery that doesn't work for that, not GroupCountQuery. (I've fixed the post)

You actually can get the needed info from GroupCountQuery, but there's a trick:

GroupCountQuery(Album,Disc #)  will count the number of [Disc #] values for each album, however, it does NOT count tracks with an empty [Disc #] field.  It's not actually totaling up the values of the [Disc #] fields, it's just counting the number of discrete values that exist in the fields, not including null.

So when you filter on the results of GroupCountQuery(Album,Disc #), you'll can get the following results:

0: No [Disc #] is set for any file, so these would be single-disc albums
1: All the tracks have the same disc #, but some tracks might have no disc # at all. These are PROBABLY single-disc albums, you should look at them.
2 or greater: These are multi-disc albums

So imagine the following two-track albums:
Album 1
Track1  [Disc #]=
Track2  [Disc #]=
GroupCountQuery(Album,Disc #)=0

Album 2
Track1  [Disc #]=
Track2  [Disc #]=2
GroupCountQuery(Album,Disc #)=1

Album 3
Track1  [Disc #]=3
Track2  [Disc #]=3
GroupCountQuery(Album,Disc #)=1

Album 4
Track1  [Disc #]=1
Track2  [Disc #]=2
GroupCountQuery(Album,Disc #)=2

You've got enough to do what you need now.  Good luck!
Logged

timwtheov

  • Galactic Citizen
  • ****
  • Posts: 354
Re: Expression Question
« Reply #6 on: June 09, 2020, 03:53:38 pm »

Wow! Great! Thanks yet again! I hadn't had time to play around with any of this (and was too tired last night after I received your last reply), but I fiddle with it all later tonight.
Logged
Pages: [1]   Go Up