forked from codeezer/livescore-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
livescore.py
executable file
·60 lines (46 loc) · 1.67 KB
/
livescore.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
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import time
from lib import lscolors as c
from lib import cli
from lib.URL import URL
from lib import lsprint
from lib import lsweb
def main():
b_table = bool(cli.args.table)
b_score = bool(cli.args.score)
b_scorers = bool(cli.args.scorers)
if not b_table and not b_score and not b_scorers:
b_score = True
while True:
try:
os.system('clear')
for k in cli.args.League:
# Code to fetch data from URL[k]
ping_test = 'www.google.com'
print(' ... Fetching information from www.livescore.com' + ' ... ')
if lsweb.is_connected(ping_test) is True:
if b_table:
print("Displaying Table for {}".format(URL[k][0]))
lsprint.table(lsweb.get_table(URL[k][1]), k)
if b_score:
print("Displaying Scores for {}".format(URL[k][0]))
lsprint.scores(lsweb.get_score(URL[k][1]), k)
if b_scorers:
print("Displaying Top Scorers for"
" {}".format(URL[k][0]))
print('Working on it')
else:
print(c.fill[3] + "Check Your Internet Connection ,"
" It looks like you're out of internet." + c.END)
time.sleep(3)
b_table = False
b_scorers = False
if not bool(b_score):
break
time.sleep(7)
except KeyboardInterrupt:
break
if __name__ == '__main__':
main()