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.
 

48 lines
2.0 KiB

import pluginInterfaces as pi
import utils
import video as vid
from yapsy.PluginManager import PluginManagerSingleton
def helperFunctionnality(options):
pluginManager = PluginManagerSingleton.get()
optionName = "--hearthbeat"
if options.get(optionName):
for plugin in pluginManager.getPluginsOfCategory(pi.PluginTypes.PLATFORM):
plugin.plugin_object.hearthbeat()
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)
video.category = utils.getOption(options, "--category", video.category)
video.tags = utils.getOption(options, "--tag", video.tags)
video.language = utils.getOption(options, "--language", video.language)
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 functionnality is not yet implemented.")
return video