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

  1. import pluginInterfaces as pi
  2. import utils
  3. import video as vid
  4. from yapsy.PluginManager import PluginManagerSingleton
  5. def helperFunctionnality(options):
  6. pluginManager = PluginManagerSingleton.get()
  7. optionName = "--hearthbeat"
  8. if options.get(optionName):
  9. for plugin in pluginManager.getPluginsOfCategory(pi.PluginTypes.PLATFORM):
  10. plugin.plugin_object.hearthbeat()
  11. return False
  12. else:
  13. options.pop(optionName)
  14. return True
  15. def parseOptions(options):
  16. video = vid.Video()
  17. video.path = utils.getOption(options, "--file", video.path)
  18. video.thumbnail = utils.getOption(options, "--thumbnail", video.thumbnail)
  19. video.name = utils.getOption(options, "--name", video.name)
  20. video.description = utils.getOption(options, "--description", video.description)
  21. video.playlistName = utils.getOption(options, "--playlist", video.playlistName)
  22. video.privacy = utils.getOption(options, "--privacy", video.privacy)
  23. video.category = utils.getOption(options, "--category", video.category)
  24. video.tags = utils.getOption(options, "--tag", video.tags)
  25. video.language = utils.getOption(options, "--language", video.language)
  26. video.originalDate = utils.getOption(options, "--original-date", video.originalDate)
  27. # TODO: set as an object: { "all": date1, "platformX": date2, …}?
  28. # Maybe the publishAt by platform is better placed in `self.platform`
  29. # And so publishAt would only contains the global date.
  30. video.publishAt = utils.getOption(options, "--publish-at", video.publishAt)
  31. # TODO: Add a list of licences
  32. video.licence = utils.getOption(options, "--licence", video.licence)
  33. video.disableComments = utils.getOption(options, "--disable-comments", video.disableComments)
  34. video.nsfw = utils.getOption(options, "--nsfw", video.nsfw)
  35. autoOriginalDate = utils.getOption(options, "--auto-original-date", False)
  36. if autoOriginalDate:
  37. # TODO: Implement
  38. raise NotImplementedError("--auto-original-date functionnality is not yet implemented.")
  39. return video