diff --git a/api_caller.py b/api_caller.py index dcbc2f2..cc6d79a 100644 --- a/api_caller.py +++ b/api_caller.py @@ -658,6 +658,7 @@ if __name__ == '__main__': if checkStocks(stock_time, stock_frequency) or msg == 's': stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") last_updates['stocks'] = stock_time + updateStocks() # crypto crypto_time = datetime.strptime(last_updates['crypto'], "%d/%m/%Y %H:%M:%S") diff --git a/csv/crypto_settings.json b/csv/crypto_settings.json index 866bff5..54740ed 100644 --- a/csv/crypto_settings.json +++ b/csv/crypto_settings.json @@ -1 +1 @@ -{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 43.14, "24hr_change": -1.4320514042952985}, "BTC,USD": {"current": 60800, "24hr_change": 0.27878029217327127}, "ETH,BTC": {"current": 0.07025085, "24hr_change": -1.2732675844426864}, "ADA,GBP": {"current": 1.4, "24hr_change": -1.9972252884320558}}} \ No newline at end of file +{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 42.95, "24hr_change": -2.0434968411618937}, "BTC,USD": {"current": 60594, "24hr_change": -0.03867146261533629}, "ETH,BTC": {"current": 0.07020828, "24hr_change": -0.632522958888375}, "ADA,GBP": {"current": 1.39, "24hr_change": -2.1188381102215366}}} \ No newline at end of file diff --git a/csv/current_weather.json b/csv/current_weather.json index 28fb611..41686a8 100644 --- a/csv/current_weather.json +++ b/csv/current_weather.json @@ -1 +1 @@ -{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Moscow": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 0.41, "min_temp": -2.12, "max_temp": 0.41, "feels_like": -2.18, "humidity": 83, "clouds": 100, "wind_speed": 2.17, "wind_direction": 224, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Beijing": {"main_weather": "Clear", "description": "clear sky", "temp": -0.06, "min_temp": -0.06, "max_temp": 12.94, "feels_like": -0.06, "humidity": 49, "clouds": 0, "wind_speed": 0.71, "wind_direction": 25, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 7.29, "min_temp": 7.29, "max_temp": 11.19, "feels_like": 5.54, "humidity": 85, "clouds": 100, "wind_speed": 2.59, "wind_direction": 270, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "broken clouds", "temp": 10.85, "min_temp": 10.85, "max_temp": 17.07, "feels_like": 9.87, "humidity": 72, "clouds": 75, "wind_speed": 0.89, "wind_direction": 57, "visibility": 10000, "uv": 0, "rain_chance": 0.04}}, "current_weather": true} \ No newline at end of file +{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": {"main_weather": "Clear", "description": "clear sky", "temp": -1.06, "min_temp": -1.06, "max_temp": 12.94, "feels_like": -1.06, "humidity": 49, "clouds": 0, "wind_speed": 0.71, "wind_direction": 25, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 6.83, "min_temp": 6.83, "max_temp": 11.37, "feels_like": 4.93, "humidity": 88, "clouds": 100, "wind_speed": 2.68, "wind_direction": 268, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 0.41, "min_temp": -2.12, "max_temp": 0.41, "feels_like": -2.18, "humidity": 84, "clouds": 100, "wind_speed": 2.17, "wind_direction": 224, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "broken clouds", "temp": 11.46, "min_temp": 11.46, "max_temp": 17.07, "feels_like": 10.52, "humidity": 71, "clouds": 75, "wind_speed": 0.89, "wind_direction": 346, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true} \ No newline at end of file diff --git a/csv/daily_weather.json b/csv/daily_weather.json index 57bd902..acbdb9d 100644 --- a/csv/daily_weather.json +++ b/csv/daily_weather.json @@ -1 +1 @@ -{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Moscow": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -2.12, "max_temp": 0.41}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.63, "max_temp": 0.24}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.6, "max_temp": 1.53}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.88, "max_temp": 5.22}, {"main_weather": "Snow", "description": "light snow", "min_temp": 0.72, "max_temp": 2.13}, {"main_weather": "Snow", "description": "light snow", "min_temp": -3.96, "max_temp": 0.25}, {"main_weather": "Snow", "description": "light snow", "min_temp": -4.37, "max_temp": -1.28}, {"main_weather": "Snow", "description": "snow", "min_temp": -0.46, "max_temp": 1.39}], "Beijing": [{"main_weather": "Clouds", "description": "few clouds", "min_temp": -0.06, "max_temp": 12.94}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 5.15, "max_temp": 9.77}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 6.02, "max_temp": 9.97}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 2.73, "max_temp": 8.78}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.16, "max_temp": 3.35}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.02, "max_temp": 3.5}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.05, "max_temp": 4.64}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 0.23, "max_temp": 7.72}], "London": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 7.29, "max_temp": 11.19}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 6.86, "max_temp": 12.12}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 8.91, "max_temp": 13.56}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 8.83, "max_temp": 12.04}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 4.98, "max_temp": 10}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.58, "max_temp": 8.88}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.59, "max_temp": 8.54}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 4.17, "max_temp": 7.12}], "Tokyo": [{"main_weather": "Rain", "description": "light rain", "min_temp": 10.85, "max_temp": 17.07}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 13.12, "max_temp": 17.24}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 13.09, "max_temp": 16.3}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.04, "max_temp": 14.23}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.46, "max_temp": 16.24}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.46, "max_temp": 15.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.71, "max_temp": 14.18}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.46, "max_temp": 14.24}]}, "current_weather": true} \ No newline at end of file +{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": [{"main_weather": "Clouds", "description": "few clouds", "min_temp": -1.06, "max_temp": 12.94}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 5.15, "max_temp": 9.77}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 6.02, "max_temp": 9.97}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 2.73, "max_temp": 8.78}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.16, "max_temp": 3.35}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.02, "max_temp": 3.5}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.05, "max_temp": 4.64}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 0.23, "max_temp": 7.72}], "London": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 6.83, "max_temp": 11.37}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 6.99, "max_temp": 13.15}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 9.22, "max_temp": 13.85}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 8.67, "max_temp": 12.75}, {"main_weather": "Rain", "description": "light rain", "min_temp": 6.23, "max_temp": 9.51}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 5.99, "max_temp": 8.96}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 5.47, "max_temp": 8.48}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.07, "max_temp": 7.85}], "Moscow": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -2.12, "max_temp": 0.41}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.63, "max_temp": 0.24}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.6, "max_temp": 1.53}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.88, "max_temp": 5.22}, {"main_weather": "Snow", "description": "light snow", "min_temp": 0.72, "max_temp": 2.13}, {"main_weather": "Snow", "description": "light snow", "min_temp": -3.96, "max_temp": 0.25}, {"main_weather": "Snow", "description": "light snow", "min_temp": -4.37, "max_temp": -1.28}, {"main_weather": "Snow", "description": "snow", "min_temp": -0.46, "max_temp": 1.39}], "Tokyo": [{"main_weather": "Rain", "description": "light rain", "min_temp": 11.46, "max_temp": 17.07}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 13.12, "max_temp": 17.24}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 13.09, "max_temp": 16.3}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.04, "max_temp": 14.23}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.46, "max_temp": 16.24}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.46, "max_temp": 15.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.71, "max_temp": 14.18}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.46, "max_temp": 14.24}]}, "current_weather": true} \ No newline at end of file diff --git a/csv/display_settings.json b/csv/display_settings.json index c003db1..eb7192c 100755 --- a/csv/display_settings.json +++ b/csv/display_settings.json @@ -1 +1 @@ -["Current Weather"] \ No newline at end of file +["Stocks"] \ No newline at end of file diff --git a/csv/last_updates.json b/csv/last_updates.json index 3f2332f..cf6801e 100644 --- a/csv/last_updates.json +++ b/csv/last_updates.json @@ -1 +1 @@ -{"stocks": "17/11/2021 13:38:11", "crypto": "17/11/2021 13:32:17", "news": "17/11/2021 13:32:19", "weather": "17/11/2021 13:32:17", "forex": "17/11/2021 19:32:24", "sports": "17/11/2021 13:32:20"} \ No newline at end of file +{"stocks": "17/11/2021 14:30:18", "crypto": "17/11/2021 14:28:16", "news": "17/11/2021 14:28:19", "weather": "17/11/2021 14:28:17", "forex": "17/11/2021 20:28:22", "sports": "17/11/2021 14:28:19"} \ No newline at end of file diff --git a/csv/live_games.json b/csv/live_games.json index cc25a96..78db63a 100644 --- a/csv/live_games.json +++ b/csv/live_games.json @@ -1 +1 @@ -{"feature": "Sports (Live Games)", "speed": "medium", "animation": "down", "title": true, "leagues": {"NFL": [], "NBA": [{"date": "2021-11-19", "time": "22:07", "progess": "pre", "status": null, "home_team": "Atlanta Falcons", "home_score": "0", "away_team": "New England Patriots", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Buffalo Bills", "home_score": "0", "away_team": "Indianapolis Colts", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Chicago Bears", "home_score": "0", "away_team": "Baltimore Ravens", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Cleveland Browns", "home_score": "0", "away_team": "Detroit Lions", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tennessee Titans", "home_score": "0", "away_team": "Houston Texans", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Minnesota Vikings", "home_score": "0", "away_team": "Green Bay Packers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "New York Jets", "home_score": "0", "away_team": "Miami Dolphins", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Philadelphia Eagles", "home_score": "0", "away_team": "New Orleans Saints", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Carolina Panthers", "home_score": "0", "away_team": "Washington", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Jacksonville Jaguars", "home_score": "0", "away_team": "San Francisco 49ers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Las Vegas Raiders", "home_score": "0", "away_team": "Cincinnati Bengals", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Kansas City Chiefs", "home_score": "0", "away_team": "Dallas Cowboys", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Seattle Seahawks", "home_score": "0", "away_team": "Arizona Cardinals", "away_score": "0"}, {"date": "2021-11-22", "time": "22:07", "progess": "pre", "status": null, "home_team": "Los Angeles Chargers", "home_score": "0", "away_team": "Pittsburgh Steelers", "away_score": "0"}, {"date": "2021-11-23", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}], "Premier League": [{"date": "2021-11-19", "time": "22:07", "progess": "pre", "status": null, "home_team": "Atlanta Falcons", "home_score": "0", "away_team": "New England Patriots", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Buffalo Bills", "home_score": "0", "away_team": "Indianapolis Colts", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Chicago Bears", "home_score": "0", "away_team": "Baltimore Ravens", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Cleveland Browns", "home_score": "0", "away_team": "Detroit Lions", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tennessee Titans", "home_score": "0", "away_team": "Houston Texans", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Minnesota Vikings", "home_score": "0", "away_team": "Green Bay Packers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "New York Jets", "home_score": "0", "away_team": "Miami Dolphins", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Philadelphia Eagles", "home_score": "0", "away_team": "New Orleans Saints", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Carolina Panthers", "home_score": "0", "away_team": "Washington", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Jacksonville Jaguars", "home_score": "0", "away_team": "San Francisco 49ers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Las Vegas Raiders", "home_score": "0", "away_team": "Cincinnati Bengals", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Kansas City Chiefs", "home_score": "0", "away_team": "Dallas Cowboys", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Seattle Seahawks", "home_score": "0", "away_team": "Arizona Cardinals", "away_score": "0"}, {"date": "2021-11-22", "time": "22:07", "progess": "pre", "status": null, "home_team": "Los Angeles Chargers", "home_score": "0", "away_team": "Pittsburgh Steelers", "away_score": "0"}, {"date": "2021-11-23", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}]}} \ No newline at end of file +{"feature": "Sports (Live Games)", "speed": "medium", "animation": "down", "title": true, "leagues": {"NFL": [{"date": "2021-11-19", "time": "22:07", "progess": "pre", "status": null, "home_team": "Atlanta Falcons", "home_score": "0", "away_team": "New England Patriots", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Buffalo Bills", "home_score": "0", "away_team": "Indianapolis Colts", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Chicago Bears", "home_score": "0", "away_team": "Baltimore Ravens", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Cleveland Browns", "home_score": "0", "away_team": "Detroit Lions", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tennessee Titans", "home_score": "0", "away_team": "Houston Texans", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Minnesota Vikings", "home_score": "0", "away_team": "Green Bay Packers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "New York Jets", "home_score": "0", "away_team": "Miami Dolphins", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Philadelphia Eagles", "home_score": "0", "away_team": "New Orleans Saints", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Carolina Panthers", "home_score": "0", "away_team": "Washington", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Jacksonville Jaguars", "home_score": "0", "away_team": "San Francisco 49ers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Las Vegas Raiders", "home_score": "0", "away_team": "Cincinnati Bengals", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Kansas City Chiefs", "home_score": "0", "away_team": "Dallas Cowboys", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Seattle Seahawks", "home_score": "0", "away_team": "Arizona Cardinals", "away_score": "0"}, {"date": "2021-11-22", "time": "22:07", "progess": "pre", "status": null, "home_team": "Los Angeles Chargers", "home_score": "0", "away_team": "Pittsburgh Steelers", "away_score": "0"}, {"date": "2021-11-23", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}], "NBA": [{"date": "2021-11-19", "time": "22:07", "progess": "pre", "status": null, "home_team": "Atlanta Falcons", "home_score": "0", "away_team": "New England Patriots", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Buffalo Bills", "home_score": "0", "away_team": "Indianapolis Colts", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Chicago Bears", "home_score": "0", "away_team": "Baltimore Ravens", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Cleveland Browns", "home_score": "0", "away_team": "Detroit Lions", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tennessee Titans", "home_score": "0", "away_team": "Houston Texans", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Minnesota Vikings", "home_score": "0", "away_team": "Green Bay Packers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "New York Jets", "home_score": "0", "away_team": "Miami Dolphins", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Philadelphia Eagles", "home_score": "0", "away_team": "New Orleans Saints", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Carolina Panthers", "home_score": "0", "away_team": "Washington", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Jacksonville Jaguars", "home_score": "0", "away_team": "San Francisco 49ers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Las Vegas Raiders", "home_score": "0", "away_team": "Cincinnati Bengals", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Kansas City Chiefs", "home_score": "0", "away_team": "Dallas Cowboys", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Seattle Seahawks", "home_score": "0", "away_team": "Arizona Cardinals", "away_score": "0"}, {"date": "2021-11-22", "time": "22:07", "progess": "pre", "status": null, "home_team": "Los Angeles Chargers", "home_score": "0", "away_team": "Pittsburgh Steelers", "away_score": "0"}, {"date": "2021-11-23", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}], "Premier League": [{"date": "2021-11-19", "time": "22:07", "progess": "pre", "status": null, "home_team": "Atlanta Falcons", "home_score": "0", "away_team": "New England Patriots", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Buffalo Bills", "home_score": "0", "away_team": "Indianapolis Colts", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Chicago Bears", "home_score": "0", "away_team": "Baltimore Ravens", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Cleveland Browns", "home_score": "0", "away_team": "Detroit Lions", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tennessee Titans", "home_score": "0", "away_team": "Houston Texans", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Minnesota Vikings", "home_score": "0", "away_team": "Green Bay Packers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "New York Jets", "home_score": "0", "away_team": "Miami Dolphins", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Philadelphia Eagles", "home_score": "0", "away_team": "New Orleans Saints", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Carolina Panthers", "home_score": "0", "away_team": "Washington", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Jacksonville Jaguars", "home_score": "0", "away_team": "San Francisco 49ers", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Las Vegas Raiders", "home_score": "0", "away_team": "Cincinnati Bengals", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Kansas City Chiefs", "home_score": "0", "away_team": "Dallas Cowboys", "away_score": "0"}, {"date": "2021-11-21", "time": "22:07", "progess": "pre", "status": null, "home_team": "Seattle Seahawks", "home_score": "0", "away_team": "Arizona Cardinals", "away_score": "0"}, {"date": "2021-11-22", "time": "22:07", "progess": "pre", "status": null, "home_team": "Los Angeles Chargers", "home_score": "0", "away_team": "Pittsburgh Steelers", "away_score": "0"}, {"date": "2021-11-23", "time": "22:07", "progess": "pre", "status": null, "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}]}} \ No newline at end of file diff --git a/csv/stocks_settings.json b/csv/stocks_settings.json index 7e0d54b..b100a4e 100644 --- a/csv/stocks_settings.json +++ b/csv/stocks_settings.json @@ -1 +1 @@ -{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 340.12, "opening": 339.29}, "GOOG": {"current": 2980.07, "opening": 2984.38}}} \ No newline at end of file +{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 339.89, "opening": 339.29}, "GOOG": {"current": 2990.345, "opening": 2984.38}}} \ No newline at end of file diff --git a/display_images/Stocks.ppm b/display_images/Stocks.ppm index 5802fff..afc5e6a 100755 Binary files a/display_images/Stocks.ppm and b/display_images/Stocks.ppm differ diff --git a/server.py b/server.py index b629ac2..3e99f23 100644 --- a/server.py +++ b/server.py @@ -21,7 +21,9 @@ import numpy as np #stock_ticker = StockTicker() #print('API CALLER NOT STARTED') api_caller = pexpect.spawn("sudo -E python3 api_caller.py") - +displaying_screensaver = False +screensaver_p = None +professional = False command = 300 tickerList = 0 @@ -99,212 +101,21 @@ def index(): } return render_template('index.html', **templateData) -@app.route("/Runtime", methods=['POST']) -def Runtime(): - - command = request.form['text'] - - - LastCommand = 'Change runtime' - return index() -@app.route("/Delay", methods=['POST']) -def Delay(): - global DelayTime - DelayTime = request.form['text'] - - global LastCommand - LastCommand = 'Change Delay' - return index() - -@app.route("/Speed", methods=['POST']) -def Speed(): - global speed - speed = request.form['text'] - - ticker.sendline(speed) - - f = open('csv/settings.csv', 'r') - CSV = csv.reader(f) - next(CSV) - for line in CSV: - _, brightness = line - f.close() - - f = open('csv/settings.csv', 'w+') - f.write('speed,brightness\n') - f.write(str(speed) + ',' + brightness) - f.close() - global LastCommand - LastCommand = 'Change Speed' - return index() - -@app.route("/brightness", methods=['PUT','POST']) -def brightness(): - global brightness - - data= request.data.decode('utf-8') - settings = json.loads(data) - print(settings) - brightness =settings['brightness'] - print(str(int(brightness) - 1)) - ticker.sendline(str(int(brightness) - 1)) - - f = open('csv/settings.csv', 'r') - CSV = csv.reader(f) - next(CSV) - for line in CSV: - speed, _ = line - f.close() - - f = open('csv/settings.csv', 'w+') - f.write('speed,brightness\n') - f.write(str(speed) + ',' + str(brightness)) - f.close() - - global LastCommand - LastCommand = 'Change Brightness' - return index() - -@app.route("/DisplayText", methods=['POST']) -def DisplayText(): - text = request.form['text'] - f = open('csv/scroll_text.csv', 'w+') - f.write(text) - f.close() - ticker.sendline('K') - ticker.sendline('T') - return index() - -@app.route("/SetNews", methods=['POST']) -def SetNews(): - text = request.form['text'] - - #args = ['q', 'sources', 'category', 'country'] - args = ['q', 'category', 'country'] - arg_dict = {} - lst = text.split(',') - - - try: - for i, arg in enumerate(args): - if len(lst[i])>0: - arg_dict[arg] = lst[i] - - - - json.dump( arg_dict, open( "csv/news_settings.json", 'w+' )) - - except Exception as e: - #reset settings - - f = open( "csv/news_settings.json", 'w+' ) - f.close() - - api_caller.sendline('R') - - return index() - -@app.route("/SetWeather", methods=['POST']) -def SetWeather(): - text = request.form['text'] - - #args = ['q', 'sources', 'category', 'country'] - - f = open( "csv/weather_location.txt", 'w+' ) - f.write(text) - f.close() - api_caller.sendline('R') - - return index() - -@app.route("/DisplayGIF", methods=['POST']) -def DisplayGIF(): - - if request.method == 'POST': - if 'file' not in request.files: - print('No file attached in request') - return hello() - fle = request.files['file'] - if fle.filename == '': - print('No file selected') - return hello() - if fle: - - filename = 'user_gif.gif' - fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('display_images', filename))) - global LastCommand - LastCommand = 'Add a new logo file' - ticker.sendline('K') - ticker.sendline('G') - return hello() - return index() - -@app.route("/DisplayImage", methods=['POST']) -def DisplayImage(): - - if request.method == 'POST': - if 'file' not in request.files: - print('No file attached in request') - return hello() - fle = request.files['file'] - if fle.filename == '': - print('No file selected') - return hello() - if fle: - - filename = 'user_image.ppm' - fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('display_images', filename))) - global LastCommand - LastCommand = 'Add a new logo file' - ticker.sendline('K') - ticker.sendline('I') - return hello() - return index() - - -@app.route("/Ticker", methods=['POST']) -def Ticker(): - if request.method == 'POST': - if 'file' not in request.files: - print('No file attached in request') - return hello() - fle = request.files['file'] - if fle.filename == '': - print('No file selected') - return hello() - if fle and allowed_file(fle.filename): - filename = secure_filename(fle.filename) - fle.save(os.path.join(CSV_FOLDER, filename)) - process_file(os.path.join(CSV_FOLDER, filename), filename) - global LastCommand - LastCommand = 'Change CSV file' - return hello() - return index() - -@app.route("/AddLogo", methods=['POST']) -def AddLogo(): - if request.method == 'POST': - if 'file' not in request.files: - print('No file attached in request') - return hello() - fle = request.files['file'] - if fle.filename == '': - print('No file selected') - return hello() - if fle and allowed_file(fle.filename): - filename = secure_filename(fle.filename) - fle.save(os.path.join(LOGO_FOLDER, filename)) - global LastCommand - LastCommand = 'Add a new logo file' - return hello() - return index() - -professional = False @app.route("/start", methods = ['PUT', 'POST']) def start(): + global displaying_screensaver + global ticker + global api_caller + if displaying_screensaver: + screensaver_p.close() + api_caller = pexpect.spawn("sudo -E python3 api_caller.py") + ticker = pexpect.spawn("sudo -E taskset -c 3 python3 stockTicker.py") + displaying_screensaver = False + + print(professional) data = str(request.data) @@ -396,8 +207,37 @@ def upload(): return index() - + + +@app.route("/screensaver", methods = ['PUT', 'POST']) +def screensaver(): + global displaying_screensaver + global ticker + global api_caller + global screensaver_p + api_caller.close() + ticker.close() + data = str(request.data) + + + if "Pulsating Colors" in data: + screensaver_p = pexpect.spawn("sudo -E python3 ./rpi-rgb-led-matrix/bindings/python/samples/pulsing-colors.py") + + elif "Rotating Square" in data: + screensaver_p = pexpect.spawn("sudo -E python3 ./rpi-rgb-led-matrix/bindings/python/samples/rotating-block-generator.py") + + elif "Pulsating brightness" in data: + screensaver_p = pexpect.spawn("sudo -E python3 ./rpi-rgb-led-matrix/bindings/python/samples/pulsing-brightness.py") + + elif "Game of Life" in data: + screensaver_p = pexpect.spawn("sudo -E python3 game_of_life.py") + + displaying_screensaver = True + return index() + + + def combine_dict(current_settings, input_symbols, current_key): # removes keys not in input from current_settings[current_key] and adds keys not in current from input @@ -532,6 +372,12 @@ def save_message_settings(input_settings): def stop(): print('stop') ticker.sendline('K') + global displaying_screensaver + if displaying_screensaver: + screensaver.close() + api_caller = pexpect.spawn("sudo -E python3 api_caller.py") + ticker = pexpect.spawn("sudo -E taskset -c 3 python3 stockTicker.py") + displaying_screensaver = False return index() @app.route("/shutdown") diff --git a/static/app.js b/static/app.js index 93c90cc..e769892 100644 --- a/static/app.js +++ b/static/app.js @@ -1269,6 +1269,12 @@ let inputAnimationBtn = document.getElementById("input-animation-btn"); inputAnimationBtn.addEventListener("click", () => { localStorage.setItem("inputAnimation", inputAnimation.value); + + + fetch("/screensaver", { + method: "POST", + body: inputAnimation.value, + }); }); // scroll speed row two diff --git a/stockTicker.py b/stockTicker.py index 577e561..a22c8aa 100644 --- a/stockTicker.py +++ b/stockTicker.py @@ -2431,9 +2431,9 @@ class StockTicker(): #userSettings = ['crypto', 'stocks'] # these wil be read from csv, just for demo #userSettings = [ 'display_image', 'news'] # these wil be read from csv, just for demo userSettings = json.load(open('csv/display_settings.json')) - if 'Prof' in userSettings[0]: #if professional display + if len(userSettings)>0 and 'Prof' in userSettings[0] : #if professional display self.scrollProfessionalAnimated(userSettings) - else: + elif len(userSettings)>0: self.scrollFunctionsAnimated(userSettings, animation = 'down') elif msg == 'b': diff --git a/templates/index.html b/templates/index.html index b51f69c..4980f9f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -102,8 +102,10 @@