Export config - %age time

How can I get my Export config to print for each track, that track's duration as a %age of all tracks' duration? I.e.

$loop(%dummy%)
$div($mul(%_length_seconds%,100),%_total_time_raw%)
$loopend()

except this doesn't work, because %_total_time_raw% is invalid inside the loop. I can find no way of carrying a valid %_total_time_raw% into the loop.

Thanks.

Try this export script ...

$filename(O:\TEST\Test.chrisjj.percent.txt,ANSI)
'A) Simple loop to sum up to _total_time_raw is not needed!'
$loop(%dummy%)%_counter%': '%title%$char(9)%_length%$char(9)%_length_seconds%
$loopend()'Total Time Raw: '%_total_time_raw%

'B) Pre calculated existing _total_time_raw is automatically diminished per each loop within the loop (this is a bug).'
$loop(%dummy%)'Total Time Raw: '%_total_time_raw%
'Length Seconds: '%_length_seconds%
%_counter%': Percent: '$div($mul(%_length_seconds%,100),%_total_time_raw%) '(from current value of _total_time_raw: %_total_time_raw%)'
$loopend()

'C) _total_time_raw has still its pre calculated value and percentage calculation works.'
'Total Time Raw: '%_total_time_raw%
$loop(%dummy%)'Length Seconds: '%_length_seconds%
%_counter%': Percent: '$div($mul(%_length_seconds%,100),$put(TTR,$if($eql($get(TTR),),%_total_time_raw%,$get(TTR))))
$loopend()

The percentage values are not summed up to 100 percent in all cases because of truncation by Mp3tag integer arithmetic. Maybe its better to do the calculation with more granularity (multiply by 1000 and with some integer arithmetic you can get a nn.n pct value).

DD.20091214.2012.CET

Detlev, I am again indebted to you. Thanks.

Here is my simplified version of your fix, with clarification for some who may find it useful.

$filename(c:\temp.txt,ANSI)
'A) Simple loop to make _total_time_raw valid IS needed!'
$loop(%dummy%)$loopend()'Total Time Raw: '%_total_time_raw%

'B)_total_time_raw has still its pre calculated value and percentage calculation works.'
'Total Time Raw: '%_total_time_raw%
'But _total_time_raw is automatically diminished within the next loop (this is a bug),'
'so to workaround, we must $put a copy beforehand. And to workaround the $put-<dollar>loop-$get bug,'
'we move the $put inside the loop, with a $if to ensure it copies only the first time.'
$loop(%dummy%)'Length Seconds: '%_length_seconds%
%_counter%': Percent: '$div($mul(%_length_seconds%,100),$put(TTR,$if($neql($get(TTR),),$get(TTR),%_total_time_raw%)))
$loopend()

Regarding total values only, this export script works for me ...

$filename(O:\TEST\Test.txt,ANSI)'Mp3tag version: '%_app%
'Following values are provided without a previous "loop/loopend" structure.'
'Total number of files (%''_total_files''%): '%_total_files%
'Total file size (formatted output) (%''_total_size''%): '%_total_size%
'Total file size in bytes (%''_total_size_raw''%): '%_total_size_raw%
'Total playing time (formatted output) (%''_total_time''%): '%_total_time%
'Total playing time (formatted output without days) (%''_total_time2''%): '%_total_time2%
'Total playing time in seconds (%''_total_time_raw''%): '%_total_time_raw%

Mp3tag version: Mp3tag v2.45a
Following values are provided without a previous "loop/loopend" structure.
Total number of files (%_total_files%): 4820
Total file size (formatted output) (%_total_size%): 24,92 GB
Total file size in bytes (%_total_size_raw%): 26755994213
Total playing time (formatted output) (%_total_time%): 13 days, 05:50:14
Total playing time (formatted output without days) (%_total_time2%): 317:50:14
Total playing time in seconds (%_total_time_raw%): 1144214

DD.20091215.1038.CET

'Following values are provided without a previous "loop/loopend" structure.'

That works here on V2.44 too.

But may be unsafe, since it does not accord with

[X] %_total_files% fails
Florian

and

https://docs.mp3tag.de/export

I'll suggest an amend.

Thanks D.