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.
 

67 lines
1.7 KiB

from enum import Enum
from yapsy.IPlugin import IPlugin
class PluginTypes(Enum):
"""Plugin Types possibles to instantiate in this program."""
INTERFACE = "Interface"
PLATFORM = "Platform"
CONSUMER = "Consumer"
###
# Interface
###
# TODO: The interface is not thought out yet
class IInterfacePlugin(IPlugin):
"""
Interface for the Interface plugin category.
"""
def getOptions(self, args):
"""
Returns the options user has set.
- `args` the command line arguments passed to Prismedia
"""
raise NotImplementedError("`getOptions` must be reimplemented by %s" % self)
###
# Platform
###
class IPlatformPlugin(IPlugin):
"""
Interface for the Platform plugin category.
"""
# def dryrun(self, video, options):
# """
# Simulate an upload but without really uploading anything.
# """
# raise NotImplementedError("`dryrun` must be reimplemented by %s" % self)
def hearthbeat(self):
"""
If needed for your platform, use a bit of the api so the platform is aware the keys are still in use.
"""
raise NotImplementedError("`hearthbeat` must be reimplemented by %s" % self)
def upload(self, video, options):
"""
The upload function
"""
raise NotImplementedError("`upload` must be reimplemented by %s" % self)
###
# Consumer
###
# TODO: The interface is not thought out yet
class IConsumerPlugin(IPlugin):
"""
Interface for the Consumer plugin category.
"""
def finished(self, video):
"""
What to do once the uploads are done.
- `video` is an object containing the video details. The `platforms` key contain a list of the platforms the video has been uploaded to and the status
"""
raise NotImplementedError("`getOptions` must be reimplemented by %s" % self)