Page 1 of 2
Calculate audio playtime
Posted: 28 Jan 2018 21:53
by highend
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:
Re: Adding up the Length column
Posted: 28 Jan 2018 23:17
by JLoftus
Thanks... hee heee, running Win 10 x64, throws error "Win 2000 is not supported"
"ver" outputs:
Microsoft Windows [Version 10.0.16299.192]
Re: Adding up the Length column
Posted: 28 Jan 2018 23:32
by highend
Changed the version comparison system, redownload the file
Re: Adding up the Length column
Posted: 29 Jan 2018 01:15
by JLoftus
Yup, working fine now, thanks
Re: Calculate audio playtime
Posted: 30 Jan 2018 17:42
by Papoulka
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
Posted: 30 Jan 2018 23:42
by highend
No, folders weren't treated as "items".
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
******************************************************************************
*/
Re: Calculate audio playtime
Posted: 15 Jun 2020 10:46
by Shahin
Please advise how to use the shared file .xys?
should i copy and paste it into the xyplorer files folder?
Re: Calculate audio playtime
Posted: 15 Jun 2020 21:24
by highend
viewtopic.php?f=7&t=6560
B
B.) How to execute an script by loading it from an file
and the following paragraphs
Re: Calculate audio playtime
Posted: 10 Dec 2020 09:43
by highend
v0.3 added. If your playtimes don't exceed 24 hours you don't need to replace your old version.
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
******************************************************************************
*/
Thanks @
jupe for reporting the bug
Re: Calculate audio playtime
Posted: 15 Feb 2023 05:29
by Malarki
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.
Re: Calculate audio playtime
Posted: 15 Feb 2023 09:57
by highend
Yeah, it's a bug. Fixed with v0.4
Re: Calculate audio playtime
Posted: 22 Mar 2023 22:54
by suslo
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
Re: Calculate audio playtime
Posted: 22 Mar 2023 23:25
by highend
Select one audio file, execute this script and post the result:
Code: Select all
text "#21: " . property("#21", <curitem>) . " | #27: " . property("#27", <curitem>);
Re: Calculate audio playtime
Posted: 22 Mar 2023 23:51
by suslo
Re: Calculate audio playtime
Posted: 23 Mar 2023 00:08
by highend
Get this script:
viewtopic.php?p=150223#p150223
Select an audio file and execute the script, post the FULL result of the output window