Scripting way to upload videos to peertube and youtube
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

62 lines
1.9 KiB

from yapsy.PluginManager import PluginManager
import pluginInterfaces as pi
import logging
# logging.basicConfig(level=logging.DEBUG)
def loadPlugins(type):
# Load the plugins from the plugin directory.
# TODO: subdirectories too?
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,
})
manager.collectPlugins()
# Loop round the plugins and print their names.
print("debug")
print(manager.getAllPlugins())
print("all plugins")
for plugin in manager.getAllPlugins():
plugin.plugin_object.print_name()
print("Category: Interface")
for plugin in manager.getPluginsOfCategory("Interface"):
plugin.plugin_object.print_name()
print("Category: Platform")
for plugin in manager.getPluginsOfCategory("Platform"):
plugin.plugin_object.print_name()
# discovered_plugins = {
# name: importlib.import_module(name)
# for finder, name, ispkg
# in pkgutil.iter_modules(["/home/zykino/Documents/0DocPerso/Code/prismedia/plugins"])
# if name.startswith("prismedia_" + type + "_")
# }
#def test_loadPlugins(arg):
platforms = loadPlugins("platform")
print (platforms)
def startInterface():
interface = loadPlugins("interface")
options = interface["default"].run()
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)