license.py (1429B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\cosmetics\common\structures\license.py 2 from datetime import datetime 3 4 class StructurePaintworkLicense(object): 5 6 def __init__(self, license_id, corp_id, char_id, structure_id, activation_timestamp, duration): 7 self._id = license_id 8 self._corp_id = corp_id 9 self._char_id = char_id 10 self._structure_id = structure_id 11 self._activation_timestamp = activation_timestamp 12 self._duration = duration 13 14 @property 15 def id(self): 16 return self._id 17 18 @property 19 def corp_id(self): 20 return self._corp_id 21 22 @property 23 def char_id(self): 24 return self._char_id 25 26 @property 27 def structure_id(self): 28 return self._structure_id 29 30 @property 31 def activation_timestamp(self): 32 return self._activation_timestamp 33 34 @property 35 def duration(self): 36 return self._duration 37 38 def get_remaining_time(self): 39 now = datetime.now() 40 elapsed = now - self._activation_timestamp 41 remaining = self._duration - elapsed.total_seconds() 42 return remaining 43 44 def __eq__(self, other): 45 return self.id == other.id and self.corp_id == other.corp_id and self.char_id == other.char_id and self.structure_id == other.structure_id and self.activation_timestamp == other.activation_timestamp and self.duration == other.duration