Here's a python script to list all the externals in a directory.
It goes through all the subdirectories too.
Problem with MSW pd externals: they end in '.dll', which could be any shared library. Linux and OSX externals end in '.pd_darwin' or '.pd_linux' so they can't be confused.

I tried it with a cygwin terminal like this:
python pddlls.py "C:\Program Files\pd\extra"
...and got a list of 2502 objects.

Martin


Jamie Bullock wrote:
Lao Yu wrote:
> from the ongoing discussion about Max/MSP compatibility I wonder if
> it would be a good idea to create a list of available objects in the
> extended version, quite as it exists for vanilla. For someone who is
> getting acquainted - like me - it sure would be a useful thing, I
> mean like '5.referemce/help-intro.pd'. Does anybody work on such a
> thing?

The attached script might serve as a starting point for something. It
will list all externals under a given 'extra' directory, and optionally
print all the comments from the corresponding help file if there is one.

It could easily be adapted to output in csv format, or print the library
a given external is part of.

One caveat: it assumes that your extra directory has only one level of
nesting, so it only looks in extra/ and extra/* not extra/*/* etc.

Jamie

#! /usr/bin/env python

"""List pd dlls.

usage: pddlls [extradir]
extradir: directory to be scanned for pd externals and abstractions (default current)
"""

import os
import sys

verbose = 1

# Main program: parse command line and start processing
def main():
   global verbose
   extradir = './' # default is current dir
   if sys.argv[1:]: # otherwise get it from the command line
       extradir = sys.argv[1]
   if not os.path.isdir(extradir): # exit if it doesn't exist
       print "directory doesn't exist", repr(extradir)
       sys.exit(2)
   listpdexternsinsubdirs(extradir)

# Recursively list pd externals and abstractions in extradir
def listpdexternsinsubdirs(extradir):
   item = 0 # count of valid externs
for root, dirs, files in os.walk(extradir): #recursively walk the directory
       for name in files:
           extension = str.lower(name) # make name lower case
           pathname = os.path.join(root, name) # make the full path
           pname = pathname.partition('/')[2] # relative to extradir
           pdtype = 'not' # default not an external
           if pname.endswith('.pd'):
               pdtype = 'abstraction'
           elif pname.endswith('.dll'): # not necessarily pd though...
               pdtype = 'MSW external'
           elif pname.endswith('.pd_linux'):
               pdtype = 'linux external'
           elif pname.endswith('.pd_darwin'):
               pdtype = 'OSX external'
           if pdtype != 'not': # a valid object
               item += 1
               if verbose:
                   print '%04d-->' % (item), pdtype, pname

if __name__ == '__main__':
   main()

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to