{files} ← type ##.mp3 dirs          ⍝ Create playlist(s) for mp3 directories.

Supplied by Veli-Matti Jantunen, who says:

Creates  simple  playlists  in  each directory (and each of its sub-directories)
specified  by  the  right  argument.  Currently, five  playlist file formats are
supported  and it should be pretty simple to add new formats if needed (or fine-
tune the specific formatter for the user's own needs).

The left argument specifies:

    lower case letters 'abmpw' for different file types and
    upper case letters 'DNPS'  for extra switches.

The following file types may be created:

    a → .asx file (Media Player should detect this), 
    b → .b4s file (WinAmp's XML format, not supported by the version 5.*), 
    m → .m3u file (the old WinAmp playlist, this is the default), 
    p → .pls file (WinAmp), 
    w → .wpl file (Media Player). 

Several  files  may be created in one run.  The playlist file is created only if
there  are mp3 files present in the directory. By default, the file list doesn't
contain  the  path  (i.e.  the file "d:\mp3\Album\song.mp3" will be shown in the
list only as "song.mp3").

The switches are:

    D → Delete the playlists (from directories specified in the right argument), 
    N → create the playlist only if it doesn't aleady exit. 
    P → use the full file path name in the list, 
    S → do not visit the sub-directories. 

The shy result has all the created playlist names.

For example,

To create new m3u and wpl playlists to all the albums found in d:\mp3,
C:\My Music and their sub-directories:

  'mwN' mp3 'd:\mp3' 'C:\My Music'

To delete all asx and b4s playlists found in d:\mp3 and its children:

  'abD' mp3 'd:\mp3'

The  file  and  sub-directory  lists  are simply created with ⎕CMD & Dir command
(because Dir switches made the logic pretty easy).

N.B.  I cannot guarantee that the playlist files will work in every machine con-
figuration   -  I  have just sort of reverse engineered the minimum file formats
that seem to work adequately in my machines.

Examples:

        mp3 'd:\mp3'  ⍝ create m3u playlist files (if there are any mp3 files)
                      ⍝ in the directory d:\mp3 and its sub-directories.

        mp3 'd:' 'c:' ⍝ create m3u files in every C: and D: directory where
                      ⍝ there are mp3 files..

  'apw' mp3 'd:\mp3'  ⍝ create the asx, pls and wpl playlist files.

 'apwN' mp3 'd:\mp3'  ⍝ as the previous example, but create only new playlists.

'apwNP' mp3 'd:\mp3'  ⍝ ditto, now the file lists contain paths.

 'apwD' mp3 'd:\mp3'  ⍝ delete asx, pls and wpl playlists.

'apwDS' mp3 'd:\mp3'  ⍝ ditto, but only from the d:\mp3 directory.

Back to: contents

Back to: Dyalog APL

Trouble seeing APL font?