Commits

Travis Shirk committed 1672b4d

--plugins now sees user added, removed mp3 and echo plugin, etc.

  • Participants
  • Parent commits 46ef928
  • Branches stable

Comments (0)

Files changed (6)

File docs/api/plugins.rst

-================
+====================
 eyed3.plugins Module
-================
+====================
 
 .. automodule:: eyed3.plugins
     :members:

File docs/cli.rst

    plugins/genres_plugin
    plugins/lameinfo_plugin
    plugins/mimetypes_plugin
-   plugins/mp3_plugin
    plugins/nfo_plugin
    plugins/stats_plugin
    plugins/xep118_plugin

File docs/plugins/mp3_plugin.rst

-mp3 - MP3 Details
-=================
-
-.. {{{cog
-.. cog.out(cog_pluginHelp("mp3"))
-.. }}}
-.. {{{end}}}
 plugin_path = ~/.eyeD3:${HOME}/.eyeD3/plugins
 
 
-
+# vim: set filetype=dosini:

File src/eyed3/main.py

     return 0
 
 
-def _listPlugins():
+def _listPlugins(config):
     print("")
 
-    all_plugins = eyed3.plugins.load(reload=True)
+    all_plugins = eyed3.plugins.load(reload=True, paths=_getPluginPath(config))
     # Create a new dict for sorted display
     plugin_names = []
     for plugin in set(all_plugins.values()):
 
     return config
 
+def _getPluginPath(config):
+    plugin_path = []
+    if config and config.has_option("default", "plugin_path"):
+        val = config.get("default", "plugin_path")
+        plugin_path = [os.path.expanduser(os.path.expandvars(d)) for d
+                            in val.split(':')]
+    return plugin_path
+
 
 def profileMain(args, config):  # pragma: no cover
     '''This is the main function for profiling
         plugin_name = DEFAULT_PLUGIN
     assert(plugin_name)
 
-    plugin_path = []
-    if config and config.has_option("default", "plugin_path"):
-        val = config.get("default", "plugin_path")
-        plugin_path = [os.path.expanduser(os.path.expandvars(d)) for d
-                            in val.split(':')]
-
-
-    PluginClass = eyed3.plugins.load(plugin_name, paths=plugin_path)
+    PluginClass = eyed3.plugins.load(plugin_name, paths=_getPluginPath(config))
     if PluginClass is None:
         eyed3.utils.cli.printError("Plugin not found: %s" % plugin_name)
         parser.exit(1)
     args = parser.parse_args(args=cmd_line_args)
 
     if args.list_plugins:
-        _listPlugins()
+        _listPlugins(config)
         parser.exit(0)
 
     args.plugin = plugin

File src/eyed3/plugins/examples.py

 from eyed3.utils.cli import printMsg
 
 
-class EchoPlugin(Plugin):
-    SUMMARY = u"Displays each filename passed to the plugin."
-    NAMES = ["echo"]
-
-    def handleFile(self, f):
-        print("%s\t\t[ %s ]" % (os.path.basename(f), os.path.dirname(f)))
-        return self.R_CONT
-
-
-class Mp3InfoPlugin(Plugin):
-    SUMMARY = u"Displays details about mp3 headers"
-    NAMES = ["mp3"]
-
-    def handleFile(self, f):
-        from binascii import hexlify
-        from eyed3.mp3.headers import findHeader, Mp3Header
-
-        with open(f, "rb") as fp:
-            offset, header, header_str = findHeader(fp)
-            if None in [offset, header, header_str]:
-                printMsg("%s:\n\tNone" % f)
-            else:
-                printMsg("%s:\n\toffset:%d (%s) header:%d header bytes:%s" %
-                         (f, offset, hex(offset), header, hexlify(header_str)))
-                header = Mp3Header(header)
-                printMsg("\tHEADER: %s" % header)
-
-        return self.R_CONT
-
-
 class MimeTypesPlugin(Plugin):
     SUMMARY = u"Displays the mime-type for each file encountered"
     NAMES = ["mimetypes", "mt"]