Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

85 lignes
2.6KB

  1. # -*- coding: UTF-8 -*-
  2. """
  3. # Class UploadImageRequest
  4. #
  5. # Aliyun VoD's Upload Image Request class, which wraps parameters to upload an image into VoD.
  6. # Users could pass parameters to AliyunVodUploader, including File Path,Title,etc. via an UploadImageRequest instance.
  7. # For more details, please check out the VoD API document: https://help.aliyun.com/document_detail/55619.html
  8. """
  9. from voduploadsdk.AliyunVodUtils import *
  10. class UploadImageRequest:
  11. def __init__(self, filePath, title=None, fileExt=None):
  12. """
  13. constructor for UploadVideoRequest
  14. :param filePath: string, 文件的绝对路径,或者网络文件的URL,必须含有扩展名
  15. :param title: string, 图片标题
  16. :return
  17. """
  18. self.filePath = None
  19. self.fileName = None
  20. self.imageExt = None
  21. self.mediaExt = None
  22. self.title = None
  23. self.setFilePath(filePath, title, fileExt)
  24. self.imageType = 'default'
  25. self.cateId = None
  26. self.tags = None
  27. self.description = None
  28. self.userData = None
  29. self.storageLocation = None
  30. self.appId = None
  31. self.workflowId = None
  32. def setFilePath(self, filePath, title=None, fileExt=None):
  33. if fileExt is None:
  34. fileExt = AliyunVodUtils.getFileExtension(filePath)
  35. if not fileExt:
  36. raise AliyunVodException('ParameterError', 'InvalidParameter', 'filePath has no Extension')
  37. fileExt = fileExt.lstrip('.')
  38. self.imageExt = fileExt
  39. self.mediaExt = fileExt
  40. self.filePath = AliyunVodUtils.toUnicode(filePath)
  41. briefPath, briefName = AliyunVodUtils.getFileBriefPath(self.filePath)
  42. self.fileName = briefPath
  43. if fileExt and (not self.fileName.endswith('.' + fileExt)):
  44. self.fileName = self.fileName + '.' + fileExt
  45. if title:
  46. self.title = title
  47. else:
  48. if self.title is None:
  49. self.title = briefName
  50. def setImageType(self, imageType):
  51. self.imageType = imageType
  52. def setTitle(self, title):
  53. self.title = title
  54. def setCateId(self, cateId):
  55. self.cateId = cateId
  56. def setTags(self, tags):
  57. self.tags = tags
  58. def setDescription(self, description):
  59. self.description = description
  60. def setStorageLocation(self, storageLocation):
  61. self.storageLocation = storageLocation
  62. def setUserData(self, userData):
  63. self.userData = userData
  64. def setAppId(self, appId):
  65. self.appId = appId
  66. def setWorkflowId(self, workflowId):
  67. self.workflowId = workflowId