Find (audio) files by duration ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

Find (audio) files by duration ?

Post by xnmp »

Is it possible to find (audio) files by duration ?
for example find files that have duration from 180 -190 seconds
Thanks alot

highend
Posts: 14997
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Find (audio) files by duration ?

Post 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)...
One of my scripts helped you out? Please donate via Paypal

xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

Re: Find (audio) files by duration ?

Post 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

highend
Posts: 14997
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Find (audio) files by duration ?

Post by highend »

Help file - Main Topics - Info Panel - Find Files Tab - Find Files by Meta Properties
One of my scripts helped you out? Please donate via Paypal

xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

Re: Find (audio) files by duration ?

Post by xnmp »

i see ,thank you very much

Post Reply