Sorts mp3 files in a directory based on given parameters. Lists the sorted list in a new window.
; -------------------------------------------
; /mp3sort - Mp3 file sorter
; Obviously sort mp3 files from a directory
; Can sort based on params:
; - length: Sorts mp3 files based on their length
; - sample: Sorts mp3 files based on their sample rate
; - bitrate: Sorts mp3 files based on their bitrate
; - size: Sorts mp3 files based on their size
; /mp3sort <length/size/bitrate/sample>
; Or you can type /mp3sort and it will sort based on the filename
; Empties the data into a new window in which you view the list.
; Updates/Version history
; *Fixed a few bugs regarding length, bitrate, and sample
; - Courtesy of EL
; *Added a file info option. :)
; *Recoded
; ------------------------------------------
alias mp3sort {
:begin
var %d = " $+ $sdir(C:\,Select a directory) $+ ", %o, %x = 1
if (!$(% $+ d,2)) {
var %p = $input(No directory selected!,r,error)
if (%p = $true) goto begin
}
if ($window(@mp3sort)) window -c @mp3sort
window -hls @mp3sort
%o = $1
if (%o = length) .echo -q $findfile(%d,*.mp3,0,aline @mp3sort $+($sound($1-).length,$chr(9),$1-))
if (%o = size) .echo -q $findfile(%d,*.mp3,0,aline @mp3sort $+($file($1-),$chr(9),$1-))
if (%o = bitrate) .echo -q $findfile(%d,*.mp3,0,aline @mp3sort $+($sound($1-).bitrate,$chr(9),$1-))
if (%o = sample) .echo -q $findfile(%d,*.mp3,0,aline @mp3sort $+($sound($1-).sample,$chr(9),$1-))
elseif (!$(% $+ o)) .echo -q $findfile(%d,*.mp3,0,aline @mp3sort $+($1-,$chr(9),$1-))
aline @mp3sort Sorted list for $+(%d,:) based on $iif(!$(% $+ o,2),file name,file %o)
if ($window(@mp3sorted)) window -c @mp3sorted
window -l @mp3sorted
filter -ww @mp3sort @mp3sorted
}
menu @mp3sorted {
$iif(!$sline(@mp3sorted,1),$style(2) View file info,View file info):{
var %g = $gettok($sline(@mp3sorted,1),2-,9)
aline @mp3sorted Filename: %g
aline @mp3sorted Size: $bytes($file(%g)).suf
aline @mp3sorted Length: $duration($calc($sound(%g).length /1000),3)
aline @mp3sorted Bitrate: $sound(%g).bitrate kbps
aline @mp3sorted Sample rate: $sound(%g).sample khz
aline @mp3sorted -------------------
}
}
Rebellious sorry should have been clearer on my post there.Yes i did try them all \"separately\" and i receive the same error message on each * /aline: insufficient parameters (line 27, script13).And yes your code = your preference all tho maybe adding how to add the no path in ;;\'s on the bottom for coders an testers who don\'t know how is a thought.Good work still.`-.-
I didn\'t even test the other commands.The /mp3sort (nothing here) Works.But with /mp3sort <length/size/bit rate/sample> i keep getting the same error * /aline: insufficient parameters (line 27, script13) .Not sure how to fix this myself and may just be me i just rather have you aware.Sorry for the double post.`-.-