INTERACT FORUM

Please login or register.

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

Author Topic: Theatre Mode Movie Grouping  (Read 622 times)

Conrad

  • Recent member
  • *
  • Posts: 49
Theatre Mode Movie Grouping
« on: March 01, 2025, 05:14:23 am »

I'm trying to create a grouping of movies in Theatre mode so that we can choose movies based on their duration. Rather than group by specific duration (to the minute) I'd like to create "bands" of movie lengths.

I've added a new item in the Items To Show list and that appears.
I've set it's type to Expression and I'm using the below expression:

Code: [Select]
save(left([duration], find([Duration], :)), hours)

save(right([Duration], math(length([Duration])-find([Duration], :)-1)), mins)
if(compare(find([mins], :), >, 0), save(left([mins], find([mins], :)), mins), [mins])

save(math([hours]*60+[mins]), mins)

if(compare([mins], <, 100), Under 1:40,
if(compare([mins], <, 120), Under 2 hours,
if(compare([mins], <, 150), Under 2:30,
if(compare([mins], <, 180), Under 3 hours, Over 3 hours))))

This works in Zelda and gives me an appropriate string for each movie based on it's length. The additional variable processing is to that both 1:32:50 and 1:32 work.

In Theatre mode I'm not getting the behaviour I expect.
I have four groups, but they don't have labels.
I also have each movie grouped by minute, so I have my bands, plus the movies listed again but grouped by minute.

Any ides what I'm doing wrong, or if there's an easier way to achieve what I'm trying to do?

Thanks
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4423
Re: Theatre Mode Movie Grouping
« Reply #1 on: March 01, 2025, 05:25:07 am »

I have a similar view which groups in the same way and it's not a complicated expression because it's not based on string parsing, not at computer atm so can't say exactly how it's implemented but perhaps https://yabb.jriver.com/interact/index.php?topic=97261.0 gives a clue (can post it later if no one else answers by then)
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #2 on: March 01, 2025, 06:06:49 am »

That does look like it would simplify things, but the problem remains:

Code: [Select]
if(compare([Duration], <, 100m), Under 1:40,
if(compare([Duration], <, 120m), Under 2 hours,
if(compare([Duration], <, 150m), Under 2:30,
if(compare([Duration], <, 180m), Under 3 hours, Over 3 hours))))[CODE]

looks like it should work, but everything ends up in the first bucket, including if I reverse the operator.
Hours (h) looks better, but 2, 2.3 and 2.5 don't seem to work for 2:30.

If you could share the expression you're using when you have some time that would be great.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2066
Re: Theatre Mode Movie Grouping
« Reply #3 on: March 01, 2025, 07:05:29 am »

Maybe something like that suits you:
Code: [Select]
IfCase(Math(Decimal([Duration,0])/60),5,180,<font alpha="0">5<//font>Over 3 hours, 150, <font alpha="0">4<//font>Under 3 hours, 120, <font alpha="0">3<//font>Under 2:30, 100, <font alpha="0">2<//font>Under 2 hours, 1, <font alpha="0">1<//font>Under 1:40)
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #4 on: March 01, 2025, 07:40:48 am »

Thanks, that almost works.
I think the issue I have is that some of my durations have seconds and some don't.
That means that JRiver thinks that a movie which is 2:34 is actually two and a half minutes long, so it groups them in the Under 1:40 group.

I can't see an obvious way to fix that without string manipulation so I'm going to review my tagging process and see if I can make sure that seconds are captured against durations.
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #5 on: March 01, 2025, 07:52:22 am »

Apologies for the double post.

If I use Runtime which is populated by ZResults then it works. Runtime is consistently in minutes as well so that's brilliant.

Thanks for the help!
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2066
Re: Theatre Mode Movie Grouping
« Reply #6 on: March 01, 2025, 07:56:51 am »

Above should work. Are you in the comma decimal world?
[duration,0] should give you duration in seconds so no need for string manipulation

if you are in comma world you could try this to further eliminate MC's math issues with comma decimal
Code: [Select]
IfCase(Math(int(Decimal([Duration,0])/60)),5,180,<font alpha="0">5<//font>Over 3 hours, 150, <font alpha="0">4<//font>Under 3 hours, 120, <font alpha="0">3<//font>Under 2:30, 100, <font alpha="0">2<//font>Under 2 hours, 1, <font alpha="0">1<//font>Under 1:40)Math(int(Decimal([Duration,0])/60)) should give you duration in minutes with int portion only

E: glad that you got it working using ZRatings runtime field. [Duration] works also and it doesn't depend on external tools so I leave this here for others to see
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #7 on: March 01, 2025, 08:08:43 am »

I'm not in comma decimal world :)

When the Duration field is 1:26:56, [Duration,0] gives 5216 . 5216/60 = 86.93 so that works as it's over 1 and under 100 and should be in the "under 1:40" bucket.

However, when the Duration field is 2:32 (without seconds), [Duration,0] gives 152. JRiver thinks 2:32 is 2 minutes 32 seconds, which is 152 seconds. 152/60 = 2.53 which puts the movie in the over 1, under 100 group also.

Maybe I just need to run a library update or something?
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2066
Re: Theatre Mode Movie Grouping
« Reply #8 on: March 01, 2025, 08:24:00 am »

Duration should show 2:32:00 there so something probably went wrong when you imported file. You could try update library from tags to re-analyze it.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2831
Re: Theatre Mode Movie Grouping
« Reply #9 on: March 01, 2025, 08:49:27 am »

If you have durations as h:mm without seconds, then [Duration,0] will give low numbers (1:30 = 90 seconds instead of 5400). You should fix that.
Alternatively you could take that into consideration on your expression, handling both small and large values:

Code: [Select]
ifcase([Duration,0],4,90, <1h30, 120, <2h, 150, <2h30, 180, <3h, 1000, >3h, 5400, <1h30, 7200, <2h, 9000, <2h30, 10800, <3h, 1000000, >3h)
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4423
Re: Theatre Mode Movie Grouping
« Reply #10 on: March 01, 2025, 11:20:21 am »

mine is

Code: [Select]
ifelse(isrange([duration,0],1-5400),<1.5h,
            isrange([duration,0],5400-7200),1.5-2h,
            1,2+h)

where you have a duration that is rendered as hh:mm only, what does [duration,0] show?
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #11 on: March 01, 2025, 12:19:39 pm »

Thanks everyone.
It looks like there's multiple ways to achieve this and they mostly depend on having correct Duration values.

What's the best way to get those values repopulated? I've done a library import and I've done an Update from tags but that seemed to cause other issues.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4423
Re: Theatre Mode Movie Grouping
« Reply #12 on: March 02, 2025, 05:20:21 am »

what sort of other issues?

I would think "Update Library (from tags)" and/or "Analyse Video" are responsible for setting duration though they will also touch other fields and I don't know which one actually does the job
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #13 on: March 02, 2025, 11:22:10 am »

More movies appear in the Unassigned group, they appear to have missing metadata.

That might just be a case of going through those movies and updating the metadata though. And if that's then using the correct field that might be the better long term solution.

With Runtime I end up with three movies in the Unassigned group, but that's expected, they're locally produced DVDs which aren't in any source. With Duration I end up with about 10 or 12 movies in there, so it's never an unmanageable amount.

And we used the grouping to choose a movie last night and it worked brilliantly.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4423
Re: Theatre Mode Movie Grouping
« Reply #14 on: March 02, 2025, 11:39:25 am »

you mean it loses the value for "media sub type"?
Logged

Conrad

  • Recent member
  • *
  • Posts: 49
Re: Theatre Mode Movie Grouping
« Reply #15 on: March 02, 2025, 11:43:16 am »

Sorry, no. When I say the unassigned group I mean in the Duration Grouping view.
I believe they're still considered Video/Movie. I can flick back to using duration and re-populate the tags and look at what's missing.

It might just be that the duration is missing in which case I'll investigate that.
Logged
Pages: [1]   Go Up