More > JRiver Media Center 30 for Mac

Writing an Expression to Group an Album Column by Omitting Two Words

(1/2) > >>

AudibleImagery:
Hello,

I need to write an expression (to group by) that will omit the following two words (including the brackets) from my album column: [Incomplete] & [Lossy]. For context, the reason I need to omit these words is because I use these designations to help sort these two distinct categories. These two categories can create two entries such as in the case where a lossless album has a lossy track that exists in a lossless format but that I've been unable to find in either a digital or physical format. Then I end up with 18 tracks for an album titled "Car Alarm" and one track for a separate album entry titled "Car Alarm [Lossy]". The expression is going to be written as 'Calculated data' in a custom library field that I use to sort albums: [Album] - [Album Artist]

I've been experimenting with the ListItem() expression and have gotten close by omitting one of the words but I haven't been able to figure out how to write the expression to exclude both of them. This is the expression that I've gotten closest with:

--- Code: ---Listitem(Album, 11,0, [lossy) - Album Artist
--- End code ---

Can somebody please help me complete this code to omit both of the words or alternatively help me to write a different code that will work?

Regards in advance,
Audible

zybex:
It's not entirely clear what you're trying to do, but I think this is what you're asking for:
trim(replace(replace([Album],/[Lossy/],),/[Incomplete/],)) - [Album Artist]

Note that this expression is case-sensitive - it works for "Lossy" and "Incomplete", but not for "lossy" or "incomplete".
Alternative case-insensitive solution:
Regex([Album],/#(.+?)(\s*\[(lossy|incomplete)\].*)?$#/,1) - [Album Artist]

AudibleImagery:

--- Quote from: zybex on February 27, 2023, 03:36:39 pm ---It's not entirely clear what you're trying to do, but I think this is what you're asking for:
trim(replace(replace([Album],/[Lossy/],),/[Incomplete/],)) - [Album Artist]

Note that this expression is case-sensitive - it works for "Lossy" and "Incomplete", but not for "lossy" or "incomplete".
Alternative case-insensitive solution:
Regex([Album],/#(.+?)(\s*\[(lossy|incomplete)\].*)?$#/,1) - [Album Artist]

--- End quote ---

This did the trick! Thank you so much. How did you learn to write these expressions so well? I want to learn so that I can bother you less 😬 I've managed to write quite a few on my own but nothing this complicated.

AudibleImagery:
I'm also trying to figure out how to group this same column by disc number because my albums currently show like this:

--- Code: ---Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Five)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Four)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Three)
--- End code ---

but I want them to display in order of disc number like so:

--- Code: ---Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Three)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Four)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Five)
--- End code ---

zybex:

--- Quote from: AudibleImagery on February 27, 2023, 07:26:48 pm ---This did the trick! Thank you so much. How did you learn to write these expressions so well?

--- End quote ---

I blame my mother, she was always asking me to make funny expressions with my face. Alsho, I'm a shoftware developer and learned Lisp back when funcshional languagesh were shtill cool ::)
Try Zelda, it helps tinkering with expressions until you get the desired result. There's also a Wiki with the language ins and outs.


--- Quote from: AudibleImagery on February 27, 2023, 08:19:17 pm ---I'm also trying to figure out how to group this same column by disc number because my albums currently show like this:

--- Code: ---Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Five)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Four)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Three)
--- End code ---

but I want them to display in order of disc number like so:

--- Code: ---Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Three)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Four)
Feel Flows (The Sunflower & Surf's Up Sessions 1969-1971) (Disc Five)
--- End code ---

--- End quote ---

Shouldn't the [Album] name be the same for these and [Disc #] be used to store the 1-2-3 disc number? Then you can use both those fields to group and sort by.

Navigation

[0] Message Index

[#] Next page

Go to full version