#!/usr/bin/python
|
|
# coding: utf-8
|
|
|
|
import video
|
|
|
|
from yapsy.PluginManager import PluginManager
|
|
import pluginInterfaces as pi
|
|
import logging
|
|
|
|
# logging.basicConfig(level=logging.DEBUG)
|
|
|
|
def loadPlugins():
|
|
manager = PluginManager()
|
|
manager.setPluginPlaces(["plugins"]) # TODO: Generate the absolute path
|
|
|
|
# Define the various categories corresponding to the different
|
|
# kinds of plugins you have defined
|
|
manager.setCategoriesFilter({
|
|
"Interface" : pi.IInterfacePlugin,
|
|
"Platform" : pi.IPlatformPlugin,
|
|
"Consumer" : pi.IConsumerPlugin,
|
|
})
|
|
|
|
manager.collectPlugins()
|
|
return manager # TODO: Use the singleton PluginManager?
|
|
|
|
|
|
print("# Plugins")
|
|
#def test_loadPlugins(arg):
|
|
manager = loadPlugins()
|
|
# Loop round the plugins and print their names.
|
|
print("debug")
|
|
print(manager.getAllPlugins())
|
|
|
|
print("all plugins")
|
|
for plugin in manager.getAllPlugins():
|
|
print(plugin.name)
|
|
# plugin.plugin_object.print_name()
|
|
|
|
print("Category: Interface")
|
|
for plugin in manager.getPluginsOfCategory("Interface"):
|
|
print(plugin.name)
|
|
# plugin.plugin_object.print_name()
|
|
|
|
print("Category: Platform")
|
|
for plugin in manager.getPluginsOfCategory("Platform"):
|
|
print(plugin.name)
|
|
# plugin.plugin_object.print_name()
|
|
|
|
|
|
print()
|
|
print("# Video")
|
|
v = video.Video("/path/to/video")
|
|
v.name = "vidéo"
|
|
print(v.__dict__)
|
|
print(v.thumbnail)
|
|
|
|
# def startInterface():
|
|
# interface = loadPlugins()
|
|
#
|
|
# options = interface["default"].run() # Do I need this to extract basic cli? like an option "--interface=xxx"
|
|
# if options.get('--interface'):
|
|
# if interface[options.get('--interface')]:
|
|
# options = interface[options.get('--interface')].run(options)
|
|
# else:
|
|
# options = interface["cli"].run(options)
|
|
# options = interface["nfo"].run(options)
|
|
#
|
|
# def uploadToPlatforms(options):
|
|
# platforms = loadPlugins("platform")
|
|
# for platform in options.get('--platform'):
|
|
# platforms[platform].run(options)
|