highend wrote: ↑28 Feb 2019 12:17
This is NOT the script, this is a snippet that fills all items for that custom column definition^^
This is the script:
Code: Select all
$nsecs = property("System.Media.Duration", <cc_item>);
// Use mediainfo for unknown codecs ($nsecs is empty!)
if ($nsecs == "") {
$mediaInfo = "<xydrive>\Tools\@Command Line Tools\MediaInfo\MediaInfo.exe";
$length = regexreplace(runret("$mediaInfo --Inform=General;%Duration/String3% ""<cc_item>"""), "\.\d*\r?\n");
return $length;
// Use system properties for known codecs
} else {
// To get real seconds from nanoseconds, multiply the value with 0.0000001
$secs = round($nsecs * 0.0000001);
// Calculate length
// Do we have a playtime in hours?
$hours = $secs / 3600;
if ($hours >= 1) {
$hours = format(regexmatches($hours, "^\d+"), "00");
$secs = $secs - $hours * 3600;
} else { $hours = "00"; }
// Playtime only in minutes
$mins = $secs / 60;
if ($mins >= 1) {
$mins = format(regexmatches($mins, "^\d+"), "00");
$secs = $secs - $mins * 60;
} else { $mins = "00"; }
// -> Playtime is only seconds
// Nothing to calculate here any more
return $hours . ":" . $mins . ":" . format($secs, "00");
}
And sorry, but this is total bs:
Code: Select all
$mediaInfo = "<xydrive>\Tools\@Command Line E:\apps\media\mediaInfo\CLI\MediaInfo.exe";
It must be:
Code: Select all
$mediaInfo = "E:\apps\media\mediaInfo\CLI\MediaInfo.exe";
I apologize for riling you up Highend. I copied the snippet as in the first response in this thread. Not knowing XYS scripting, I didn't know to excise the excess data in the snippet. As I just explained, what I did to the path for $mediaInfo LOOKED wrong to me, but I went with what I thought the replacement was supposed to be. My error, so sorry.
Having clipped the snippet correctly, I now have a working Video Length column. This is a mark for increased use of XYplorer. Which leaves me with a question: Am I stuck with this old 32 bit version of K-Lite? Can I install the latest version outside of the program files hive? It's not like the old version doesn't do the job. But I'm usually an instant updater for most programs for fear of a vulnerability sneaking by me.
Once again, thanks to EVERYBODY who took their time to help out a newbie. GM