# -*- coding: utf-8 -*-
from os import listdir
from os.path import abspath, splitext
from Plugins.Bp.geminimain.gTools import gPluginPath

NetcastPlugins = []

def addNetcastPlugin(NetcastPlugin):
	NetcastPlugins.append(NetcastPlugin)

def importExternalModules():
	dir = abspath(gPluginPath + "geminidreamnetcast/plugins/")
	for file in listdir(dir):
		module_name, ext = splitext(file) # Handles no-extension files, etc.

		if ext == '.py' and module_name != "__init__":
			try:
				exec "import " + module_name
				print '[__init__.importExternalModules] Imported external import %s' % (module_name)

			except ImportError, e:
				print '[__init__.importExternalModules] Could NOT import external module: %s' % (module_name)
				print '[__init__.importExternalModules] Exception Caught\n%s' %e

