MP3 Files' Metadata Formatted Output

Started by Darius1968, June 20, 2022, 01:37:09 PM

Previous topic - Next topic

Darius1968

As far as my MP3 collection goes: 
{File.MD.photools.com::IMatch\30800\id3samplerate\0} Hz gets me an output like this: 
48000 Hz

But, how can I format the tag such that I will have an output like:
48 Khz or 44.1 Khz

Mario

Simple math should do?

{File.MD.photools.com::IMatch\30800\id3samplerate\0|math:div,1000} Khz

Darius1968

I used {File.MD.photools.com::IMatch\30800\id3samplerate\0|math:div,1000,1} Khz
...Which works perfectly for MP3s with a 44.1 Khz sampling rate.  With MP3s having 48 Khz, however, the XAML output defaults to 48.0 Khz
So, how can I further refine the expression to suppress the display of .0, for cases in which the value is just an exact multiple of 1,000? 

Mario

You demand one decimal digit by specifying ,1 so you get it.
There is no "one decimal digit except it is 0 or it is rounded to .1" or something.
Use replace to trim the .0 or use two formulas for either case.