Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)