@ -1,52 +0,0 @@ | |||||
import pluginInterfaces as pi | |||||
import utils | |||||
import video as vid | |||||
from yapsy.PluginManager import PluginManagerSingleton | |||||
def helperFunctionality(options): | |||||
pluginManager = PluginManagerSingleton.get() | |||||
optionName = "--heartbeat" | |||||
if options.get(optionName): | |||||
for plugin in pluginManager.getPluginsOfCategory(pi.PluginTypes.PLATFORM): | |||||
plugin.plugin_object.heartbeat() | |||||
return False | |||||
else: | |||||
options.pop(optionName) | |||||
return True | |||||
def parseOptions(options): | |||||
video = vid.Video() | |||||
video.path = utils.getOption(options, "--file", video.path) | |||||
video.thumbnail = utils.getOption(options, "--thumbnail", video.thumbnail) | |||||
video.name = utils.getOption(options, "--name", video.name) | |||||
video.description = utils.getOption(options, "--description", video.description) | |||||
video.playlistName = utils.getOption(options, "--playlist", video.playlistName) | |||||
video.privacy = utils.getOption(options, "--privacy", video.privacy).lower() | |||||
video.category = utils.getOption(options, "--category", video.category).lower() | |||||
tags = utils.getOption(options, "--tag", video.tags) | |||||
if isinstance(tags, str): | |||||
tags = tags.split(",") | |||||
video.tags = tags | |||||
video.language = utils.getOption(options, "--language", video.language).lower() | |||||
video.originalDate = utils.getOption(options, "--original-date", video.originalDate) | |||||
# TODO: set as an object: { "all": date1, "platformX": date2, …}? | |||||
# Maybe the publishAt by platform is better placed in `self.platform` | |||||
# And so publishAt would only contains the global date. | |||||
video.publishAt = utils.getOption(options, "--publish-at", video.publishAt) | |||||
# TODO: Add a list of licences | |||||
video.licence = utils.getOption(options, "--licence", video.licence) | |||||
video.disableComments = utils.getOption(options, "--disable-comments", video.disableComments) | |||||
video.nsfw = utils.getOption(options, "--nsfw", video.nsfw) | |||||
autoOriginalDate = utils.getOption(options, "--auto-original-date", False) | |||||
if autoOriginalDate: | |||||
# TODO: Implement | |||||
raise NotImplementedError("--auto-original-date functionality is not yet implemented.") | |||||
return video |
@ -0,0 +1,10 @@ | |||||
[Core] | |||||
Name = cli | |||||
Module = cli | |||||
[Documentation] | |||||
Author = Zykino | |||||
Version = 0.1 | |||||
Website = https://git.lecygnenoir.info/LecygneNoir/prismedia | |||||
Description = This interface plugin is used to get the videos details from the Command Line Interface (cli). | |||||
To work properly it needs to have the `--file="<path/to/you/vide/file>"` argument |
@ -0,0 +1,39 @@ | |||||
import pluginInterfaces as pi | |||||
import utils | |||||
import video as vid | |||||
class Cli(pi.IInterfacePlugin): | |||||
""" | |||||
This is the default interface plugin. It is used when no interface plugin is specified. | |||||
""" | |||||
def prepare_options(self, video, options): | |||||
video.path = utils.getOption(options, "--file", video.path) | |||||
video.thumbnail = utils.getOption(options, "--thumbnail", video.thumbnail) | |||||
video.name = utils.getOption(options, "--name", video.name) | |||||
video.description = utils.getOption(options, "--description", video.description) | |||||
video.playlistName = utils.getOption(options, "--playlist", video.playlistName) | |||||
video.privacy = utils.getOption(options, "--privacy", video.privacy).lower() | |||||
video.category = utils.getOption(options, "--category", video.category).lower() | |||||
tags = utils.getOption(options, "--tag", video.tags) | |||||
if isinstance(tags, str): | |||||
tags = tags.split(",") | |||||
video.tags = tags | |||||
video.language = utils.getOption(options, "--language", video.language).lower() | |||||
video.originalDate = utils.getOption(options, "--original-date", video.originalDate) | |||||
# TODO: set as an object: { "all": date1, "platformX": date2, …}? | |||||
# Maybe the publishAt by platform is better placed in `self.platform` | |||||
# And so publishAt would only contains the global date. | |||||
video.publishAt = utils.getOption(options, "--publish-at", video.publishAt) | |||||
# TODO: Add a list of licences | |||||
video.licence = utils.getOption(options, "--licence", video.licence) | |||||
video.disableComments = utils.getOption(options, "--disable-comments", video.disableComments) | |||||
video.nsfw = utils.getOption(options, "--nsfw", video.nsfw) | |||||
autoOriginalDate = utils.getOption(options, "--auto-original-date", False) | |||||
if autoOriginalDate: | |||||
# TODO: Implement | |||||
raise NotImplementedError("--auto-original-date functionality is not yet implemented.") | |||||
return video |