Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

UploadAttachedMediaRequest.py 2.7KB

před 1 rokem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # -*- coding: UTF-8 -*-
  2. """
  3. # Class UploadAttachedMediaRequest
  4. #
  5. # Aliyun VoD's Upload Attached Media(such as watermark,subtitle files) Request class, which wraps parameters to upload an media file into VoD.
  6. # Users could pass parameters to AliyunVodUploader, including File Path,Title,etc. via an UploadAttachedMediaRequest instance.
  7. # For more details, please check out the VoD API document: https://help.aliyun.com/document_detail/98467.html
  8. """
  9. from vodsdk.AliyunVodUtils import *
  10. class UploadAttachedMediaRequest:
  11. def __init__(self, filePath, businessType, title=None, fileExt=None):
  12. """
  13. constructor for UploadAttachedMediaRequest
  14. :param filePath: string, 文件的绝对路径,或者网络文件的URL,必须含有扩展名
  15. :return
  16. """
  17. self.businessType = businessType
  18. self.filePath = None
  19. self.fileName = None
  20. self.mediaExt = None
  21. self.title = None
  22. self.setFilePath(filePath, title, fileExt)
  23. self.fileSize = None
  24. self.cateId = None
  25. self.tags = None
  26. self.description = None
  27. self.userData = None
  28. self.storageLocation = None
  29. self.appId = None
  30. self.workflowId = None
  31. def setFilePath(self, filePath, title=None, fileExt=None):
  32. if fileExt is None:
  33. fileExt = AliyunVodUtils.getFileExtension(filePath)
  34. if not fileExt:
  35. raise AliyunVodException('ParameterError', 'InvalidParameter', 'filePath has no Extension')
  36. fileExt = fileExt.lstrip('.')
  37. self.mediaExt = fileExt
  38. self.filePath = AliyunVodUtils.toUnicode(filePath)
  39. briefPath, briefName = AliyunVodUtils.getFileBriefPath(self.filePath)
  40. self.fileName = briefPath
  41. if fileExt and (not self.fileName.endswith('.' + fileExt)):
  42. self.fileName = self.fileName + '.' + fileExt
  43. if title:
  44. self.title = title
  45. else:
  46. if self.title is None:
  47. self.title = briefName
  48. def setBusinessType(self, businessType):
  49. self.businessType = businessType
  50. def setTitle(self, title):
  51. self.title = title
  52. def setFileSize(self, fileSize):
  53. self.fileSize = fileSize
  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