from weather import Weather
import json
from clock import Clock
from spotify import Spotify
from time import sleep


def main():
    weather_manager = Weather()
    clock_manager = Clock()
    spotify_manager = Spotify()

    weather_manager.start_update_loop()
    clock_manager.start_update_loop()
    spotify_manager.start_update_loop()


    while True:
        print(clock_manager.time)
        print(f'{weather_manager.weather["data"]["values"]["temperature"]} degrees')
        print(f"{spotify_manager.current_context_name}\n{spotify_manager.song_name} - {', '.join(spotify_manager.song_artists)}\n{spotify_manager.song_played / 1000} / {spotify_manager.song_length / 1000}")
        print()
        sleep(10)


if __name__ == "__main__":
    main()
