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.

39 lines
2.0 KiB

  1. import pluginInterfaces as pi
  2. import utils
  3. import video as vid
  4. class Cli(pi.IInterfacePlugin):
  5. """
  6. This is the default interface plugin. It is used when no interface plugin is specified.
  7. """
  8. def prepare_options(self, video, options):
  9. video.path = utils.getOption(options, "--file", video.path)
  10. video.thumbnail = utils.getOption(options, "--thumbnail", video.thumbnail)
  11. video.name = utils.getOption(options, "--name", video.name)
  12. video.description = utils.getOption(options, "--description", video.description)
  13. video.playlistName = utils.getOption(options, "--playlist", video.playlistName)
  14. video.privacy = utils.getOption(options, "--privacy", video.privacy).lower()
  15. video.category = utils.getOption(options, "--category", video.category).lower()
  16. tags = utils.getOption(options, "--tag", video.tags)
  17. if isinstance(tags, str):
  18. tags = tags.split(",")
  19. video.tags = tags
  20. video.language = utils.getOption(options, "--language", video.language).lower()
  21. video.originalDate = utils.getOption(options, "--original-date", video.originalDate)
  22. # TODO: set as an object: { "all": date1, "platformX": date2, …}?
  23. # Maybe the publishAt by platform is better placed in `self.platform`
  24. # And so publishAt would only contains the global date.
  25. video.publishAt = utils.getOption(options, "--publish-at", video.publishAt)
  26. # TODO: Add a list of licences
  27. video.licence = utils.getOption(options, "--licence", video.licence)
  28. video.disableComments = utils.getOption(options, "--disable-comments", video.disableComments)
  29. video.nsfw = utils.getOption(options, "--nsfw", video.nsfw)
  30. autoOriginalDate = utils.getOption(options, "--auto-original-date", False)
  31. if autoOriginalDate:
  32. # TODO: Implement
  33. raise NotImplementedError("--auto-original-date functionality is not yet implemented.")
  34. return video