Calculate audio playtime
Calculate audio playtime
This script calculates the total audio playtime of:
- All selected items
- Or if none is selected, all items in the current folder
It does only work on items that have a codec installed. Out of the box
this should be true for .mp3 and .wav files and probably .ogg / .flac.
It should work on all Windows systems / languages and it should also work
on any number of audio files (it calculates the values in batches)
Increase the $splitOnNumOfDurations = 500; variable if you want (the higher the less
loops are required). It should be rather safe up to a value of 1000. If you get an error, reduce
it...
The original idea is taken from here: viewtopic.php?f=3&t=12177
Thanks to TheQwerty for the duration conversion part!
Current version: Old versions:
- All selected items
- Or if none is selected, all items in the current folder
It does only work on items that have a codec installed. Out of the box
this should be true for .mp3 and .wav files and probably .ogg / .flac.
It should work on all Windows systems / languages and it should also work
on any number of audio files (it calculates the values in batches)
Increase the $splitOnNumOfDurations = 500; variable if you want (the higher the less
loops are required). It should be rather safe up to a value of 1000. If you get an error, reduce
it...
The original idea is taken from here: viewtopic.php?f=3&t=12177
Thanks to TheQwerty for the duration conversion part!
Current version: Old versions:
One of my scripts helped you out? Please donate via Paypal
Re: Adding up the Length column
Thanks... hee heee, running Win 10 x64, throws error "Win 2000 is not supported"
"ver" outputs:
Microsoft Windows [Version 10.0.16299.192]
"ver" outputs:
Microsoft Windows [Version 10.0.16299.192]
Re: Adding up the Length column
Changed the version comparison system, redownload the file
One of my scripts helped you out? Please donate via Paypal
Re: Adding up the Length column
Yup, working fine now, thanks
Re: Calculate audio playtime
Are folders "items"? It doesn't work when I select a folder or group of folders. It only works within a folder.
Re: Calculate audio playtime
No, folders weren't treated as "items".
This has now been changed:
This has now been changed:
Code: Select all
/*
******************************************************************************
@Changelog:
v0.2
+ Now allows to process all items, even inside subfolders (recursively!)
v0.1
Initial release
******************************************************************************
*/
One of my scripts helped you out? Please donate via Paypal
Re: Calculate audio playtime
Please advise how to use the shared file .xys?
should i copy and paste it into the xyplorer files folder?
should i copy and paste it into the xyplorer files folder?
Re: Calculate audio playtime
viewtopic.php?f=7&t=6560
and the following paragraphsB
B.) How to execute an script by loading it from an file
One of my scripts helped you out? Please donate via Paypal
Re: Calculate audio playtime
v0.3 added. If your playtimes don't exceed 24 hours you don't need to replace your old version.
Thanks @jupe for reporting the bug
Code: Select all
/*
******************************************************************************
@Changelog:
v0.3
* If FormatDuration() is invoked with $type = "new", output is now formatted
to <hours>:<minutes>:<seconds> even if hours >= 24
! Fixed a format output bug if hours >= 24
******************************************************************************
*/
One of my scripts helped you out? Please donate via Paypal
Re: Calculate audio playtime
I originally downloaded and ran v0.2, which still works. In Dec 2020 replaced it with v.03 but I'm not sure I ever tried this new one.
Symptom with v0.3: With one 7min 13 sec MP3 file selected, stepping through the script seems to show that everything is fine right through the final FormatDuration function which calculates "433" (sec) but APPARENTLY isn't reporting it correctly back to the main program in $result. So the Echo window just shows "Total playtime: " ie. no actual time value displayed.
This must have worked originally so I wonder if Function syntax has changed in the meantime. That's one difference between v0.2 and v0.3.
Symptom with v0.3: With one 7min 13 sec MP3 file selected, stepping through the script seems to show that everything is fine right through the final FormatDuration function which calculates "433" (sec) but APPARENTLY isn't reporting it correctly back to the main program in $result. So the Echo window just shows "Total playtime: " ie. no actual time value displayed.
This must have worked originally so I wonder if Function syntax has changed in the meantime. That's one difference between v0.2 and v0.3.
Re: Calculate audio playtime
Yeah, it's a bug. Fixed with v0.4
Code: Select all
v0.4
! Fixed a bug if hours < 24
One of my scripts helped you out? Please donate via Paypal
Re: Calculate audio playtime
this script never worked for me:
- in the 'echo' sub-window: it just displays zeroes
- there were at least 3-4 attempts (in 2018-2023), including the fresh v0.4
i mainly interested in the simple wav-format, it has 99,9% in my priorities (among audio-formats)
is there something that i may try to alter (in the script)?
so that it began working
i have:
xy-19.40.0100
win-server-03, 32-bit, r2 sp2
8 gb ram
- in the 'echo' sub-window: it just displays zeroes
- there were at least 3-4 attempts (in 2018-2023), including the fresh v0.4
i mainly interested in the simple wav-format, it has 99,9% in my priorities (among audio-formats)
is there something that i may try to alter (in the script)?
so that it began working
i have:
xy-19.40.0100
win-server-03, 32-bit, r2 sp2
8 gb ram
Re: Calculate audio playtime
Select one audio file, execute this script and post the result:
Code: Select all
text "#21: " . property("#21", <curitem>) . " | #27: " . property("#27", <curitem>);
One of my scripts helped you out? Please donate via Paypal
Re: Calculate audio playtime
Code: Select all
#21: | #27:
Re: Calculate audio playtime
Get this script: viewtopic.php?p=150223#p150223
Select an audio file and execute the script, post the FULL result of the output window
Select an audio file and execute the script, post the FULL result of the output window
One of my scripts helped you out? Please donate via Paypal