Skip to content

Commit

Permalink
更新单位
Browse files Browse the repository at this point in the history
  • Loading branch information
lc4t committed Feb 29, 2020
1 parent 471bc6b commit 8ff32f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions danmu/bili_danmu_giftthx.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,12 @@ async def get_gamestr(self):
# 1光秒 299792.458 km
if int(self.user.height) < 10**3:
height = '%dmm' % (self.user.height)
elif 10**3 <= int(self.user.height) < 10**6: # < 1km
elif 10**3 <= int(self.user.height) < 10**6: # 1m - 1km
height = '%.3fm' % (self.user.height/(10**3))
elif 10**6 <= self.user.height < 299792.458 * (10**6): # < 1光秒
height = '%.4f光秒' % (self.user.height/(10**6))
elif 10**6 <= int(self.user.height) < 10**9: # < 1km - 1kkm
height = '%.3fkm' % (self.user.height/(10**6))
elif 10**9 <= self.user.height < 86400 * 299792458000: # 光天
height = '%.4f光秒' % (self.user.height/(299792458000))
else:
height = '%.5f光年' % (self.user.height/(10**6)/149597870.7)
return weight, height
Expand Down

0 comments on commit 8ff32f0

Please sign in to comment.