-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmascountdown.py
140 lines (129 loc) · 6.83 KB
/
xmascountdown.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/python3
# Thu 20 Dec 2018 03:04:22 PM CET
# Author: Nicolas Flandrois
# Description: Christmas countdown, according to a choosen year.
# NB: This script is not UTC/Timezone aware.
# Time is set as naive, using your local (computer) timezone as default.
import time
import datetime
import os
import platform
import sys
def clean():
if platform.system() == "Windows":
os.system("cls")
elif platform.system() == "Linux":
os.system("clear")
try:
Year = int(input("Xmas of which year? "))
except:
print("Oops! ",sys.exc_info()[0],
""" occured. That was no valid number. Try again...
choose a year, in positive number, format YYYY.""")
r = range(1, 9999)
if Year not in r:
print("""Oops! That was no valid number.
REMINDER: choose a positive year number between 1 and 9999.
Try again...""")
xd = datetime.datetime(Year, 12, 25, 0, 0, 1)
clean()
while True:
td = datetime.datetime.now()
delta = xd - td
cd_Y = int(delta.days / 365)
cd_W = int(abs(delta.days - (cd_Y * 365)) / 7)
cd_D = int(abs(delta.days - ((cd_Y * 365)+ (cd_W * 7))))
cd_h = int(delta.seconds / 3600)
cd_m = int(abs(delta.seconds - (cd_h * 3600))/60)
cd_s = int(abs(delta.seconds - ( cd_h*3600 + cd_m*60 )))
print("# #")
print(" # # # # ## #### ")
print(" # # ## ## # # # ")
print(" # # ## # # # #### ")
print(" # # # # ###### #")
print(" # # # # # # # #")
print("# # # # # # #### ")
print("")
print(" #### #### # # # # ##### ##### #### # # # #")
print("# # # # # # ## # # # # # # # # ## #")
print("# # # # # # # # # # # # # # # # # #")
print("# # # # # # # # # # # # # # ## # # # #")
print("# # # # # # # ## # # # # # ## ## # ##")
print(" #### #### #### # # # ##### #### # # # #")
print("")
print("Countdown until christmas of: ", xd.strftime("%A, %d of %B %Y"))
print("")
print("Total days left: ", delta.days)
print("")
print("or more precisely, time left: ")
print(cd_Y, "Years", cd_W, "Weeks", cd_D, "Days - ", "%02d" % cd_h, ":",
"%02d" % cd_m, ":", "%02d" % cd_s, "; Local Time.")
print("")
time.sleep(1)
clean()
##############################################################################
# .:xxxxxxxx:.
# .xxxxxxxxxxxxxxxx.
# :xxxxxxxxxxxxxxxxxxx:.
# .xxxxxxxxxxxxxxxxxxxxxxx:
# :xxxxxxxxxxxxxxxxxxxxxxxxx:
# xxxxxxxxxxxxxxxxxxxxxxxxxxX:
# xxx:::xxxxxxxx::::xxxxxxxxx:
# .xx: ::xxxxx: :xxxxxxxx
# :xx x. xxxx: xx. xxxxxxxx
# :xx xxx xxxx: xxxx :xxxxxxx
# 'xx 'xx xxxx:. xx' xxxxxxxx
# xx ::::::xx:::::. xxxxxxxx
# xx:::::.::::.:::::::xxxxxxxx
# :x'::::'::::':::::':xxxxxxxxx.
# :xx.::::::::::::' xxxxxxxxxx
# :xx: '::::::::' :xxxxxxxxxx.
# .xx '::::' 'xxxxxxxxxx.
# .xxxx 'xxxxxxxxx.
# .xxxx 'xxxxxxxxx.
# .xxxxx: xxxxxxxxxx.
# .xxxxx:' xxxxxxxxxxx.
# .xxxxxx:::. . ..:::_xxxxxxxxxxx:.
# .xxxxxxx'' ':::'' ''::xxxxxxxxxxxx.
# xxxxxx : '::xxxxxxxxxxxx
# :xxxx:' : 'xxxxxxxxxxxx:
# .xxxxx : ::xxxxxxxxxxxx
# xxxx:' ::xxxxxxxxxxxx
# xxxx . ::xxxxxxxxxxxx.
# .:xxxxxx : ::xxxxxxxxxxxx::
# xxxxxxxx : ::xxxxxxxxxxxxx:
# xxxxxxxx : ::xxxxxxxxxxxxx:
# ':xxxxxx ' ::xxxxxxxxxxxx:'
# .:. xx:. .:xxxxxxxxxxxxx'
# ::::::.'xx:. : .:: xxxxxxxxxxx':
# .:::::::::::::::.'xxxx. ::::'xxxxxxxx':::.
# ::::::::::::::::::.'xxxxx :::::.'.xx.'::::::.
# ::::::::::::::::::::.'xxxx:. :::::::.'':::::::::
# ':::::::::::::::::::::.'xx:' .'::::::::::::::::::::..
# :::::::::::::::::::::.'xx .:: :::::::::::::::::::::::
# .:::::::::::::::::::::::. xx .::xxxx :::::::::::::::::::::::
# :::::::::::::::::::::::::.'xxx.. .::xxxxxxx ::::::::::::::::::::'
# '::::::::::::::::::::::::: xxxxxxxxxxxxxxxxxxxxxxx :::::::::::::::::'
# '::::::::::::::::::::::: xxxxxxxxxxxxxxxxxxxxxxx :::::::::::::::'
# ':::::::::::::::::::_xxxxxx::'''::xxxxxxxxxx '::::::::::::'
# '':.::::::::::' `._'::::::''
#
# ,wmmmmmmmp
# KP ]bbKKKKK
# KKKKKKKKKKK
# a#KKKKKKKKKKKKKK PPhw
# #bbbbbbbbbbbKKKKK ||||h
# bbbbbbKMMMMMMMM*,$|||||
# bbbbbM,$|LLLL||||||||||
# Tbbbb LLLLL|||||||||||L
# `fff LLLLL*"""""""""`
# LLLLL||P"!|
# *|LLL||hw|*
# `````
# y jM
# .m**m m :p #M jN~~m m**w .m**m
# :N jm:N jM ] jC ] ]L ]MjC ]
# :N,,#^ N,,/M 1p jC ] `N,,A jC $
# :N ]L
# ' `"
##############################################################################