from enum import Enum from yapsy.IPlugin import IPlugin class PluginTypes(Enum): """Plugin Types possibles to instantiate in this program.""" ALL = "All" INTERFACE = "Interface" PLATFORM = "Platform" CONSUMER = "Consumer" class IPrismediaBasePlugin(IPlugin): """ Base for prismedia’s plugin. """ def prepare_options(self, video, options): """ Return a falsy value to exit the program. - `video`: video object to be uploaded - `options`: a dictionary of options to be used by Prismedia and other plugins """ raise NotImplementedError("`prepare_options` must be reimplemented by %s" % self) ### # Interface ### class IInterfacePlugin(IPrismediaBasePlugin): """ Interface for the Interface plugin category. """ # TODO: Add callback for communicating upload’s progress to the user ### # Platform ### class IPlatformPlugin(IPrismediaBasePlugin): """ Interface for the Platform plugin category. """ def heartbeat(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("`heartbeat` must be reimplemented by %s" % self) def upload(self, video, options): """ The upload function """ raise NotImplementedError("`upload` must be reimplemented by %s" % self) ### # Consumer ### class IConsumerPlugin(IPrismediaBasePlugin): """ Interface for the Consumer plugin category. """ def finished(self, video, options): """ 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("`finished` must be reimplemented by %s" % self)