Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv6643

Modified Files:
        plugin.py 
Log Message:
don't try to 'load' plugins that are already a python object

Index: plugin.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugin.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** plugin.py   8 Nov 2003 13:18:48 -0000       1.48
--- plugin.py   21 Nov 2003 11:43:00 -0000      1.49
***************
*** 10,13 ****
--- 10,19 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.49  2003/11/21 11:43:00  dischi
+ # don't try to 'load' plugins that are already a python object
+ #
+ # Revision 1.1  2003/11/16 09:57:23  dischi
+ # bugfix and make the DirwatcherThread a plugin
+ #
  # Revision 1.48  2003/11/08 13:18:48  dischi
  # add AUDIOCD as plugin type
***************
*** 205,209 ****
  
      for p in __all_plugins__:
!         if p[0] == name and p[1] == type and p[3] == args:
              print 'WARNING: duplicate plugin activation, ignoring:'
              print '<%s %s %s>' % (name, type, args)
--- 211,215 ----
  
      for p in __all_plugins__:
!         if not isinstance(name, Plugin) and p[0] == name and p[1] == type and p[3] 
== args:
              print 'WARNING: duplicate plugin activation, ignoring:'
              print '<%s %s %s>' % (name, type, args)
***************
*** 449,492 ****
      files = []
  
!     module, special = __find_plugin_file__(name.replace('.', '/'))
!     if module:
!         object = module + '.PluginInterface'
!     elif name.find('.') > 0:
!         module, special = __find_plugin_file__(name[:name.rfind('.')].replace('.', 
'/'))
          if module:
!             object = module + '.%s' % name[name.rfind('.')+1:]
          else:
              print 'can\'t locate plugin %s' % name
              print 'start \'freevo plugins -l\' to get a list of plugins'
              return
-     else:
-         print 'can\'t locate plugin %s' % name
-         print 'start \'freevo plugins -l\' to get a list of plugins'
-         return
          
      try:
!         if DEBUG:
!             print 'loading %s as plugin %s' % (module, object)
!             
!         exec('import %s' % module)
!         if not args:
!             p = eval(object)()
!         elif isinstance(args, list) or isinstance(args, tuple):
!             paramlist = 'args[0]'
!             for i in range(1, len(args)):
!                 paramlist += ',args[%s]' % i
!             p = eval('%s(%s)' % (object, paramlist))
!         else:
!             p = eval(object)(args)
  
!         if not hasattr(p, '_type'):
!             if hasattr(p, 'reason'):
!                 reason = p.reason
              else:
!                 reason = 'unknown\nThe plugin neither called __init__ nor set a '\
!                          'reason why\nPlease contact the plugin author or the freevo 
list'
!             print 'plugin %s deactivated, reason: %s' % (name, reason)
!             return
!         
          p._number = number
          p._level = level
--- 455,502 ----
      files = []
  
!     if not isinstance(name, Plugin):
!         module, special = __find_plugin_file__(name.replace('.', '/'))
          if module:
!             object = module + '.PluginInterface'
!         elif name.find('.') > 0:
!             module, special = 
__find_plugin_file__(name[:name.rfind('.')].replace('.', '/'))
!             if module:
!                 object = module + '.%s' % name[name.rfind('.')+1:]
!             else:
!                 print 'can\'t locate plugin %s' % name
!                 print 'start \'freevo plugins -l\' to get a list of plugins'
!                 return
          else:
              print 'can\'t locate plugin %s' % name
              print 'start \'freevo plugins -l\' to get a list of plugins'
              return
          
      try:
!         if not isinstance(name, Plugin):
!             if DEBUG:
!                 print 'loading %s as plugin %s' % (module, object)
  
!             exec('import %s' % module)
!             if not args:
!                 p = eval(object)()
!             elif isinstance(args, list) or isinstance(args, tuple):
!                 paramlist = 'args[0]'
!                 for i in range(1, len(args)):
!                     paramlist += ',args[%s]' % i
!                 p = eval('%s(%s)' % (object, paramlist))
              else:
!                 p = eval(object)(args)
! 
!             if not hasattr(p, '_type'):
!                 if hasattr(p, 'reason'):
!                     reason = p.reason
!                 else:
!                     reason = 'unknown\nThe plugin neither called __init__ nor set a 
'\
!                              'reason why\nPlease contact the plugin author or the 
freevo list'
!                 print 'plugin %s deactivated, reason: %s' % (name, reason)
!                 return
!         else:
!             p = name
!             
          p._number = number
          p._level = level




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to