Browse Source

WIP Use spaces for indentation

plugins
Zykino 3 years ago
parent
commit
85b86db751
2 changed files with 55 additions and 53 deletions
  1. +21
    -20
      prismedia/core.py
  2. +34
    -33
      prismedia/pluginInterfaces.py

+ 21
- 20
prismedia/core.py View File

@ -2,7 +2,7 @@
# coding: utf-8
# NOTE: Since we use config file to set some defaults values, it is not possible to use the standard syntax with brackets, we use parenthesis instead.
# If we were to use them we would overide configuration file values with default values of cli.
# If we were to use them we would overide configuration file values with default values of cli.
"""
prismedia - tool to upload videos to different platforms (historicaly Peertube and Youtube)
@ -14,9 +14,9 @@ Usage:
Options:
-f, --file=STRING Path to the video file to upload in mp4. This is the only mandatory option.
--thumbnail=STRING Path to a file to use as a thumbnail for the video.
--name=NAME Name of the video to upload. (default to video filename)
--name=NAME Name of the video to upload. (default to video filename)
-d, --description=STRING Description of the video. (default: default description)
-t, --tags=STRING Tags for the video. comma separated.
-t, --tag=STRING Tags for the video. comma separated.
WARN: tags with punctuation (!, ', ", ?, ...)
are not supported by Mastodon to be published from Peertube
-c, --category=STRING Category for the videos, see below. (default: Films)
@ -56,10 +56,10 @@ Options:
-V, --version Show the version.
Plugins options:
<interface> Interface plugin to use. Select the interface you want to use. By default the interface is the command line.
--platform=STRING Platforms plugins to use. Usually one platform plugin upload to one platform website (comma separated list) (default: all)
--consumer=STRING Consumers plugins to use. They are executed after an upload has been done (comma separated list) (default: all)
--list-plugins List all the plugins currently installed by category.
<interface> Interface plugin to use. Select the interface you want to use. By default the interface is the command line.
--platform=STRING Platforms plugins to use. Usually one platform plugin upload to one platform website (comma separated list) (default: all)
--consumer=STRING Consumers plugins to use. They are executed after an upload has been done (comma separated list) (default: all)
--list-plugins List all the plugins currently installed by category.
Logging options:
--log=STRING Log level, between debug, info, warning, error, critical. Ignored if --quiet is set (default to info)
@ -76,18 +76,18 @@ Strict options:
All strict options can be specified in NFO directly, the only strict option mandatory on cli is --withNFO
All strict options are off by default
--withNFO Prevent the upload without a NFO, either specified via cli or found in the directory
--withThumbnail Prevent the upload without a thumbnail
--withName Prevent the upload if no name are found
--withDescription Prevent the upload without description
--withTags Prevent the upload without tags
--withPlaylist Prevent the upload if no playlist
--withPublishAt Prevent the upload if no schedule
--withOriginalDate Prevent the upload if no original date configured
--withPlatform Prevent the upload if at least one platform is not specified
--withCategory Prevent the upload if no category
--withLanguage Prevent upload if no language
--withChannel Prevent upload if no channel
--with-NFO Prevent the upload without a NFO, either specified via cli or found in the directory
--with-thumbnail Prevent the upload without a thumbnail
--with-name Prevent the upload if no name are found
--with-description Prevent the upload without description
--with-tag Prevent the upload without tags
--with-playlist Prevent the upload if no playlist
--with-publish-at Prevent the upload if no schedule
--with-original-date Prevent the upload if no original date configured
--with-platform Prevent the upload if at least one platform is not specified
--with-category Prevent the upload if no category
--with-language Prevent upload if no language
--with-channel Prevent upload if no channel
Categories:
Category is the type of video you upload. Default is films.
@ -148,7 +148,8 @@ def listPlugins():
def main():
basePluginsPath = [os.path.dirname(os.path.abspath(__file__)) + "/plugins"]
manager = loadPlugins(basePluginsPath)
loadPlugins(basePluginsPath)
manager = PluginManagerSingleton.get()
options = docopt(__doc__, version=VERSION)
print(options)

+ 34
- 33
prismedia/pluginInterfaces.py View File

@ -2,66 +2,67 @@ 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"
"""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.
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)
"""
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 dryrun(self, video, options):
# """
# Simulate an upload but without really uploading anything.
# """
# raise NotImplementedError("`dryrun` must be reimplemented by %s" % self)
def hearthbeat(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)
"""
raise NotImplementedError("`hearthbeat` must be reimplemented by %s" % self)
def upload(self, video, options):
"""
def upload(self, video, options):
"""
The upload function
"""
raise NotImplementedError("`upload` must be reimplemented by %s" % self)
"""
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.
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)
"""
raise NotImplementedError("`getOptions` must be reimplemented by %s" % self)

Loading…
Cancel
Save