Page 1 of 1

Find (audio) files by duration ?

Posted: 26 Dec 2016 09:38
by xnmp
Is it possible to find (audio) files by duration ?
for example find files that have duration from 180 -190 seconds
Thanks alot

Re: Find (audio) files by duration ?

Posted: 26 Dec 2016 18:00
by highend
By writing a script? Sure. #audio.length is the necessary property

E.g.:

Code: Select all

    $types = "*.flac | *.mp3 | *.ogg";
    $min   = input("Minimum length (in seconds)", , 180, , , 250, 150);
    $max   = input("Maximum length (in seconds)", , 190, , , 250, 150);

    $files = "";
    foreach($file, quicksearch($types, <curpath>), <crlf>) {
        $length = regexmatches(property("#audio.length", $file), "^[0-9:]+");
        $secs   = gettoken($length, -1, ":");
        $mins   = gettoken($length, -2, ":");
        $hours  = gettoken($length, -3, ":");
        $time   = ($hours * 60 * 60) + ($mins * 60) + $secs;
        if ($time <= $max && $time >= $min) { $files = $files . $file . <crlf>; }
    }
    if ($files) { paperfolder("Songs", $files); }

In the normal search? Don't know if it's possible to use smaller or greater for min:ss.mss values
(while it's no problem to search for files with minutes </> <x> minutes)...

Re: Find (audio) files by duration ?

Posted: 27 Dec 2016 04:05
by xnmp
highend wrote:By writing a script? Sure. #audio.length is the necessary property

In the normal search? Don't know if it's possible to use smaller or greater for min:ss.mss values
(while it's no problem to search for files with minutes </> <x> minutes)...
Hi ,
Thank you very much for the help, you made my day
by the way, can you please tell me how to search for files with minutes in normal search(i look for it in the help file but i haven't found anything rekated to it)
Thank you so much

Re: Find (audio) files by duration ?

Posted: 27 Dec 2016 09:29
by highend
Help file - Main Topics - Info Panel - Find Files Tab - Find Files by Meta Properties

Re: Find (audio) files by duration ?

Posted: 28 Dec 2016 03:45
by xnmp
i see ,thank you very much