Get duration for use in a JScript Rename script?

In Standard rename of course i can use video tags like this:
{picwidth}
{picheight}
{fourcc}
{duration}

but i want to rename my files in JScript, because i want to calculate the duration time in minutes, so if the movie playtime is 1h 20min i want output 80min...

thx

This will get you the duration in seconds within a rename script, displaying it as script output without changing the files:

function OnGetNewName(getNewNameData)
{
	var md = getNewNameData.item.metadata;
	var duration = null;
	if (md == "audio")
		duration = md.audio.mp3songlength;
	else if (md == "video")
		duration = md.video.duration;

	DOpus.Output(duration);
}

It's returned as a number, so you can divide by 60 to get minutes. (You might want to add more error checking, of course! e.g. If the duration is unknown.)

i use this:

function OnGetNewName(getNewNameData)
{
	var item = getNewNameData.item;
	var meta = item.metadata;
	var minutes = Math.round(meta.video.duration / 60);
	var result = item.name_stem + minutes + ' min' + item.ext;
	// DOpus.Output("Result    = " + result);
	return result;
}