Created
May 21, 2015 10:39
-
-
Save RyuaNerin/b71fc1ae73709806f56a to your computer and use it in GitHub Desktop.
우사긔 로딩
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding:utf-8 -*- | |
import datetime | |
from twython import Twython | |
from time import sleep | |
usagi = Twython('우사기', '우사기', '우사기', '우사기') | |
if __name__ == "__main__": | |
now = datetime.datetime.now() | |
toDormitory = False | |
week = now.weekday() | |
if week == 4: | |
if now.hour > 17 or (now.hour == 17 and now.minute >= 30): | |
toDormitory = True | |
elif week == 5: | |
toDormitory = True | |
elif week == 6: | |
if now.hour < 21: | |
toDormitory = True | |
secs = 0 | |
text = '' | |
if toDormitory: | |
target = datetime.datetime( \ | |
year = now.year, \ | |
month = now.month, \ | |
day = now.day, \ | |
hour = 21 \ | |
) + datetime.timedelta(days = 6 - week) | |
secs = 51.5 * 60 * 60 | |
text = '기숙사긔 로딩중 : ' | |
else: | |
target = datetime.datetime( \ | |
year = now.year, \ | |
month = now.month, \ | |
day = now.day, \ | |
hour = 17, \ | |
minute = 30 \ | |
) + datetime.timedelta(days = 4 - week if week < 5 else 5) | |
secs = 116.5 * 60 * 60 | |
text = '집사긔 로딩중 : ' | |
rem = target - now | |
sec = rem.total_seconds() | |
per = 100 - sec / secs * 100 | |
perb = int(per / 5) | |
text += '%.3f %%\n%s %d일 %d시간 %d분 %d초 %s남았습니다\n|' % ( \ | |
per, \ | |
"겨우" if toDormitory else "아직", \ | |
rem.days, \ | |
rem.seconds // 3600, \ | |
rem.seconds // 60 % 60, \ | |
rem.seconds % 60, \ | |
"밖에 안 " if toDormitory else "씩이나 " ) | |
for _i in range(0, perb): | |
text += '■' | |
if perb < 20: | |
for _i in range(perb + 1, 20): | |
text += '□' | |
text += '|' | |
try: | |
usagi.update_status(status = text) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment