Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Displaying track length (Read 1561 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Displaying track length

Hi

I'm trying to set up an Album List that sorts tracks by their length - %length% is only showing MM:SS values, and nothing above 59:59. Is there an alternative variable for HH:MM:SS?

Re: Displaying track length

Reply #1
The easiest way to sort by total length is the %length_seconds% field, which would display Beethoven's 9th as 4,181.
Neither an audiophile, nor album snob. Why do ratings threads always have a poster saying 'I don't believe in rating music'?
Record Label Icons: 600x600 pngs appropriate for any color background:
freeimage.host/johnbuck/?list=images&sort=name_asc&page=1

Re: Displaying track length

Reply #2
Thanks.
Interesting.

%length_seconds% works - the many tracks I have over a hour long are now showing - 9,300 for Robert Rich's 'Somnium Part 1'

I'd prefer it to be HH:MM:SS

That means %length% is not showing hours:

Quote
%length%

The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second. Old version: %_time_total%

%length_ex% doesn't show the hours either.

Re: Displaying track length

Reply #3
$iflonger(%length_ex%,9,,  )%length_ex%

See https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.25length_ex.25 , but it doesn't sort right when length hits an hour. Windows' collation strategy (don't blame fb2k) seems to sort as numbers until there is a second ":" in there, when the spaces kick in to fool it.
Beware that Windows' sorting is locale-dependent, and sometimes changes. YMMV.

Other tricks to fool sorting into doing the right thing ... https://hydrogenaud.io/index.php/topic,124956.0.html , with link to other thread at the bottom.

Re: Displaying track length

Reply #4
Thanks.
Interesting.

%length_seconds% works - the many tracks I have over a hour long are now showing - 9,300 for Robert Rich's 'Somnium Part 1'

I'd prefer it to be HH:MM:SS

That means %length% is not showing hours:

Quote
%length%

The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second. Old version: %_time_total%

%length_ex% doesn't show the hours either.


Use %length% in the display and use %length_seconds% to sort on.

Re: Displaying track length

Reply #5
Rather than editing myself ... there is something wrong here.

%length% is only showing MM:SS values, and nothing above 59:59.
I just tried the most recent beta out-of-the-box, and yes it shows hours if it is an hour or above.

Care to clarify?
* How does your fb2k display a track that is > 1 hr? Mine shows Mike Oldfield: Amarok as
1:00:02 under out-of-the-box "Duration", and 1:00:02.200 for %length_ex". For an 11 hr track, it shows 11:<etc>.
* But for tracks under 1 hour, there is no hour. So, do you want a 1 second track to show with hours as 00:00:01?
If so, you probably need to extract the length (in characters!) of the string and pad up with nothing or 0 or 00: or 00:0.  (Edit: and you will have to check that everything has a length. But if everything does, and if you have nothing long enough to bother about the 24 hours, then shouldn't $replace($right(00000%length%,8),000,00:) work?)

Re: Displaying track length

Reply #6
In the Album List screen, the hours do not show with %length%

In the playlist screen they show fine.

Re: Displaying track length

Reply #7
Hours show just fine for me.

Porcus already described what you need to do if you want padding for tracks shorter than 1 hour.


 

Re: Displaying track length

Reply #8
Ah - I get you. Windows is just seeing a string. I'll pad it out.