Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Version Check, per file handling commands. If your not on 6.12, you can still use the old method (www.heres.onedumb.com/ezm3u-old.mrc) This is just more than 50% to 70% faster!
- on *:load:if $version < 6.12 { echo -a * You must have the latest version of mirc to run /ezm3u - 12www.mirc.com ... Unloading... | unload -rs $script }
- /*
- /ezm3u by contr0l
- -Usage: /ezm3u <-ecrn> :: Will prompt you to select a folder of mp3's and create a .m3u file from the contents. (named according to the dir you choose)
- For making m3u's for your albums that dont have an m3u. Pick the album's folder, and hit Go ;)
- --Syntax: /ezm3u <-ecrn> :: *switches are optional*
- ---Switches:
- ----: -c ;Clears the cached start dir
- ----: -e ;Executes the .m3u upon creation, which will run it in your default mp3 player.
- ----: -rn ;this will Run your m3u in Notepad upon creation.
- Notes:
- The first time ran, the $sdir will start in your c:\ or most likely main drive...
- After it has been run once, it will remember the last path, and start there.
- Use /ezm3u -c to clean up the cached start dir
- Updates:
- - now uses file handling commands
- - eliminated one of the $findfiles
- - changed $iifs to regular if statements
- - changed so that the benchmark is more accurate
- If anyone knows of different types of m3u's or anything related to this snippet that can help, plz let me know.
- [tested in winamp and musicmatch]
- heres the work...
- */
- alias ezm3u {
- ;make sure is used as /ezm3u and not $ezm3u
- if !$isid {
- ;if the -c switch is supplied, clear the cached start dir.
- if $1 && $left($1,1) == - && $+(*,c,*) iswm $1 { unset %ez.* }
- ;Prompt for a directory to create the .m3u from.
- ;set the directory they chose to a var..
- set %ez.p $$sdir($iif(%ez.p,$"($ifmatch),$c),Select a folder with the mp3's you want to make a .m3u from.,Go)
- ;error checking
- if $isdir($"(%ez.p)) {
- set %ez.tix $ticks
- ;this sets a variable to the name of the folder you selected .m3u
- set %ez.f $"($+(%ez.p,$gettok(%ez.p,$numtok(%ez.p,92),92),.m3u))
- ;if the m3u already exists in the folder you chose, halt
- if $isfile(%ez.f) { echo -a $+([,$nopath(%ez.f),]) already exists in $+([,$nofile(%ez.f),]) | halt }
- ;else
- ;status track
- set %ez.c 0
- ;fopen the m3u file to /fwrite to it
- .fopen -n ez %ez.f
- ;check that there is atleast 1 mp3 in the specified dir .. and instead of a while loop.. uses findfile, and calls /ez.go $1- on each item found
- if $findfile($"(%ez.p),*.mp3,0,0,ez.go $1-) {
- ;...
- if $isfile(%ez.f) && %ez.c > 0 { echo -a $+([,%ez.f,]) Successfully created in $calc($ticks - %ez.tix) ms! }
- ;[Switch checking]
- if $1 && $left($1,1) == - {
- ; -c switch is checked before anything, to clear the cached dir before running
- if $+(*,e,*) iswm $1 { run %ez.f }
- if $+(*,rn,*) iswm $1 { run notepad %ez.f }
- }
- ;fclose the m3u file after writing to it.
- .fclose ez
- ;cleanup
- unset %ez.c
- unset %ez.tix
- unset %ez.f
- }
- ;error responses
- else echo -a * No .mp3 files in the specified folder.
- }
- else echo -a * You must select a valid directory to continue.
- }
- else return * Insufficient Format: /ezm3u <-ecrn>
- }
- ;findfile alias
- alias -l ez.go {
- var %ez.ff
- ;create the file before writing to it (dir name.m3u .. located in the dir you chose)
- ;use addtok to add each result from the findfile to a var, seperated by chr(13)
- %ez.ff = $addtok(%ez.ff,$nopath($"($1-)),$chr(13))
- ;write the info to the file
- if !$ferr { inc %ez.c | .fwrite -n ez %ez.ff }
- }
- ;quick alias to wrap in "'s
- alias -l " return $+(",$1-,")
- ;alias to return a starting point
- alias -l c { if $disk(c:) { return c:\ } | else { return $left($mircdir,3) } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement