Video files are sorted by length in wrong order
Posted: 08 Oct 2021 09:03
Video files are sorted by length in wrong order. For example, when sorted by length, a 2-hour video display is shorter than a 3-minute video display.
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Code: Select all
$nsecs = property("System.Media.Duration", <cc_item>);
// To get real seconds from nanoseconds
$secs = round($nsecs * 0.0000001);
$hours = $secs / 3600;
if ($hours >= 1) {
$hours = format(regexmatches($hours, "^\d+"), "00");
$secs = $secs - $hours * 3600;
} else { $hours = "00"; }
$mins = $secs / 60;
if ($mins >= 1) {
$mins = format(regexmatches($mins, "^\d+"), "00");
$secs = $secs - $mins * 60;
} else { $mins = "00"; }
return $hours . ":" . $mins . ":" . format($secs, "00");