photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: Darius1968 on June 20, 2022, 01:37:09 PM

Title: MP3 Files' Metadata Formatted Output
Post by: Darius1968 on June 20, 2022, 01:37:09 PM
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? 
Title: Re: MP3 Files' Metadata Formatted Output
Post by: Mario on June 20, 2022, 02:24:54 PM
Simple math should do?

{File.MD.photools.com::IMatch\30800\id3samplerate\0|math:div,1000} Khz
Title: Re: MP3 Files' Metadata Formatted Output
Post by: Darius1968 on June 20, 2022, 04:22:45 PM
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? 
Title: Re: MP3 Files' Metadata Formatted Output
Post by: Mario on June 20, 2022, 04:33:18 PM
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.