Page 1 of 2

Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 15:17
by Jerry
Love the status bar template!
A few questions:
  • Is there any way to format a property value in the template? For example, when a video file is selected, I want to see the Total Bit Rate, but using the System.Video.TotalBitrate property gives me the number in bytes. I'd like to see it in kilobytes, or alternatively with comma separators. Is that possible or could an xyplorer #video.totalbitrate native variable be created to do that, as for audio? (Note: I actually would prefer the System.Video.bitrate property instead to exclude the audio component, but nothing comes back for that property.)
  • Omit added strings when property values not available. For videos, I have the following template pattern:

    Code: Select all

    <prop System.Video.FrameWidth> x <prop System.Video.FrameHeight> @ <prop System.Video.TotalBitrate>
    But if the selected file is not a video, the rendered text in the status bar becomes " x @ ". It would be nice if the added strings don't show up at all in that case. Perhaps if one used a special grouping character pair such as "{ }" ? Or type-specific status bar templates? Or have a #video.dimensions native variable that works like #audio.dimensions?

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 16:48
by admin
1) format: currently not

2) omit: use this:

Code: Select all

v22.60.0002 - 2021-12-10 14:09
    + Custom Status Bar Info / Property Variables: The recent changes 
      (v22.60.0001) still work, but there is a better alternative now. You can 
      pass an optional format template in the argument after the property 
      selector. The * is a place holder for the value (if missing the value is 
      simply appended to the template). Must be wrapped in single or double 
      quotes if a space is included:
        echo <prop #image.dimensions 'Size: * px'>; //Size: 1024 x 460 px
        echo <prop #image.dimensions "Size: * px">; //Size: 1024 x 460 px
        echo <prop #image.dimensions "Size: ">; //Size: 1024 x 460
Try this template:

Code: Select all

<prop System.Video.FrameWidth><prop System.Video.FrameHeight ' x *'><prop System.Video.TotalBitrate ' @ *'>

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:02
by Jerry
Thanks, the optional format template fits the bill for #2.
For issue #1, any chance of adding #video.TotalBitRate and #video.BitRate native variables that would format as kbps (or perhaps as Mbps) like #audio.bitrate does? (Also #video.dimensions would be handy too, analogous to #image.dimensions.)

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:07
by admin
Just had an idea and added this. Should do:

Code: Select all

    + Custom Status Bar Info / Property Variables: Now you can add formatting directions 
      to the place holder for the value. Remember that the template must be wrapped in 
      single or double quotes if a space is included:
        echo <prop System.Video.TotalBitrate 'Bitrate: *'>;   //Bitrate: 409600     (no formatting)
        echo <prop System.Video.TotalBitrate 'Bitrate: *n'>;  //Bitrate: 409,600    (number formatting)
        echo <prop System.Video.TotalBitrate 'Bitrate: *b'>;  //Bitrate: 400.00 KB  (bytes formatting)

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:14
by Jerry
admin wrote: ↑02 May 2022 17:07 Just had an idea and added this. Should do:

Code: Select all

    + Custom Status Bar Info / Property Variables: Now you can add formatting directions 
      to the place holder for the value. Remember that the template must be wrapped in 
      single or double quotes if a space is included:
        echo <prop System.Video.TotalBitrate 'Bitrate: *'>;   //Bitrate: 409600     (no formatting)
        echo <prop System.Video.TotalBitrate 'Bitrate: *n'>;  //Bitrate: 409,600    (number formatting)
        echo <prop System.Video.TotalBitrate 'Bitrate: *b'>;  //Bitrate: 400.00 KB  (bytes formatting)
That would do it. A way to specify kilobits vs megabits, especially for video files would be also nice, but not essential. Could you make System.Video.Bitrate return a value? That's the bit rate without the audio component.

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:20
by admin
*b chooses the best unit depending on the value.

System.Video.Bitrate is not supported by the system.

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:23
by Jerry
admin wrote: ↑02 May 2022 17:20 System.Video.Bitrate is not supported by the system.
The property is currently being retrieved for display in the metadata popup.

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:26
by admin
What popup? Got a screenshot?

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:34
by Jerry
admin wrote: ↑02 May 2022 17:26 What popup? Got a screenshot?

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:45
by admin
Simply <prop Bitrate>.

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:50
by admin
Added this:

Code: Select all

echo <prop System.Video.TotalBitrate 'Bitrate: *kbps'>; //Bitrate: 462kbps    (kb per sec formatting)

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 17:55
by Jerry
admin wrote: ↑02 May 2022 17:45 Simply <prop Bitrate>.
Sorry, my mistake. It seems that the video-only bit rate appears in the metadata dialog as
"Data rate". What's the property name for that?

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 18:15
by admin
You probably have to go by index. Here it is #298: echo <prop #298>;

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 18:33
by Jerry
admin wrote: ↑02 May 2022 18:15 You probably have to go by index. Here it is #298: echo <prop #298>;
Hmm, I'm not seeing the value returned with that index, and also the optional format template isn't omitting the added strings when there's no value - does that not work with indexes?

Code: Select all

<prop #298 '@ *'>

Re: Status Bar Template: Formatting of Property Values

Posted: 02 May 2022 18:43
by admin
1. Add a new column, right-click the header and open the Select Property list. Search for your field and you will see the index (it will be different on your system):
2022-05-02_184207.png
2. Will work in the next beta.