diff --git a/soccer/main.py b/soccer/main.py index 297e021..c81eba6 100644 --- a/soccer/main.py +++ b/soccer/main.py @@ -3,6 +3,7 @@ import requests import sys import json +import time as python_time from soccer import leagueids from soccer.exceptions import IncorrectParametersException, APIErrorException @@ -226,6 +227,7 @@ def list_team_codes(): help="List all valid team code/team name pairs.") @click.option('--live', is_flag=True, help="Shows live scores from various leagues.") +@click.option('--watch', '-w', default=None, help="Refreshes screen after a given time interval in sec (in seconds)") @click.option('--use12hour', is_flag=True, default=False, help="Displays the time using 12 hour format instead of 24 (default).") @click.option('--standings', is_flag=True, @@ -250,7 +252,7 @@ def list_team_codes(): help='Output in JSON format.') @click.option('-o', '--output-file', default=None, help="Save output to a file (only if csv or json option is provided).") -def main(league, time, standings, team, live, use12hour, players, output_format, +def main(league, time, standings, team, live, watch, use12hour, players, output_format, output_file, upcoming, lookup, listcodes, apikey): """ A CLI for live and past football scores from various football leagues. @@ -289,6 +291,13 @@ def main(league, time, standings, team, live, use12hour, players, output_format, get_live_scores(writer, use12hour) return + if watch: + while True: + get_live_scores(writer, use12hour) + python_time.sleep(int(watch)) + print(chr(27) + "[2J") + return + if standings: if not league: raise IncorrectParametersException('Please specify a league. ' @@ -312,4 +321,4 @@ def main(league, time, standings, team, live, use12hour, players, output_format, click.secho(e.message, fg="red", bold=True) if __name__ == '__main__': - main() + main() \ No newline at end of file