def getTimecodeFromDatetime(cls, time =None, zeroTime =None, rotationInterval =None): if zeroTime is None: zeroTime = cls._ZERO_TIME if rotationInterval is None: rotationInterval = cls._ROTATION_INTERVAL if time is None: time = datetime.datetime.utcnow() t = float(TimeUtils.datetimeToSeconds(time) - zeroTime)/60.0 t = float(rotationInterval)*math.floor(t/float(rotationInterval)) return Base64.to64(int(t))
def getTimecodeFromDatetime(cls, time =None, zeroTime =None, rotationInterval =None): if zeroTime is None: zeroTime = cls._ZERO_TIME if rotationInterval is None: rotationInterval = cls._ROTATION_INTERVAL if time is None: time = datetime.datetime.utcnow() t = float(TimeUtils.datetimeToSeconds(time) - zeroTime)/60.0 t = float(rotationInterval)*math.floor(t/float(rotationInterval)) return Base64.to64(int(t))
def generateExpiresUrl(self, key, expiresAtDateTime): delta = TimeUtils.datetimeToSeconds(expiresAtDateTime) - TimeUtils.getNowSeconds() return self._bucket.get_key(key_name=key).generate_url(expires_in=delta, force_http=True)
def generateExpiresUrl(self, key, expiresAtDateTime, secure=True): delta = TimeUtils.datetimeToSeconds( expiresAtDateTime) - TimeUtils.getNowSeconds() return self._bucket.get_key(key_name=key).generate_url( expires_in=delta, force_http=not secure)