With Opus, I currently only see the Data rate column displayed. I also want to add the same Total bitrate column. Can I insert that column for Movie Type because I searched in the Insert Field and didn't see this column? Thank you very much
Thank you for your support, I tried it and the total birate data is already displayed. But there is a problem: my value is displayed as having an extra sign, for example: the value is 16031 but it is displayed as 16,031 as shown below.
This is my script code
function OnInit(initData) {
initData.name = 'TotalBitrate';
initData.version = '12.';
initData.url = 'https://resource.dopus.com/t/is-there-an-opus-equivalent-to-the-date-column-as-implemented-in-win10-file-explorer/40834';
initData.desc = 'Retrieves System.Video.TotalBitrate from the Shell (File Explorer\'s "TotalBitrate")';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnAddColumns(addColData) {
var col = addColData.AddColumn();
col.name = 'TotalBitrate';
col.label = 'TotalBitrate';
col.header = 'TotalBitrate';
col.justify = 'left';
col.type = 'number';
col.autogroup = true;
col.method = 'OnColumn';
}
function OnColumn(scriptColData) {
var bytes = scriptColData.item.ShellProp('System.Video.TotalBitrate');
var kbps = bytes / 1000;
scriptColData.value = kbps;
}
And here is the script code when I try to remove the sign, but when I use this code, the value of total bitrate cannot be displayed.
function OnInit(initData) {
initData.name = 'TotalBitrate';
initData.version = '2022-03-19';
initData.url = 'https://resource.dopus.com/t/is-there-an-opus-equivalent-to-the-date-column-as-implemented-in-win10-file-explorer/40834';
initData.desc = 'Retrieves System.Video.TotalBitrate from the Shell (File Explorer\'s "TotalBitrate")';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnAddColumns(addColData) {
var col = addColData.AddColumn();
col.name = 'TotalBitrate';
col.label = 'TotalBitrate';
col.header = 'TotalBitrate';
col.justify = 'left';
col.type = 'number';
col.autogroup = true;
col.method = 'OnColumn';
}
function OnColumn(scriptColData) {
var bytes = scriptColData.item.ShellProp('System.Video.TotalBitrate');
var kbps = bytes / 1000;
kbps = kbps.replace (/,/g, '');
scriptColData.value = kbps;
}
Could you please help me fix my wrong code? Thank you very much
Thanks for your suggestion. But I found out the problem was col.type = 'number' so I changed it to text. And I found it worked exactly the way I wanted it to. Thank you very much. Here is my complete code if anyone needs it, they can use it
function OnInit(initData) {
initData.name = 'TotalBitrate';
initData.version = '12.';
initData.url = 'https://resource.dopus.com/t/is-there-an-opus-equivalent-to-the-date-column-as-implemented-in-win10-file-explorer/40834';
initData.desc = 'Retrieves System.Video.TotalBitrate from the Shell (File Explorer\'s "TotalBitrate")';
initData.default_enable = true;
initData.min_version = '12.0';
}
function OnAddColumns(addColData) {
var col = addColData.AddColumn();
col.name = 'TotalBitrate';
col.label = 'TotalBitrate';
col.header = 'TotalBitrate';
col.justify = 'left';
col.type = 'text';
col.autogroup = true;
col.method = 'OnColumn';
}
function OnColumn(scriptColData) {
var bytes = scriptColData.item.ShellProp('System.Video.TotalBitrate');
var kbps = bytes / 1000;
scriptColData.value = Math.floor(kbps)+ ' kbps';
}