diff --git a/csv/last_updates.json b/csv/last_updates.json index 4647d2c..061daa6 100644 --- a/csv/last_updates.json +++ b/csv/last_updates.json @@ -1 +1 @@ -{"stocks": {"time": "14/06/2022 06:42:06", "force": false}, "crypto": {"time": "14/06/2022 06:58:18", "force": false}, "news": {"time": "14/06/2022 05:29:08", "force": false}, "weather": {"time": "14/06/2022 05:29:08", "force": false}, "forex": {"time": "14/06/2022 05:29:14", "force": false}, "sports_l": {"time": "14/06/2022 04:42:37", "force": false}, "sports_p": {"time": "14/06/2022 06:27:34", "force": false}, "sports_u": {"time": "14/06/2022 06:28:34", "force": false}, "sports_t": {"time": "14/06/2022 06:26:23", "force": false}, "commodities": {"time": "14/06/2022 06:51:07", "force": false}, "indices": {"time": "05/10/2022 04:06:10", "force": false}} +{"stocks": {"time": "14/06/2022 06:42:06", "force": false}, "crypto": {"time": "14/06/2022 06:58:18", "force": false}, "news": {"time": "14/06/2022 05:29:08", "force": false}, "weather": {"time": "14/06/2022 05:29:08", "force": false}, "forex": {"time": "14/06/2022 05:29:14", "force": false}, "sports_l": {"time": "14/06/2022 04:42:37", "force": false}, "sports_p": {"time": "14/06/2022 06:27:34", "force": false}, "sports_u": {"time": "14/06/2022 06:28:34", "force": false}, "sports_t": {"time": "14/06/2022 06:26:23", "force": false}, "commodities": {"time": "14/06/2022 06:51:07", "force": false}, "indices": {"time": "05/10/2022 04:06:10", "force": false}, "movies": {"time": "05/10/2022 02:31:40", "force": false}} diff --git a/csv/live_mlb.json b/csv/live_mlb.json new file mode 100644 index 0000000..666e75f --- /dev/null +++ b/csv/live_mlb.json @@ -0,0 +1 @@ +{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"MLB": [[{"home_team": "Columbus Blue Jackets", "home_score": "4", "away_team": "Buffalo Sabres", "away_score": "9", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Philadelphia Flyers", "home_score": "1", "away_team": "Washington Capitals", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Calgary Flames", "home_score": "5", "away_team": "Minnesota Wild", "away_score": "3", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Colorado Avalanche", "home_score": "0", "away_team": "Boston Bruins", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Edmonton Oilers", "home_score": "8", "away_team": "Arizona Coyotes", "away_score": "2", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Vegas Golden Knights", "home_score": "1", "away_team": "New York Rangers", "away_score": "5", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "San Jose Sharks", "home_score": "5", "away_team": "Vancouver Canucks", "away_score": "6", "time": "Final/OT", "date": "2022-12-08", "isLive": "post"}], false, "no_live", "no_upcoming"]}} \ No newline at end of file diff --git a/csv/live_mls.json b/csv/live_mls.json new file mode 100644 index 0000000..7869c2e --- /dev/null +++ b/csv/live_mls.json @@ -0,0 +1 @@ +{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"MLS": [[{"home_team": "Columbus Blue Jackets", "home_score": "4", "away_team": "Buffalo Sabres", "away_score": "9", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Philadelphia Flyers", "home_score": "1", "away_team": "Washington Capitals", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Calgary Flames", "home_score": "5", "away_team": "Minnesota Wild", "away_score": "3", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Colorado Avalanche", "home_score": "0", "away_team": "Boston Bruins", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Edmonton Oilers", "home_score": "8", "away_team": "Arizona Coyotes", "away_score": "2", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Vegas Golden Knights", "home_score": "1", "away_team": "New York Rangers", "away_score": "5", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "San Jose Sharks", "home_score": "5", "away_team": "Vancouver Canucks", "away_score": "6", "time": "Final/OT", "date": "2022-12-08", "isLive": "post"}], false, "no_live", "no_upcoming"]}} \ No newline at end of file diff --git a/csv/live_nba.json b/csv/live_nba.json new file mode 100644 index 0000000..0fc065a --- /dev/null +++ b/csv/live_nba.json @@ -0,0 +1 @@ +{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"NBA": [[{"home_team": "Orlando Magic", "home_score": "116", "away_team": "LA Clippers", "away_score": "111", "time": "Final/OT", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Brooklyn Nets", "home_score": "122", "away_team": "Charlotte Hornets", "away_score": "116", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "New York Knicks", "home_score": "113", "away_team": "Atlanta Hawks", "away_score": "89", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Toronto Raptors", "home_score": "126", "away_team": "Los Angeles Lakers", "away_score": "113", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Chicago Bulls", "home_score": "115", "away_team": "Washington Wizards", "away_score": "111", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Memphis Grizzlies", "home_score": "123", "away_team": "Oklahoma City Thunder", "away_score": "102", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Milwaukee Bucks", "home_score": "126", "away_team": "Sacramento Kings", "away_score": "113", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Minnesota Timberwolves", "home_score": "121", "away_team": "Indiana Pacers", "away_score": "115", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "New Orleans Pelicans", "home_score": "104", "away_team": "Detroit Pistons", "away_score": "98", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Utah Jazz", "home_score": "124", "away_team": "Golden State Warriors", "away_score": "123", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Phoenix Suns", "home_score": "98", "away_team": "Boston Celtics", "away_score": "125", "time": "Final", "date": "2022-12-08", "isLive": "post"}], false, "no_live", "no_upcoming"]}} \ No newline at end of file diff --git a/csv/live_nfl.json b/csv/live_nfl.json new file mode 100644 index 0000000..8c29b0e --- /dev/null +++ b/csv/live_nfl.json @@ -0,0 +1 @@ +{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"NFL": [[{"home_team": "Charlotte Hornets", "home_score": "117", "away_team": "LA Clippers", "away_score": "119", "time": "Final", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Orlando Magic", "home_score": "102", "away_team": "Milwaukee Bucks", "away_score": "109", "time": "Final", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Atlanta Hawks", "home_score": "114", "away_team": "Oklahoma City Thunder", "away_score": "121", "time": "Final", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Toronto Raptors", "home_score": "110", "away_team": "Boston Celtics", "away_score": "116", "time": "Final", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Houston Rockets", "home_score": "132", "away_team": "Philadelphia 76ers", "away_score": "123", "time": "Final/2OT", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Memphis Grizzlies", "home_score": "101", "away_team": "Miami Heat", "away_score": "93", "time": "Final", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Dallas Mavericks", "home_score": "130", "away_team": "Phoenix Suns", "away_score": "111", "time": "Final", "date": "2022-12-06", "isLive": "post"}, {"home_team": "Golden State Warriors", "home_score": "104", "away_team": "Indiana Pacers", "away_score": "112", "time": "Final", "date": "2022-12-06", "isLive": "post"}], false, "no_live", "no_upcoming"]}} \ No newline at end of file diff --git a/csv/live_nhl.json b/csv/live_nhl.json new file mode 100644 index 0000000..58d504a --- /dev/null +++ b/csv/live_nhl.json @@ -0,0 +1 @@ +{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"NHL": [[{"home_team": "Columbus Blue Jackets", "home_score": "4", "away_team": "Buffalo Sabres", "away_score": "9", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Philadelphia Flyers", "home_score": "1", "away_team": "Washington Capitals", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Calgary Flames", "home_score": "5", "away_team": "Minnesota Wild", "away_score": "3", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Colorado Avalanche", "home_score": "0", "away_team": "Boston Bruins", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Edmonton Oilers", "home_score": "8", "away_team": "Arizona Coyotes", "away_score": "2", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Vegas Golden Knights", "home_score": "1", "away_team": "New York Rangers", "away_score": "5", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "San Jose Sharks", "home_score": "5", "away_team": "Vancouver Canucks", "away_score": "6", "time": "Final/OT", "date": "2022-12-08", "isLive": "post"}], false, "no_live", "no_upcoming"]}} \ No newline at end of file diff --git a/csv/live_pl.json b/csv/live_pl.json new file mode 100644 index 0000000..b13de11 --- /dev/null +++ b/csv/live_pl.json @@ -0,0 +1 @@ +{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"PREMIERLEAGUE": [[{"home_team": "Chelsea", "home_score": "0", "away_team": "Manchester City", "away_score": "1", "time": "FT", "date": "2023-01-05", "isLive": "post"}], false, "no_live", "no_upcoming"]}} \ No newline at end of file diff --git a/csv/movie_settings.json b/csv/movie_settings.json new file mode 100644 index 0000000..52e9431 --- /dev/null +++ b/csv/movie_settings.json @@ -0,0 +1 @@ +{"feature": "Movies", "speed": "fast", "speed2": "fast", "animation": "continuous", "category": "Popular All", "title": true, "movies": [{"title": "Avatar: The Way of Water", "language": "EN", "votes": "8.1", "date": "2022-12-14", "media_type": "Movie", "genre": ["Sci-Fi", "Action", "Adventure"], "backdrop": "198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg", "logo": "https://image.tmdb.org/t/p/w500/198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg"}, {"title": "Violent Night", "language": "EN", "votes": "7.3", "date": "2022-11-30", "media_type": "Movie", "genre": ["Action", "Comedy", "Crime", "Thriller"], "backdrop": "g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg", "logo": "https://image.tmdb.org/t/p/w500/g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg"}, {"title": "Avatar", "language": "EN", "votes": "7.5", "date": "2009-12-15", "media_type": "Movie", "genre": ["Action", "Adventure", "Fantasy", "Sci-Fi"], "backdrop": "Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg", "logo": "https://image.tmdb.org/t/p/w500/Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg"}, {"title": "The Banshees of Inisherin", "language": "EN", "votes": "7.7", "date": "2022-10-21", "media_type": "Movie", "genre": ["Drama", "Comedy"], "backdrop": "9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg", "logo": "https://image.tmdb.org/t/p/w500/9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg"}, {"title": "Wednesday", "language": "EN", "votes": "8.8", "date": "2022-11-23", "media_type": "Tv", "genre": ["Sci-Fi & Fantasy", "Mystery", "Comedy"], "backdrop": "iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg", "logo": "https://image.tmdb.org/t/p/w500/iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg"}, {"title": "1923", "language": "EN", "votes": "8.8", "date": "2022-12-18", "media_type": "Tv", "genre": ["Drama", "Western"], "backdrop": "9I6LgZ5110ycg4pyobJxGTFWFCF.jpg", "logo": "https://image.tmdb.org/t/p/w500/9I6LgZ5110ycg4pyobJxGTFWFCF.jpg"}, {"title": "The Recruit", "language": "EN", "votes": "7.2", "date": "2022-12-16", "media_type": "Tv", "genre": ["Drama", "Crime"], "backdrop": "rey2eh6752C2UbGYRileKk1PVTo.jpg", "logo": "https://image.tmdb.org/t/p/w500/rey2eh6752C2UbGYRileKk1PVTo.jpg"}, {"title": "Black Adam", "language": "EN", "votes": "7.2", "date": "2022-10-19", "media_type": "Movie", "genre": ["Action", "Fantasy", "Sci-Fi"], "backdrop": "bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg", "logo": "https://image.tmdb.org/t/p/w500/bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg"}, {"title": "Nanny", "language": "EN", "votes": "5.4", "date": "2022-11-23", "media_type": "Movie", "genre": ["Horror", "Drama"], "backdrop": "nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg", "logo": "https://image.tmdb.org/t/p/w500/nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg"}, {"title": "Tom Clancy's Jack Ryan", "language": "EN", "votes": "7.7", "date": "2018-08-30", "media_type": "Tv", "genre": ["Action & Adventure", "Drama", "War & Politics"], "backdrop": "6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg", "logo": "https://image.tmdb.org/t/p/w500/6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg"}, {"title": "High Heat", "language": "EN", "votes": "6.5", "date": "2022-12-16", "media_type": "Movie", "genre": ["Action", "Comedy", "Crime"], "backdrop": "gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg", "logo": "https://image.tmdb.org/t/p/w500/gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg"}, {"title": "A Not So Merry Christmas", "language": "ES", "votes": "4.8", "date": "2022-12-20", "media_type": "Movie", "genre": ["Comedy"], "backdrop": "8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg", "logo": "https://image.tmdb.org/t/p/w500/8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg"}, {"title": "Guillermo del Toro's Pinocchio", "language": "EN", "votes": "8.5", "date": "2022-11-09", "media_type": "Movie", "genre": ["Animation", "Fantasy", "Drama"], "backdrop": "e782pDRAlu4BG0ahd777n8zfPzZ.jpg", "logo": "https://image.tmdb.org/t/p/w500/e782pDRAlu4BG0ahd777n8zfPzZ.jpg"}, {"title": "His Dark Materials", "language": "EN", "votes": "8.0", "date": "2019-11-03", "media_type": "Tv", "genre": ["Sci-Fi & Fantasy", "Drama"], "backdrop": "dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg", "logo": "https://image.tmdb.org/t/p/w500/dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg"}, {"title": "The Fabelmans", "language": "EN", "votes": "7.8", "date": "2022-11-11", "media_type": "Movie", "genre": ["Drama", "Comedy"], "backdrop": "6RCf9jzKxyjblYV4CseayK6bcJo.jpg", "logo": "https://image.tmdb.org/t/p/w500/6RCf9jzKxyjblYV4CseayK6bcJo.jpg"}, {"title": "The Seven Deadly Sins: Grudge of Edinburgh Part 1", "language": "JA", "votes": "7.8", "date": "2022-12-20", "media_type": "Movie", "genre": ["Animation", "Fantasy", "Adventure", "Action"], "backdrop": "24fe6ou97ammOg3O6ShCgaiolp4.jpg", "logo": "https://image.tmdb.org/t/p/w500/24fe6ou97ammOg3O6ShCgaiolp4.jpg"}, {"title": "Mindcage", "language": "EN", "votes": "7.6", "date": "2022-12-16", "media_type": "Movie", "genre": ["Mystery", "Thriller", "Crime", "Drama"], "backdrop": "An2M2gm0p8POaiGTcZvP1JnUItH.jpg", "logo": "https://image.tmdb.org/t/p/w500/An2M2gm0p8POaiGTcZvP1JnUItH.jpg"}, {"title": "Private Lesson", "language": "TR", "votes": "7.3", "date": "2022-12-16", "media_type": "Movie", "genre": ["Comedy", "Romance"], "backdrop": "uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg", "logo": "https://image.tmdb.org/t/p/w500/uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg"}, {"title": "Sonic Prime", "language": "EN", "votes": "8.7", "date": "2022-12-15", "media_type": "Tv", "genre": ["Animation", "Family"], "backdrop": "1Iiz2uLcZuLn4Khog2yiKpbl11.jpg", "logo": "https://image.tmdb.org/t/p/w500/1Iiz2uLcZuLn4Khog2yiKpbl11.jpg"}, {"title": "The Big 4", "language": "ID", "votes": "7.0", "date": "2022-12-19", "media_type": "Movie", "genre": ["Action", "Comedy", "Crime"], "backdrop": "clO1mWRYT24ogzN3o6LsqHjqrQu.jpg", "logo": "https://image.tmdb.org/t/p/w500/clO1mWRYT24ogzN3o6LsqHjqrQu.jpg"}]} \ No newline at end of file diff --git a/csv/sports/MLS/team_info.csv b/csv/sports/MLS/team_info.csv index 09b9411..d32821b 100644 --- a/csv/sports/MLS/team_info.csv +++ b/csv/sports/MLS/team_info.csv @@ -1,24 +1,35 @@ Full Team Name,Team ID,3 Letter ID,Team Color,Logo File name Atlanta United,135851,ATL,Gold,Atlanta.png +Atlanta United FC,135851,ATL,Gold,Atlanta.png Austin FC,140079,AUS,Green,Austin.png CF Montréal,134150,MTL,Gray,Montreal.png Charlotte FC,140078,CHA,Blue,Charlotte.png Chicago Fire,134154,CHI,Orange,Chicago.png +Chicago Fire FC,134154,CHI,Orange,Chicago.png Colorado Rapids,134794,COL,Red,Colorado.png Columbus Crew,134152,CBS,Yellow,Columbus.png DC United,134145,DC,Red,DC.png +D.C. United,134145,DC,Red,DC.png FC Cincinnati,136688,CIN,Orange,Cincinnati.png FC Dallas,134146,DAL,Blue,Dallas.png Houston Dynamo,134144,HOU,Orange,Houston.png +Houston Dynamo FC,134144,HOU,Orange,Houston.png Inter Miami,137699,MIA,Pink,Miami.png +Inter Miami CF,137699,MIA,Pink,Miami.png L.A. Galaxy,134153,LA,Yellow,LA-Galaxy.png +LA Galaxy,134153,LA,Yellow,LA-Galaxy.png Los Angeles FC,136050,LA,Gold,LAFC.png +LAFC,136050,LA,Gold,LAFC.png Minnesota United,135852,MIN,Light Blue,Minnesota.png +Minnesota United FC,135852,MIN,Light Blue,Minnesota.png Nashville SC,137700,NSH,Yellow,Nashville.png New England Rev.,134159,NE,Red,New-England.png +New England Revolution,134159,NE,Red,New-England.png New York City,134630,NYF,Light Blue,NYC.png +New York City FC,134630,NYF,Light Blue,NYC.png New York Red Bulls,134156,NYR,Red,New-York.png Orlando City,135292,PHI,Purple,Orlando.png +Orlando City SC,135292,PHI,Purple,Orlando.png Philadelphia Union,134142,PHI,Gold,Philadelphia.png Portland Timbers,134155,POR,Green,Portland.png Real Salt Lake,134158,RSL,Gold,Salt-Lake.png @@ -26,4 +37,4 @@ San Jose Earthquakes,134157,SJ,Light Blue,San-Jose.png Seattle Sounders FC,134149,SEA,Green,Seattle.png Sporting Kansas City,134143,KC,Blue,Kansas-City.png Toronto FC,134148,TOR,Red,Toronto.png -Vancouver Whitecaps,134147,VAN,Blue,Vancouver.png \ No newline at end of file +Vancouver Whitecaps,134147,VAN,Blue,Vancouver.png diff --git a/csv/sports/NBA/team_info.csv b/csv/sports/NBA/team_info.csv index 52abc78..25f0582 100644 --- a/csv/sports/NBA/team_info.csv +++ b/csv/sports/NBA/team_info.csv @@ -12,6 +12,7 @@ Golden State Warriors,134865,GSW,Yellow,Golden State.png Indiana Pacers,134873,IND,Yellow,Indiana.png Houston Rockets,134876,HOU,Red,Houston.png Los Angeles Clippers,134866,LAC,Red,LA.png +LA Clippers,134866,LAC,Red,LA.png Los Angeles Lakers,134867,LAL,Purple,LA Lakers.png Memphis Grizzlies,134877,MEM,Dark blue,Memphis.png Miami Heat,134882,MIA,Red,Miami.png @@ -28,4 +29,4 @@ Sacramento Kings,134869,SAC,Purple,Sacramento.png San Antonio Spurs,134879,SAS,Gray,San Antonio.png Toronto Raptors,134864,TOR,Gray,Toronto.png Phoenix Suns,134868,PHX,Orange,Phoenix.png -Washington Wizards,134884,WAS,Red,Washington.png \ No newline at end of file +Washington Wizards,134884,WAS,Red,Washington.png diff --git a/csv/sports/NFL/team_info.csv b/csv/sports/NFL/team_info.csv index 9754ced..53c8528 100644 --- a/csv/sports/NFL/team_info.csv +++ b/csv/sports/NFL/team_info.csv @@ -30,4 +30,5 @@ San Francisco 49ers,134948,SF,Gold,San Francisco.png Seattle Seahawks,134949,SEA,Dark blue,Seattle.png Tampa Bay Buccaneers,134945,TB,Red,Tampa Bay.png Tennessee Titans,134929,TEN,Light blue,Tennessee.png -Washington,134937,WAS,Dark red,Washington.png \ No newline at end of file +Washington,134937,WAS,Dark red,Washington.png +Washington Commanders,134937,WAS,Dark red,Washington.png diff --git a/csv/sports/PREMIERLEAGUE/team_info.csv b/csv/sports/PREMIERLEAGUE/team_info.csv index 0f10da7..6f61389 100644 --- a/csv/sports/PREMIERLEAGUE/team_info.csv +++ b/csv/sports/PREMIERLEAGUE/team_info.csv @@ -3,22 +3,30 @@ Arsenal,133604,ARS,Red,Arsenal.png Aston Villa,133601,AVL,Light blue,AVFC.png Brentford,134355,BRE,Red,Brentford.png Brighton,133619,BRI,Blue,Brighton.png +Brighton & Hove Albion,133619,BRI,Blue,Brighton.png Burnley,133623,BUR,Light blue,Burnley.png Chelsea,133610,CHE,Dark blue,Chelsea.png Crystal Palace,133632,CRY,Blue,Crystal Palace.png Everton,133615,EVE,Blue,Everton.png Leeds,133635,LEE,Yellow,Leeds.png +Leeds United,133635,LEE,Yellow,Leeds.png Leicester,133626,LEI,Blue,Leicester.png +Leicester City,133626,LEI,Blue,Leicester.png Liverpool,133602,LIV,Red,Liverpool.png Manchester City,133613,MCI,Blue,Manchester City.png Manchester United,133612,MUN,Red,Man United.png Newcastle,134777,NEW,Light blue,Newcastle.png +Newcastle United,134777,NEW,Light blue,Newcastle.png Norwich,133608,NOR,Green,Norwich.png Southampton,134778,SOU,Red,Southampton.png Tottenham,133616,TOT,Dark blue,Tottenham.png +Tottenham Hotspur,133616,TOT,Dark blue,Tottenham.png Watford,133624,WAT,Red,Watford.png West Ham,133636,WHU,Red,West Ham.png +West Ham United,133636,WHU,Red,West Ham.png Wolves,133599,WOL,Yellow,Wolves.png +Wolverhampton Wanderers,133599,WOL,Yellow,Wolves.png Fulham,133600,FUL,Red,Fulham.png Nottingham Forest,133720,FOR,Red,Nottingham Forest.png Bournemouth,134301,BOU,Red,Bournemouth.png +AFC Bournemouth,134301,BOU,Red,Bournemouth.png diff --git a/database_caller.py b/database_caller.py index d69c5fb..9a6192e 100755 --- a/database_caller.py +++ b/database_caller.py @@ -5,12 +5,15 @@ # This code can not be copied and/or distributed without the express # permission of Fintic +import psutil import finnhub import time import csv import pytz from datetime import datetime, timedelta +import subprocess import json +import urllib.request import datetime as dt import sys, os, base64, hashlib, hmac, select import requests @@ -26,7 +29,7 @@ try: last_updates = json.load(f) f.close() last_updates['stocks']['force'] = True - #last_updates['weather']['force'] = True + last_updates['sports_l']['force'] = True f = open('csv/last_updates.json', 'w') json.dump(last_updates, f) f.close() @@ -157,6 +160,114 @@ def updateCommodities(api_key, logf): #logf.close() +def updateMovies(api_key, logf): + + f = open('csv/movie_settings.json', 'r') + all_settings = json.load(f) + f.close() + + + if all_settings['category'] == 'Popular Movies': + url = 'https://api.themoviedb.org/3/trending/movie/day?' + movieGenre_url = 'https://api.themoviedb.org/3/genre/movie/list?api_key=' + api_key + '&language=en-US' + movieGenre_response = requests.get(movieGenre_url) + movie_genres = movieGenre_response.json() + + elif all_settings['category'] == 'Popular TV': + url = 'https://api.themoviedb.org/3/trending/tv/day?' + tvGenre_url = 'https://api.themoviedb.org/3/genre/tv/list?api_key=' + api_key + '&language=en-US' + tvGenre_response = requests.get(tvGenre_url) + tv_genres = tvGenre_response.json() + + elif all_settings['category'] == 'Popular All': + url = 'https://api.themoviedb.org/3/trending/all/day?' + movieGenre_url = 'https://api.themoviedb.org/3/genre/movie/list?api_key=' + api_key + '&language=en-US' + movieGenre_response = requests.get(movieGenre_url) + movie_genres = movieGenre_response.json() + tvGenre_url = 'https://api.themoviedb.org/3/genre/tv/list?api_key=' + api_key + '&language=en-US' + tvGenre_response = requests.get(tvGenre_url) + tv_genres = tvGenre_response.json() + + url += 'api_key=' + api_key + response = requests.get(url) + data = response.json() + + this_out = [] + logo_files = [] + + if len(data) > 0: + movies = data['results'] + + for movie in movies: + movie_language = movie['original_language'] + movie_votes = movie['vote_average'] + movie_votes = "{:.1f}".format(movie_votes) + try: + movie_titles = movie['title'] + movie_date = movie['release_date'] + except KeyError: + movie_titles = movie['name'] + movie_date = movie['first_air_date'] + movie_type = movie['media_type'] + movie_genre = movie['genre_ids'] + movie_logo = 'https://image.tmdb.org/t/p/w500' + movie['backdrop_path'] + genrefinal = [] + + if all_settings['category'] == 'Popular Movies': + for i in movie_genre: + for genre in movie_genres['genres']: + if genre['name'] == 'Science Fiction': + genre['name'] = 'Sci-Fi' + if i == genre['id']: + i = genre['name'] + genrefinal.append(i) + elif all_settings['category'] == 'Popular TV': + for i in movie_genre: + for genre in tv_genres['genres']: + if i == genre['id']: + i = genre['name'] + genrefinal.append(i) + elif all_settings['category'] == 'Popular All': + if movie['media_type'] == 'movie': + for i in movie_genre: + for genre in movie_genres['genres']: + if genre['name'] == 'Science Fiction': + genre['name'] = 'Sci-Fi' + if i == genre['id']: + i = genre['name'] + genrefinal.append(i) + elif movie['media_type'] == 'tv': + for i in movie_genre: + for genre in tv_genres['genres']: + if i == genre['id']: + i = genre['name'] + genrefinal.append(i) + + this_out.append({'title':movie_titles, + 'language':movie_language.upper(), + 'votes':str(movie_votes), + 'date':movie_date, + 'media_type':movie_type.capitalize(), + 'genre':genrefinal, + 'backdrop':movie['backdrop_path'][1:], + 'logo': movie_logo + }) + + logo_files.append(movie['backdrop_path'][1:]) + + urllib.request.urlretrieve(movie_logo,'logos/movies/' + movie['backdrop_path']) + + for file in os.listdir('logos/movies/'): + if file not in logo_files: + os.remove('logos/movies/'+file) + + all_settings['movies'] = this_out + + f = open('csv/movie_settings.json', 'w+') + json.dump(all_settings, f) + f.close() + + def updateIndices(api_key, logf): try: @@ -565,72 +676,179 @@ def updateLeagueTables(api_key, logf): #logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) #logf.close() - + +def updatePLtime(): + + f = open('csv/live_games.json') + + try: + all_settings = json.load(f) + f.close() + + try: + for league in all_settings['leagues']: + if league == 'PREMIERLEAGUE': + subprocess.run(["sudo", "pkill", "-f", "live_pl.py"], shell=False) + premierleague = subprocess.Popen(["python3", "live_pl.py"], shell=False) + except: + pass + except: + pass + + def updateLeagueEvents(api_key, time, logf): url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?{}='.format(time) if time == 'past': - f = open('csv/past_games.json') elif time == 'upcoming': - f = open('csv/upcoming_games.json') elif time == 'livescore': f = open('csv/live_games.json') - - try: all_settings = json.load(f) - f.close() - leagues = all_settings['leagues'].keys() - leagues_info = {} - - for league in leagues: - - if league == 'PREMIERLEAGUE': - url += 'PREMIERLEAGUE,' - else: - url += league + ',' - url = url[:-1] # remove last comma - url += '&apiKey=' + api_key - - r = requests.get(url) - - all_data = r.json() - - for league in all_data.keys(): - events = [] - for d in all_data[league]: - event = {} - event['date'] = d['dateEvent'] + + if time == 'livescore': + try: + leagues_info = {} + for league in all_settings['leagues']: + events = [] + if league == 'NFL': + subprocess.run(["sudo", "pkill", "-f", "live_nfl.py"], shell=False) + nfl = subprocess.Popen(["python3", "live_nfl.py"], shell=False) + events.append('Filled') + leagues_info[league.upper()] = events + if league == 'NBA': + subprocess.run(["sudo", "pkill", "-f", "live_nba.py"], shell=False) + nba = subprocess.Popen(["python3", "live_nba.py"], shell=False) + events.append('Filled') + leagues_info[league.upper()] = events + if league == 'NHL': + subprocess.run(["sudo", "pkill", "-f", "live_nhl.py"], shell=False) + nhl = subprocess.Popen(["python3", "live_nhl.py"], shell=False) + events.append('Filled') + leagues_info[league.upper()] = events + if league == 'MLB': + subprocess.run(["sudo", "pkill", "-f", "live_mlb.py"], shell=False) + mlb = subprocess.Popen(["python3", "live_mlb.py"], shell=False) + events.append('Filled') + leagues_info[league.upper()] = events + if league == 'PREMIERLEAGUE': + subprocess.run(["sudo", "pkill", "-f", "live_pl.py"], shell=False) + premierleague = subprocess.Popen(["python3", "live_pl.py"], shell=False) + events.append('Filled') + leagues_info[league.upper()] = events + if league == 'MLS': + subprocess.run(["sudo", "pkill", "-f", "live_mls.py"], shell=False) + mls = subprocess.Popen(["python3", "live_mls.py"], shell=False) + events.append('Filled') + leagues_info[league.upper()] = events + + all_settings['leagues'] = leagues_info + + f = open( "csv/live_games.json", 'w+' ) + json.dump(all_settings, f) + f.close() + except: + pass + + else: + + leagues = all_settings['leagues'].keys() + leagues_info = {} + + for league in leagues: - if time == 'live': - - event['progess'] = d['strProgress'] - event['status'] = d['strStatus'] + if league == 'PREMIERLEAGUE': + url += 'PREMIERLEAGUE,' else: + url += league + ',' + url = url[:-1] # remove last comma + url += '&apiKey=' + api_key + + r = requests.get(url) + + all_data = r.json() + + for league in all_data.keys(): + ten_or_fifteen = slice(None) + events = [] + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + ten_or_fifteen = slice(3) + else: + ten_or_fifteen = slice(None) + for d in all_data[league][ten_or_fifteen]: + event = {} + event['date'] = d['dateEvent'] - event['round'] = d['intRound'] - event['time'] = d['strTime'] - event['home_team'] = d['strHomeTeam'] - - event['away_team'] = d['strAwayTeam'] - - if time != 'upcoming': - event['away_score'] = d['intAwayScore'] - event['home_score'] = d['intHomeScore'] - - events.append(event) - leagues_info[league.upper()] = events - all_settings['leagues'] = leagues_info + if time == 'live': + event['progess'] = d['strProgress'] + event['status'] = d['strStatus'] + else: + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + event['date'] = d['dateEvent'] + event['event'] = d['strEvent'].replace("\u2019","'") + event['venue'] = d['strVenue'].replace("\u2019","'") + event['city'] = d['strCity'].replace("\u2019","'") + event['country'] = d['strCountry'] + event['season'] = d['strSeason'] + else: + event['round'] = d['intRound'] + event['time'] = d['strTime'] + event['home_team'] = d['strHomeTeam'] + event['away_team'] = d['strAwayTeam'] + + if time != 'upcoming': + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + event['golf_standings'] = d['strResult'] - f = open( "csv/{}_games.json".format(time), 'w+' ) - json.dump(all_settings, f) - f.close() + rank = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'T1', 'T2', 'T3', 'T4', 'T5', + 'T6', 'T7', 'T8', 'T9', 'T10'] + + def convert(string): + string = repr(string).replace('/', '') + li = list(string.split('\\')) + return li + + str3 = convert(event['golf_standings']) + + players = [] + + + for each in str3: + each = each.replace('nT', 'T', 1) + if each[:2] in rank: + try: + first_space = each.find(' ', 1) + second_space = each.find(' ', 4) + first_name = each[first_space:second_space].lstrip() + initial = first_name[0] + '.' + each = each.replace(first_name,initial) + except: + pass + interator = each.find('-') + if interator < 0: + interator = 0 + interator2 = each[interator:interator + 3] + result = each.split(interator2, 1)[0] + interator2 + players.append(result.rstrip()) + + event['golf_standings'] = players + else: + event['away_score'] = d['intAwayScore'] + event['home_score'] = d['intHomeScore'] + + events.append(event) + leagues_info[league.upper()] = events + all_settings['leagues'] = leagues_info + + f = open( "csv/{}_games.json".format(time), 'w+' ) + json.dump(all_settings, f) + f.close() except: pass #logf = open('log.txt', "a") @@ -711,7 +929,11 @@ def updateAll(api_key, weather_key, logf): if weather_key: updateWeather(weather_key, logf) - + +past_espn_time = True +past_pl_time = True + + if __name__ == '__main__': logf = open("log.txt", "a") @@ -721,7 +943,7 @@ if __name__ == '__main__': - update_frequencies = {'stocks':2, 'crypto':5, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440, 'commodities': 15, 'indices': 15} #minutes + update_frequencies = {'stocks':2, 'crypto':5, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440, 'commodities': 15, 'indices': 15, 'movies': 1440} #minutes NY_zone = pytz.timezone('America/New_York') CET_zone = pytz.timezone('EST') @@ -758,7 +980,10 @@ if __name__ == '__main__': logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) logf.close() - + try: + movie_key = open('movie_api_key.txt').readlines()[0] + except Exception as e: + movie_key = False t = time.time() @@ -792,7 +1017,7 @@ if __name__ == '__main__': "news": {"time": "06/03/2022 04:07:09", "force": True}, "weather": {"time": "06/03/2022 04:08:20", "force": True}, "forex": {"time": "06/03/2022 03:54:02", "force": True}, "sports_l": {"time": "06/03/2022 04:10:09", "force": True}, "sports_p": {"time": "06/03/2022 04:10:09", "force": True}, - "sports_u": {"time": "06/03/2022 04:10:09", "force": True},"sports_t": {"time": "06/03/2022 04:10:09", "force": True}, "commodities": {"time": "06/03/2022 04:10:09", "force": True}, "indices": {"time": "06/03/2022 04:10:09", "force": True}} + "sports_u": {"time": "06/03/2022 04:10:09", "force": True},"sports_t": {"time": "06/03/2022 04:10:09", "force": True}, "commodities": {"time": "06/03/2022 04:10:09", "force": True}, "indices": {"time": "06/03/2022 04:10:09", "force": True}, "movies": {"time": "06/03/2022 04:10:09", "force": True}} @@ -879,6 +1104,22 @@ if __name__ == '__main__': update_process.start() update_processes.append(update_process) + # movies + movies_time = datetime.strptime(last_updates['movies']['time'], "%d/%m/%Y %H:%M:%S") + + + NY_time = datetime.now(NY_zone).replace(tzinfo=None) + diff = (NY_time - movies_time).total_seconds()/60 #minutes + + + if last_updates['movies']['force'] or diff >= update_frequencies['movies']: + movies_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") + last_updates['movies']['time'] = movies_time + last_updates['movies']['force'] = False + update_process = Process(target = updateMovies, args = (movie_key,logf)) + update_process.start() + update_processes.append(update_process) + # weather weather_time = datetime.strptime(last_updates['weather']['time'], "%d/%m/%Y %H:%M:%S") @@ -932,16 +1173,36 @@ if __name__ == '__main__': # sports live sports_time = datetime.strptime(last_updates['sports_l']['time'], "%d/%m/%Y %H:%M:%S") NY_time = datetime.now(NY_zone).replace(tzinfo=None) - diff = (NY_time - sports_time).total_seconds()/60 #minutes - if last_updates['sports_l']['force'] or diff >= update_frequencies['sports']:# or msg == 'S': + espn_time = "17:00Z" + espn_time_est = "12:00" + # if datetime.now(pytz.utc).strftime("%H:%MZ") < espn_time: + if datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M") < espn_time_est: + past_espn_time = True + if last_updates['sports_l']['force'] or (datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M") >= espn_time_est and past_espn_time):# or msg == 'S': + # if last_updates['sports_l']['force'] or (datetime.now(pytz.utc).strftime("%H:%MZ") >= espn_time and past_espn_time):# or msg == 'S': sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") - #updateSports(api_key) last_updates['sports_l']['time'] = sports_time last_updates['sports_l']['force'] = False + past_espn_time = False update_process = Process(target = updateLeagueEvents, args = (api_key, 'livescore',logf)) update_process.start() update_processes.append(update_process) - + + #sports live (premier league) + pl_time = "12:00Z" + NY_time = datetime.now(NY_zone).replace(tzinfo=None) + sports_time = datetime.strptime(last_updates['sports_l']['time'], "%d/%m/%Y %H:%M:%S") + if datetime.now(pytz.utc).strftime("%H:%MZ") < pl_time: + past_pl_time = True + if datetime.now(pytz.utc).strftime("%H:%MZ") >= pl_time and past_pl_time:# or msg == 'S': + sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") + past_pl_time = False + last_updates['sports_l']['time'] = sports_time + last_updates['sports_l']['force'] = False + update_process = Process(target = updatePLtime) + update_process.start() + update_processes.append(update_process) + # sports past sports_time = datetime.strptime(last_updates['sports_p']['time'], "%d/%m/%Y %H:%M:%S") NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff --git a/feature_titles/movies.png b/feature_titles/movies.png new file mode 100644 index 0000000..b36d00d Binary files /dev/null and b/feature_titles/movies.png differ diff --git a/feature_titles/small_feature_titles/movies.png b/feature_titles/small_feature_titles/movies.png new file mode 100644 index 0000000..885046b Binary files /dev/null and b/feature_titles/small_feature_titles/movies.png differ diff --git a/feature_titles/small_feature_titles/sports_live.png b/feature_titles/small_feature_titles/sports_live.png new file mode 100644 index 0000000..4a98dec Binary files /dev/null and b/feature_titles/small_feature_titles/sports_live.png differ diff --git a/live_mlb.py b/live_mlb.py new file mode 100644 index 0000000..d19899a --- /dev/null +++ b/live_mlb.py @@ -0,0 +1,187 @@ +from datetime import datetime, timedelta +from time import sleep +import pytz +import json +import requests +import sys + +def sortevents(leaguedata, league): + + games = [] + haslive = False + + for event in leaguedata['events']: + + event_desc = event['status']['type']['shortDetail'] # use this to display time and quarter on ticker + event_date = event['date'].split('T')[0] + event_liveOrNot = event['status']['type']['state'] # use this to determine if game has ended or not + if event_liveOrNot == 'in': + haslive = True + has_live = 'has_live' + no_upcoming = 'no_upcoming' + + for home_away in event['competitions']: + for home_away2 in home_away['competitors']: + if home_away2['homeAway'] == 'away': + if home_away2['team']['displayName'] == 'Washington Commanders': + away_team = 'Washington' + else: + away_team = home_away2['team']['displayName'] + away_score = home_away2['score'] + else: + if home_away2['team']['displayName'] == 'Washington Commanders': + home_team = 'Washington' + else: + home_team = home_away2['team']['displayName'] + home_score = home_away2['score'] + + if datetime.now(pytz.utc).strftime("%Y-%m-%d") == event['date'].split('T')[0] or event['date'].split('T')[0] <= (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + games.append({ + 'home_team': home_team, + 'home_score': home_score, + 'away_team': away_team, + 'away_score': away_score, + 'time': event_desc, + 'date': event_date, + 'isLive': event_liveOrNot + }) + return games, haslive, has_live, no_upcoming + + +f = open('csv/live_mlb.json', 'r') +all_settings = json.load(f) +f.close() + +mlb_url = "https://site.api.espn.com/apis/site/v2/sports/baseball/mlb/scoreboard" + +time_now = datetime.now(pytz.utc) +time_now2 = time_now.strftime("%Y-%m-%dT%H:%MZ") + +mlb_live_now = False +mlb_games_today = False +mlb_events = [] +mlb_fifteenmin = False +games_happened = False + +try: + mlb_response = requests.get(mlb_url) + mlb_data = mlb_response.json() +except: + sleep(120) + mlb_response = requests.get(mlb_url) + mlb_data = mlb_response.json() + +for event in mlb_data['events']: + if event['status']['type']['state'] == 'in': + mlb_live_now = True + if time_now2.split('T')[0] <= event['date'].split('T')[0] and event['date'].split('T')[0] <= (datetime.strptime(time_now2, "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + mlb_events.append(event['date']) + mlb_games_today = True + if mlb_live_now is False and ((datetime.strptime(event['date'], "%Y-%m-%dT%H:%MZ") + timedelta(minutes=20)).strftime("%Y-%m-%dT%H:%MZ") >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")) and (event['date'] <= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")): + mlb_fifteenmin = True + + +while True: + f = open('csv/live_mlb.json', 'r') + all_settings = json.load(f) + f.close() + + if mlb_live_now: + try: + mlb_response = requests.get(mlb_url) + mlb_data = mlb_response.json() + mlb_sorted = sortevents(mlb_data, 'MLB') + all_settings['leagues']['MLB'] = mlb_sorted + games_happened = True + + if mlb_sorted[1]: + mlb_live_now = True + else: + mlb_live_now = False + + f = open('csv/live_mlb.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + + elif mlb_fifteenmin: + for _ in range (10): + try: + mlb_response = requests.get(mlb_url) + mlb_data = mlb_response.json() + mlb_sorted = sortevents(mlb_data, 'MLB') + all_settings['leagues']['MLB'] = mlb_sorted + + f = open('csv/live_mlb.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + if mlb_sorted[1]: + mlb_live_now = True + mlb_fifteenmin = False + games_happened = True + else: + mlb_live_now = False + mlb_fifteenmin = False + + else: + mlb_events2 = [] + + try: + for event in mlb_events: + if event >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"): + mlb_events2.append(event) + mlb_games_today = True + next_mlb = min(mlb_events2) + d = datetime.strptime(next_mlb, "%Y-%m-%dT%H:%MZ") + mlb_time_left = (d - (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ"))).total_seconds() + all_settings['leagues']['MLB'][3] = next_mlb + + f = open('csv/live_mlb.json', 'w+') + json.dump(all_settings, f) + f.close() + + except: + mlb_games_today = False + next_mlb = [] + all_settings['leagues']['MLB'][3] = 'no_upcoming' + + f = open('csv/live_mlb.json', 'w+') + json.dump(all_settings, f) + f.close() + pass + + if mlb_games_today: + sleep(mlb_time_left) + mlb_fifteenmin = True + + + if mlb_live_now is False and mlb_games_today is False and games_happened is True: + sleep(7200) + all_settings['leagues']['MLB'][2] = 'no_live' + all_settings['leagues']['MLB'][3] = 'no_upcoming' + + f = open('csv/live_mlb.json', 'w+') + json.dump(all_settings, f) + f.close() + + break + + + if mlb_live_now is False and mlb_games_today is False and games_happened is False: + all_settings['leagues']['MLB'][2] = 'no_live' + all_settings['leagues']['MLB'][3] = 'no_upcoming' + + f = open('csv/live_mlb.json', 'w+') + json.dump(all_settings, f) + f.close() + + break diff --git a/live_mls.py b/live_mls.py new file mode 100644 index 0000000..0958f04 --- /dev/null +++ b/live_mls.py @@ -0,0 +1,188 @@ +from datetime import datetime, timedelta +from time import sleep +import pytz +import json +import requests +import sys + +def sortevents(leaguedata, league): + + games = [] + haslive = False + + for event in leaguedata['events']: + + event_desc = event['status']['type']['shortDetail'] # use this to display time and quarter on ticker + event_date = event['date'].split('T')[0] + event_liveOrNot = event['status']['type']['state'] # use this to determine if game has ended or not + if event_liveOrNot == 'in': + haslive = True + has_live = 'has_live' + no_upcoming = 'no_upcoming' + + for home_away in event['competitions']: + for home_away2 in home_away['competitors']: + if home_away2['homeAway'] == 'away': + if home_away2['team']['displayName'] == 'Washington Commanders': + away_team = 'Washington' + else: + away_team = home_away2['team']['displayName'] + away_score = home_away2['score'] + else: + if home_away2['team']['displayName'] == 'Washington Commanders': + home_team = 'Washington' + else: + home_team = home_away2['team']['displayName'] + home_score = home_away2['score'] + + if datetime.now(pytz.utc).strftime("%Y-%m-%d") == event['date'].split('T')[0] or event['date'].split('T')[0] <= (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + games.append({ + 'home_team': home_team, + 'home_score': home_score, + 'away_team': away_team, + 'away_score': away_score, + 'time': event_desc, + 'date': event_date, + 'isLive': event_liveOrNot + }) + return games, haslive, has_live, no_upcoming + + +f = open('csv/live_mls.json', 'r') +all_settings = json.load(f) +f.close() + +mls_url = "https://site.api.espn.com/apis/site/v2/sports/soccer/usa.1/scoreboard" + +time_now = datetime.now(pytz.utc) +time_now2 = time_now.strftime("%Y-%m-%dT%H:%MZ") + +mls_live_now = False +mls_games_today = False +mls_events = [] +mls_fifteenmin = False +games_happened = False + +try: + mls_response = requests.get(mls_url) + mls_data = mls_response.json() +except: + sleep(120) + mls_response = requests.get(mls_url) + mls_data = mls_response.json() + +for event in mls_data['events']: + if event['status']['type']['state'] == 'in': + mls_live_now = True + if time_now2.split('T')[0] <= event['date'].split('T')[0] and event['date'].split('T')[0] <= (datetime.strptime(time_now2, "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + mls_events.append(event['date']) + mls_games_today = True + if mls_live_now is False and ((datetime.strptime(event['date'], "%Y-%m-%dT%H:%MZ") + timedelta(minutes=20)).strftime("%Y-%m-%dT%H:%MZ") >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")) and (event['date'] <= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")): + mls_fifteenmin = True + + +while True: + f = open('csv/live_mls.json', 'r') + all_settings = json.load(f) + f.close() + + if mls_live_now: + try: + mls_response = requests.get(mls_url) + mls_data = mls_response.json() + mls_sorted = sortevents(mls_data, 'MLS') + all_settings['leagues']['MLS'] = mls_sorted + games_happened = True + + if mls_sorted[1]: + mls_live_now = True + else: + mls_live_now = False + + f = open('csv/live_mls.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + + elif mls_fifteenmin: + for _ in range (10): + try: + mls_response = requests.get(mls_url) + mls_data = mls_response.json() + mls_sorted = sortevents(mls_data, 'MLS') + all_settings['leagues']['MLS'] = mls_sorted + + f = open('csv/live_mls.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + if mls_sorted[1]: + mls_live_now = True + mls_fifteenmin = False + games_happened = True + else: + mls_live_now = False + mls_fifteenmin = False + + else: + mls_events2 = [] + + try: + for event in mls_events: + if event >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"): + mls_events2.append(event) + mls_games_today = True + next_mls = min(mls_events2) + d = datetime.strptime(next_mls, "%Y-%m-%dT%H:%MZ") + mls_time_left = (d - (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ"))).total_seconds() + all_settings['leagues']['MLS'][3] = next_mls + + f = open('csv/live_mls.json', 'w+') + json.dump(all_settings, f) + f.close() + + except: + mls_games_today = False + next_mls = [] + + all_settings['leagues']['MLS'][3] = 'no_upcoming' + + f = open('csv/live_mls.json', 'w+') + json.dump(all_settings, f) + f.close() + pass + + if mls_games_today: + sleep(mls_time_left) + mls_fifteenmin = True + + + if mls_live_now is False and mls_games_today is False and games_happened is True: + sleep(7200) + all_settings['leagues']['MLS'][2] = 'no_live' + all_settings['leagues']['MLS'][3] = 'no_upcoming' + + f = open('csv/live_mls.json', 'w+') + json.dump(all_settings, f) + f.close() + + break + + + if mls_live_now is False and mls_games_today is False and games_happened is False: + all_settings['leagues']['MLS'][2] = 'no_live' + all_settings['leagues']['MLS'][3] = 'no_upcoming' + + f = open('csv/live_mls.json', 'w+') + json.dump(all_settings, f) + f.close() + + break diff --git a/live_nba.py b/live_nba.py new file mode 100644 index 0000000..d08d7dc --- /dev/null +++ b/live_nba.py @@ -0,0 +1,185 @@ +from datetime import datetime, timedelta +from time import sleep +import pytz +import json +import requests +import sys + +def sortevents(leaguedata, league): + + games = [] + haslive = False + + for event in leaguedata['events']: + + event_desc = event['status']['type']['shortDetail'] # use this to display time and quarter on ticker + event_date = event['date'].split('T')[0] + event_liveOrNot = event['status']['type']['state'] # use this to determine if game has ended or not + if event_liveOrNot == 'in': + haslive = True + has_live = 'has_live' + no_upcoming = 'no_upcoming' + + for home_away in event['competitions']: + for home_away2 in home_away['competitors']: + if home_away2['homeAway'] == 'away': + if home_away2['team']['displayName'] == 'Washington Commanders': + away_team = 'Washington' + else: + away_team = home_away2['team']['displayName'] + away_score = home_away2['score'] + else: + if home_away2['team']['displayName'] == 'Washington Commanders': + home_team = 'Washington' + else: + home_team = home_away2['team']['displayName'] + home_score = home_away2['score'] + + if datetime.now(pytz.utc).strftime("%Y-%m-%d") == event['date'].split('T')[0] or event['date'].split('T')[0] <= (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + games.append({ + 'home_team': home_team, + 'home_score': home_score, + 'away_team': away_team, + 'away_score': away_score, + 'time': event_desc, + 'date': event_date, + 'isLive': event_liveOrNot + }) + return games, haslive, has_live, no_upcoming + + +f = open('csv/live_nba.json', 'r') +all_settings = json.load(f) +f.close() + +nba_url = "https://site.api.espn.com/apis/site/v2/sports/basketball/nba/scoreboard" + +time_now = datetime.now(pytz.utc) +time_now2 = time_now.strftime("%Y-%m-%dT%H:%MZ") + +NBA_live_now = False +NBA_games_today = False +NBA_events = [] +NBA_fifteenmin = False +games_happened = False + +try: + nba_response = requests.get(nba_url) + nba_data = nba_response.json() +except: + sleep(120) + nba_response = requests.get(nba_url) + nba_data = nba_response.json() + +for event in nba_data['events']: + if event['status']['type']['state'] == 'in': + NBA_live_now = True + if time_now2.split('T')[0] <= event['date'].split('T')[0] and event['date'].split('T')[0] <= (datetime.strptime(time_now2, "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + NBA_events.append(event['date']) + NBA_games_today = True + if NBA_live_now is False and ((datetime.strptime(event['date'], "%Y-%m-%dT%H:%MZ") + timedelta(minutes=20)).strftime("%Y-%m-%dT%H:%MZ") >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")) and (event['date'] <= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")): + NBA_fifteenmin = True + + +while True: + f = open('csv/live_nba.json', 'r') + all_settings = json.load(f) + f.close() + + if NBA_live_now: + try: + nba_response = requests.get(nba_url) + nba_data = nba_response.json() + nba_sorted = sortevents(nba_data, 'NBA') + all_settings['leagues']['NBA'] = nba_sorted + games_happened = True + + if nba_sorted[1]: + NBA_live_now = True + else: + NBA_live_now = False + + f = open('csv/live_nba.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + + elif NBA_fifteenmin: + for _ in range (10): + try: + nba_response = requests.get(nba_url) + nba_data = nba_response.json() + nba_sorted = sortevents(nba_data, 'NBA') + all_settings['leagues']['NBA'] = nba_sorted + + f = open('csv/live_nba.json', 'w+') + json.dump(all_settings, f) + f.close() + sleep(120) + except: + sleep(120) + + if nba_sorted[1]: + NBA_live_now = True + NBA_fifteenmin = False + games_happened = True + + else: + NBA_live_now = False + NBA_fifteenmin = False + + else: + # NBA_events = ['2022-12-06T13:13Z', '2022-12-06T20:30Z', '2022-12-06T21:00Z', '2022-12-06T23:50Z'] + # NFL_events = ['2022-12-05T14:54Z'] + + NBA_events2 = [] + + try: + for event in NBA_events: + if event >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"): + NBA_events2.append(event) + NBA_games_today = True + next_NBA = min(NBA_events2) + d = datetime.strptime(next_NBA, "%Y-%m-%dT%H:%MZ") + NBA_time_left = (d - (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ"))).total_seconds() + all_settings['leagues']['NBA'][3] = next_NBA + f = open('csv/live_nba.json', 'w+') + json.dump(all_settings, f) + f.close() + + except: + NBA_games_today = False + next_NBA = [] + all_settings['leagues']['NBA'][3] = 'no_upcoming' + f = open('csv/live_nba.json', 'w+') + json.dump(all_settings, f) + f.close() + pass + + if NBA_games_today: + sleep(NBA_time_left) + NBA_fifteenmin = True + + + if NBA_live_now is False and NBA_games_today is False and games_happened is True: + sleep(7200) + + all_settings['leagues']['NBA'][2] = 'no_live' + all_settings['leagues']['NBA'][3] = 'no_upcoming' + f = open('csv/live_nba.json', 'w+') + json.dump(all_settings, f) + f.close() + break + + + if NBA_live_now is False and NBA_games_today is False and games_happened is False: + all_settings['leagues']['NBA'][2] = 'no_live' + all_settings['leagues']['NBA'][3] = 'no_upcoming' + f = open('csv/live_nba.json', 'w+') + json.dump(all_settings, f) + f.close() + break diff --git a/live_nfl.py b/live_nfl.py new file mode 100644 index 0000000..774d2e1 --- /dev/null +++ b/live_nfl.py @@ -0,0 +1,189 @@ +from datetime import datetime, timedelta +from time import sleep +import pytz +import json +import requests +import sys + +def sortevents(leaguedata, league): + + games = [] + haslive = False + + for event in leaguedata['events']: + + event_desc = event['status']['type']['shortDetail'] # use this to display time and quarter on ticker + event_date = event['date'].split('T')[0] + event_liveOrNot = event['status']['type']['state'] # use this to determine if game has ended or not + if event_liveOrNot == 'in': + haslive = True + has_live = 'has_live' + no_upcoming = 'no_upcoming' + + for home_away in event['competitions']: + for home_away2 in home_away['competitors']: + if home_away2['homeAway'] == 'away': + if home_away2['team']['displayName'] == 'Washington Commanders': + away_team = 'Washington' + else: + away_team = home_away2['team']['displayName'] + away_score = home_away2['score'] + else: + if home_away2['team']['displayName'] == 'Washington Commanders': + home_team = 'Washington' + else: + home_team = home_away2['team']['displayName'] + home_score = home_away2['score'] + + if datetime.now(pytz.utc).strftime("%Y-%m-%d") == event['date'].split('T')[0] or event['date'].split('T')[0] <= (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + games.append({ + 'home_team': home_team, + 'home_score': home_score, + 'away_team': away_team, + 'away_score': away_score, + 'time': event_desc, + 'date': event_date, + 'isLive': event_liveOrNot + }) + return games, haslive, has_live, no_upcoming + + +f = open('csv/live_nfl.json', 'r') +all_settings = json.load(f) +f.close() + +nfl_url = "https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard" + +time_now = datetime.now(pytz.utc) +time_now2 = time_now.strftime("%Y-%m-%dT%H:%MZ") + +nfl_live_now = False +nfl_games_today = False +nfl_events = [] +nfl_fifteenmin = False + +games_happened = False + +try: + nfl_response = requests.get(nfl_url) + nfl_data = nfl_response.json() +except: + sleep(120) + nfl_response = requests.get(nfl_url) + nfl_data = nfl_response.json() + +for event in nfl_data['events']: + if event['status']['type']['state'] == 'in': + nfl_live_now = True + if time_now2.split('T')[0] <= event['date'].split('T')[0] and event['date'].split('T')[0] <= (datetime.strptime(time_now2, "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + nfl_events.append(event['date']) + nfl_games_today = True + if nfl_live_now is False and ((datetime.strptime(event['date'], "%Y-%m-%dT%H:%MZ") + timedelta(minutes=20)).strftime("%Y-%m-%dT%H:%MZ") >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")) and (event['date'] <= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")): + nfl_fifteenmin = True + + +while True: + f = open('csv/live_nfl.json', 'r') + all_settings = json.load(f) + f.close() + + if nfl_live_now: + try: + nfl_response = requests.get(nfl_url) + nfl_data = nfl_response.json() + nfl_sorted = sortevents(nfl_data, 'NFL') + all_settings['leagues']['NFL'] = nfl_sorted + games_happened = True + + if nfl_sorted[1]: + nfl_live_now = True + else: + nfl_live_now = False + + f = open('csv/live_nfl.json', 'w+') + json.dump(all_settings, f) + f.close() + sleep(120) + except: + sleep(120) + + elif nfl_fifteenmin: + for _ in range (10): + try: + nfl_response = requests.get(nfl_url) + nfl_data = nfl_response.json() + nfl_sorted = sortevents(nfl_data, 'NFL') + all_settings['leagues']['NFL'] = nfl_sorted + + f = open('csv/live_nfl.json', 'w+') + json.dump(all_settings, f) + f.close() + sleep(120) + + except: + sleep(120) + + if nfl_sorted[1]: + nfl_live_now = True + nfl_fifteenmin = False + games_happened = True + else: + nfl_live_now = False + nfl_fifteenmin = False + + else: + nfl_events2 = [] + + try: + for event in nfl_events: + if event >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"): + nfl_events2.append(event) + nfl_games_today = True + next_nfl = min(nfl_events2) + d = datetime.strptime(next_nfl, "%Y-%m-%dT%H:%MZ") + nfl_time_left = (d - (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ"))).total_seconds() + all_settings['leagues']['NFL'][3] = next_nfl + + f = open('csv/live_nfl.json', 'w+') + json.dump(all_settings, f) + f.close() + + except: + nfl_games_today = False + next_nfl = [] + all_settings['leagues']['NFL'][3] = 'no_upcoming' + + f = open('csv/live_nfl.json', 'w+') + json.dump(all_settings, f) + f.close() + pass + + + if nfl_games_today: + sleep(nfl_time_left) + nfl_fifteenmin = True + + + if nfl_live_now is False and nfl_games_today is False and games_happened is True: + sleep(7200) + + all_settings['leagues']['NFL'][2] = 'no_live' + all_settings['leagues']['NFL'][3] = 'no_upcoming' + + f = open('csv/live_nfl.json', 'w+') + json.dump(all_settings, f) + f.close() + + break + + + if nfl_live_now is False and nfl_games_today is False and games_happened is False: + + all_settings['leagues']['NFL'][2] = 'no_live' + all_settings['leagues']['NFL'][3] = 'no_upcoming' + + f = open('csv/live_nfl.json', 'w+') + json.dump(all_settings, f) + f.close() + + break diff --git a/live_nhl.py b/live_nhl.py new file mode 100644 index 0000000..b6ffc01 --- /dev/null +++ b/live_nhl.py @@ -0,0 +1,194 @@ +from datetime import datetime, timedelta +from time import sleep +import pytz +import json +import requests +import sys + +def sortevents(leaguedata, league): + + games = [] + haslive = False + + for event in leaguedata['events']: + + event_desc = event['status']['type']['shortDetail'] # use this to display time and quarter on ticker + event_date = event['date'].split('T')[0] + event_liveOrNot = event['status']['type']['state'] # use this to determine if game has ended or not + if event_liveOrNot == 'in': + haslive = True + has_live = 'has_live' + no_upcoming = 'no_upcoming' + + for home_away in event['competitions']: + for home_away2 in home_away['competitors']: + if home_away2['homeAway'] == 'away': + if home_away2['team']['displayName'] == 'Washington Commanders': + away_team = 'Washington' + else: + away_team = home_away2['team']['displayName'] + away_score = home_away2['score'] + else: + if home_away2['team']['displayName'] == 'Washington Commanders': + home_team = 'Washington' + else: + home_team = home_away2['team']['displayName'] + home_score = home_away2['score'] + + if datetime.now(pytz.utc).strftime("%Y-%m-%d") == event['date'].split('T')[0] or event['date'].split('T')[0] <= (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + games.append({ + 'home_team': home_team, + 'home_score': home_score, + 'away_team': away_team, + 'away_score': away_score, + 'time': event_desc, + 'date': event_date, + 'isLive': event_liveOrNot + }) + return games, haslive, has_live, no_upcoming + + +f = open('csv/live_nhl.json', 'r') +all_settings = json.load(f) +f.close() + +nhl_url = "https://site.api.espn.com/apis/site/v2/sports/hockey/nhl/scoreboard" + +time_now = datetime.now(pytz.utc) +time_now2 = time_now.strftime("%Y-%m-%dT%H:%MZ") + +NHL_live_now = False +NHL_games_today = False +NHL_events = [] +NHL_fifteenmin = False +games_happened = False + + +try: + nhl_response = requests.get(nhl_url) + nhl_data = nhl_response.json() +except: + sleep(120) + nhl_response = requests.get(nhl_url) + nhl_data = nhl_response.json() + +for event in nhl_data['events']: + if event['status']['type']['state'] == 'in': + NHL_live_now = True + if time_now2.split('T')[0] <= event['date'].split('T')[0] and event['date'].split('T')[0] <= (datetime.strptime(time_now2, "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + NHL_events.append(event['date']) + NHL_games_today = True + if NHL_live_now is False and ((datetime.strptime(event['date'], "%Y-%m-%dT%H:%MZ") + timedelta(minutes=20)).strftime("%Y-%m-%dT%H:%MZ") >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")) and (event['date'] <= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")): + NHL_fifteenmin = True + + +while True: + f = open('csv/live_nhl.json', 'r') + all_settings = json.load(f) + f.close() + + if NHL_live_now: + try: + nhl_response = requests.get(nhl_url) + nhl_data = nhl_response.json() + nhl_sorted = sortevents(nhl_data, 'NHL') + all_settings['leagues']['NHL'] = nhl_sorted + games_happened = True + + if nhl_sorted[1]: + NHL_live_now = True + + else: + NHL_live_now = False + + f = open('csv/live_nhl.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + + except: + sleep(120) + + elif NHL_fifteenmin: + for _ in range (10): + try: + nhl_response = requests.get(nhl_url) + nhl_data = nhl_response.json() + nhl_sorted = sortevents(nhl_data, 'NHL') + all_settings['leagues']['NHL'] = nhl_sorted + + f = open('csv/live_nhl.json', 'w+') + json.dump(all_settings, f) + f.close() + sleep(120) + + except: + sleep(120) + + if nhl_sorted[1]: + NHL_live_now = True + NHL_fifteenmin = False + games_happened = True + + else: + NHL_live_now = False + NHL_fifteenmin = False + + else: + NHL_events2 = [] + + try: + for event in NHL_events: + if event >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"): + NHL_events2.append(event) + NHL_games_today = True + next_NHL = min(NHL_events2) + d = datetime.strptime(next_NHL, "%Y-%m-%dT%H:%MZ") + NHL_time_left = (d - (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ"))).total_seconds() + all_settings['leagues']['NHL'][3] = next_NHL + + f = open('csv/live_nhl.json', 'w+') + json.dump(all_settings, f) + f.close() + + except: + NHL_games_today = False + next_NHL = [] + all_settings['leagues']['NHL'][3] = 'no_upcoming' + + f = open('csv/live_nhl.json', 'w+') + json.dump(all_settings, f) + f.close() + + pass + + if NHL_games_today: + + sleep(NHL_time_left) + NHL_fifteenmin = True + + + if NHL_live_now is False and NHL_games_today is False and games_happened is True: + sleep(7200) + + all_settings['leagues']['NHL'][2] = 'no_live' + all_settings['leagues']['NHL'][3] = 'no_upcoming' + + f = open('csv/live_nhl.json', 'w+') + json.dump(all_settings, f) + f.close() + + break + + + if NHL_live_now is False and NHL_games_today is False and games_happened is False: + + all_settings['leagues']['NHL'][2] = 'no_live' + all_settings['leagues']['NHL'][3] = 'no_upcoming' + + f = open('csv/live_nhl.json', 'w+') + json.dump(all_settings, f) + f.close() + + break diff --git a/live_pl.py b/live_pl.py new file mode 100644 index 0000000..1626d75 --- /dev/null +++ b/live_pl.py @@ -0,0 +1,193 @@ +from datetime import datetime, timedelta +from time import sleep +import pytz +import json +import requests +import sys + +def sortevents(leaguedata, league): + + games = [] + haslive = False + + for event in leaguedata['events']: + + event_desc = event['status']['type']['shortDetail'] # use this to display time and quarter on ticker + event_date = event['date'].split('T')[0] + event_liveOrNot = event['status']['type']['state'] # use this to determine if game has ended or not + if event_liveOrNot == 'in': + haslive = True + has_live = 'has_live' + no_upcoming = 'no_upcoming' + + for home_away in event['competitions']: + for home_away2 in home_away['competitors']: + if home_away2['homeAway'] == 'away': + if home_away2['team']['displayName'] == 'Washington Commanders': + away_team = 'Washington' + else: + away_team = home_away2['team']['displayName'] + away_score = home_away2['score'] + else: + if home_away2['team']['displayName'] == 'Washington Commanders': + home_team = 'Washington' + else: + home_team = home_away2['team']['displayName'] + home_score = home_away2['score'] + + if datetime.now(pytz.utc).strftime("%Y-%m-%d") == event['date'].split('T')[0] or event['date'].split('T')[0] <= (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + games.append({ + 'home_team': home_team, + 'home_score': home_score, + 'away_team': away_team, + 'away_score': away_score, + 'time': event_desc, + 'date': event_date, + 'isLive': event_liveOrNot + }) + return games, haslive, has_live, no_upcoming + + +f = open('csv/live_pl.json', 'r') +all_settings = json.load(f) +f.close() + +pl_url = "https://site.api.espn.com/apis/site/v2/sports/soccer/eng.1/scoreboard" + +time_now = datetime.now(pytz.utc) +time_now2 = time_now.strftime("%Y-%m-%dT%H:%MZ") + +pl_live_now = False +pl_games_today = False +pl_events = [] +pl_fifteenmin = False + +games_happened = False + +try: + pl_response = requests.get(pl_url) + pl_data = pl_response.json() +except: + sleep(120) + pl_response = requests.get(pl_url) + pl_data = pl_response.json() + +for event in pl_data['events']: + if event['status']['type']['state'] == 'in': + pl_live_now = True + if time_now2.split('T')[0] <= event['date'].split('T')[0] and event['date'].split('T')[0] <= (datetime.strptime(time_now2, "%Y-%m-%dT%H:%MZ") + timedelta(days=1)).strftime("%Y-%m-%dT%H:%MZ").split('T')[0]: + pl_events.append(event['date']) + pl_games_today = True + if pl_live_now is False and ((datetime.strptime(event['date'], "%Y-%m-%dT%H:%MZ") + timedelta(minutes=20)).strftime("%Y-%m-%dT%H:%MZ") >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")) and (event['date'] <= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ")): + pl_fifteenmin = True + + +while True: + f = open('csv/live_pl.json', 'r') + all_settings = json.load(f) + f.close() + + if pl_live_now: + try: + pl_response = requests.get(pl_url) + pl_data = pl_response.json() + pl_sorted = sortevents(pl_data, 'PREMIERLEAGUE') + all_settings['leagues']['PREMIERLEAGUE'] = pl_sorted + games_happened = True + + if pl_sorted[1]: + pl_live_now = True + else: + pl_live_now = False + + f = open('csv/live_pl.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + + elif pl_fifteenmin: + for _ in range (10): + try: + pl_response = requests.get(pl_url) + pl_data = pl_response.json() + pl_sorted = sortevents(pl_data, 'PREMIERLEAGUE') + all_settings['leagues']['PREMIERLEAGUE'] = pl_sorted + + f = open('csv/live_pl.json', 'w+') + json.dump(all_settings, f) + f.close() + + sleep(120) + except: + sleep(120) + + if pl_sorted[1]: + pl_live_now = True + pl_fifteenmin = False + games_happened = True + + else: + pl_live_now = False + pl_fifteenmin = False + + else: + pl_events2 = [] + + try: + for event in pl_events: + if event >= datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"): + pl_events2.append(event) + pl_games_today = True + next_pl = min(pl_events2) + d = datetime.strptime(next_pl, "%Y-%m-%dT%H:%MZ") + pl_time_left = (d - (datetime.strptime(datetime.now(pytz.utc).strftime("%Y-%m-%dT%H:%MZ"), "%Y-%m-%dT%H:%MZ"))).total_seconds() + all_settings['leagues']['PREMIERLEAGUE'][3] = next_pl + + f = open('csv/live_pl.json', 'w+') + json.dump(all_settings, f) + f.close() + + except: + pl_games_today = False + next_pl = [] + + all_settings['leagues']['PREMIERLEAGUE'][3] = 'no_upcoming' + + f = open('csv/live_pl.json', 'w+') + json.dump(all_settings, f) + f.close() + + pass + + if pl_games_today: + sleep(pl_time_left) + pl_fifteenmin = True + + + if pl_live_now is False and pl_games_today is False and games_happened is True: + sleep(7200) + + all_settings['leagues']['PREMIERLEAGUE'][2] = 'no_live' + all_settings['leagues']['PREMIERLEAGUE'][3] = 'no_upcoming' + + f = open('csv/live_pl.json', 'w+') + json.dump(all_settings, f) + f.close() + + break + + + if pl_live_now is False and pl_games_today is False and games_happened is False: + + all_settings['leagues']['PREMIERLEAGUE'][2] = 'no_live' + all_settings['leagues']['PREMIERLEAGUE'][3] = 'no_upcoming' + + f = open('csv/live_pl.json', 'w+') + json.dump(all_settings, f) + f.close() + + break diff --git a/logos/indices/FTSEMIB.MI.png b/logos/indices/FTSEMIB.MI.png new file mode 100644 index 0000000..9602249 Binary files /dev/null and b/logos/indices/FTSEMIB.MI.png differ diff --git a/logos/indices/^IXIC.png b/logos/indices/^IXIC.png new file mode 100644 index 0000000..f051711 Binary files /dev/null and b/logos/indices/^IXIC.png differ diff --git a/logos/movies/198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg b/logos/movies/198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg new file mode 100644 index 0000000..54ed394 Binary files /dev/null and b/logos/movies/198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg differ diff --git a/logos/movies/1Iiz2uLcZuLn4Khog2yiKpbl11.jpg b/logos/movies/1Iiz2uLcZuLn4Khog2yiKpbl11.jpg new file mode 100644 index 0000000..fd0a37c Binary files /dev/null and b/logos/movies/1Iiz2uLcZuLn4Khog2yiKpbl11.jpg differ diff --git a/logos/movies/24fe6ou97ammOg3O6ShCgaiolp4.jpg b/logos/movies/24fe6ou97ammOg3O6ShCgaiolp4.jpg new file mode 100644 index 0000000..6016a47 Binary files /dev/null and b/logos/movies/24fe6ou97ammOg3O6ShCgaiolp4.jpg differ diff --git a/logos/movies/6RCf9jzKxyjblYV4CseayK6bcJo.jpg b/logos/movies/6RCf9jzKxyjblYV4CseayK6bcJo.jpg new file mode 100644 index 0000000..6059056 Binary files /dev/null and b/logos/movies/6RCf9jzKxyjblYV4CseayK6bcJo.jpg differ diff --git a/logos/movies/6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg b/logos/movies/6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg new file mode 100644 index 0000000..2d2a4ab Binary files /dev/null and b/logos/movies/6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg differ diff --git a/logos/movies/8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg b/logos/movies/8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg new file mode 100644 index 0000000..ee08689 Binary files /dev/null and b/logos/movies/8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg differ diff --git a/logos/movies/9I6LgZ5110ycg4pyobJxGTFWFCF.jpg b/logos/movies/9I6LgZ5110ycg4pyobJxGTFWFCF.jpg new file mode 100644 index 0000000..3b7a056 Binary files /dev/null and b/logos/movies/9I6LgZ5110ycg4pyobJxGTFWFCF.jpg differ diff --git a/logos/movies/9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg b/logos/movies/9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg new file mode 100644 index 0000000..ca61600 Binary files /dev/null and b/logos/movies/9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg differ diff --git a/logos/movies/An2M2gm0p8POaiGTcZvP1JnUItH.jpg b/logos/movies/An2M2gm0p8POaiGTcZvP1JnUItH.jpg new file mode 100644 index 0000000..6391d2d Binary files /dev/null and b/logos/movies/An2M2gm0p8POaiGTcZvP1JnUItH.jpg differ diff --git a/logos/movies/Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg b/logos/movies/Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg new file mode 100644 index 0000000..e335f18 Binary files /dev/null and b/logos/movies/Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg differ diff --git a/logos/movies/bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg b/logos/movies/bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg new file mode 100644 index 0000000..b85dd21 Binary files /dev/null and b/logos/movies/bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg differ diff --git a/logos/movies/clO1mWRYT24ogzN3o6LsqHjqrQu.jpg b/logos/movies/clO1mWRYT24ogzN3o6LsqHjqrQu.jpg new file mode 100644 index 0000000..d3e0fcd Binary files /dev/null and b/logos/movies/clO1mWRYT24ogzN3o6LsqHjqrQu.jpg differ diff --git a/logos/movies/dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg b/logos/movies/dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg new file mode 100644 index 0000000..4ce2b07 Binary files /dev/null and b/logos/movies/dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg differ diff --git a/logos/movies/e782pDRAlu4BG0ahd777n8zfPzZ.jpg b/logos/movies/e782pDRAlu4BG0ahd777n8zfPzZ.jpg new file mode 100644 index 0000000..96ea185 Binary files /dev/null and b/logos/movies/e782pDRAlu4BG0ahd777n8zfPzZ.jpg differ diff --git a/logos/movies/g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg b/logos/movies/g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg new file mode 100644 index 0000000..5fbb328 Binary files /dev/null and b/logos/movies/g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg differ diff --git a/logos/movies/gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg b/logos/movies/gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg new file mode 100644 index 0000000..a007a5e Binary files /dev/null and b/logos/movies/gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg differ diff --git a/logos/movies/iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg b/logos/movies/iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg new file mode 100644 index 0000000..c314e00 Binary files /dev/null and b/logos/movies/iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg differ diff --git a/logos/movies/nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg b/logos/movies/nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg new file mode 100644 index 0000000..1b11340 Binary files /dev/null and b/logos/movies/nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg differ diff --git a/logos/movies/rey2eh6752C2UbGYRileKk1PVTo.jpg b/logos/movies/rey2eh6752C2UbGYRileKk1PVTo.jpg new file mode 100644 index 0000000..457192f Binary files /dev/null and b/logos/movies/rey2eh6752C2UbGYRileKk1PVTo.jpg differ diff --git a/logos/movies/uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg b/logos/movies/uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg new file mode 100644 index 0000000..f127c2d Binary files /dev/null and b/logos/movies/uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg differ diff --git a/logos/sports/league_logos/LPGA.png b/logos/sports/league_logos/LPGA.png new file mode 100644 index 0000000..3ddf3dd Binary files /dev/null and b/logos/sports/league_logos/LPGA.png differ diff --git a/logos/sports/league_logos/PGA.png b/logos/sports/league_logos/PGA.png new file mode 100644 index 0000000..86ba1f5 Binary files /dev/null and b/logos/sports/league_logos/PGA.png differ diff --git a/logos/sports/league_logos/PGA_EU.png b/logos/sports/league_logos/PGA_EU.png new file mode 100644 index 0000000..ea810c6 Binary files /dev/null and b/logos/sports/league_logos/PGA_EU.png differ diff --git a/logos/star.png b/logos/star.png new file mode 100644 index 0000000..5b9bac7 Binary files /dev/null and b/logos/star.png differ diff --git a/logos/stocks/AAP.png b/logos/stocks/AAP.png new file mode 100644 index 0000000..0f256eb Binary files /dev/null and b/logos/stocks/AAP.png differ diff --git a/logos/stocks/ACGL.png b/logos/stocks/ACGL.png new file mode 100644 index 0000000..47d09b0 Binary files /dev/null and b/logos/stocks/ACGL.png differ diff --git a/logos/stocks/ACVA.png b/logos/stocks/ACVA.png new file mode 100644 index 0000000..4911c2c Binary files /dev/null and b/logos/stocks/ACVA.png differ diff --git a/logos/stocks/AFCG.png b/logos/stocks/AFCG.png new file mode 100644 index 0000000..5c30e6e Binary files /dev/null and b/logos/stocks/AFCG.png differ diff --git a/logos/stocks/AHT.png b/logos/stocks/AHT.png new file mode 100644 index 0000000..d9dbbc5 Binary files /dev/null and b/logos/stocks/AHT.png differ diff --git a/logos/stocks/AJRD.png b/logos/stocks/AJRD.png new file mode 100644 index 0000000..7507d19 Binary files /dev/null and b/logos/stocks/AJRD.png differ diff --git a/logos/stocks/ALNY.png b/logos/stocks/ALNY.png new file mode 100644 index 0000000..507e1e0 Binary files /dev/null and b/logos/stocks/ALNY.png differ diff --git a/logos/stocks/AMWD.png b/logos/stocks/AMWD.png new file mode 100644 index 0000000..d3011b2 Binary files /dev/null and b/logos/stocks/AMWD.png differ diff --git a/logos/stocks/APP.png b/logos/stocks/APP.png new file mode 100644 index 0000000..25060d1 Binary files /dev/null and b/logos/stocks/APP.png differ diff --git a/logos/stocks/APPS.png b/logos/stocks/APPS.png new file mode 100644 index 0000000..fe823f2 Binary files /dev/null and b/logos/stocks/APPS.png differ diff --git a/logos/stocks/AQN.png b/logos/stocks/AQN.png new file mode 100644 index 0000000..b1bb0f9 Binary files /dev/null and b/logos/stocks/AQN.png differ diff --git a/logos/stocks/ARCT.png b/logos/stocks/ARCT.png new file mode 100644 index 0000000..04734fd Binary files /dev/null and b/logos/stocks/ARCT.png differ diff --git a/logos/stocks/ARWR.png b/logos/stocks/ARWR.png new file mode 100644 index 0000000..e75156c Binary files /dev/null and b/logos/stocks/ARWR.png differ diff --git a/logos/stocks/ASTE.png b/logos/stocks/ASTE.png new file mode 100644 index 0000000..f9d358a Binary files /dev/null and b/logos/stocks/ASTE.png differ diff --git a/logos/stocks/ATO.png b/logos/stocks/ATO.png new file mode 100644 index 0000000..24a1ab9 Binary files /dev/null and b/logos/stocks/ATO.png differ diff --git a/logos/stocks/ATRO.png b/logos/stocks/ATRO.png new file mode 100644 index 0000000..9d47f7e Binary files /dev/null and b/logos/stocks/ATRO.png differ diff --git a/logos/stocks/AVNS.png b/logos/stocks/AVNS.png new file mode 100644 index 0000000..d97af38 Binary files /dev/null and b/logos/stocks/AVNS.png differ diff --git a/logos/stocks/AVY.png b/logos/stocks/AVY.png new file mode 100644 index 0000000..307aa9d Binary files /dev/null and b/logos/stocks/AVY.png differ diff --git a/logos/stocks/B.png b/logos/stocks/B.png new file mode 100644 index 0000000..cc90383 Binary files /dev/null and b/logos/stocks/B.png differ diff --git a/logos/stocks/BAND.png b/logos/stocks/BAND.png new file mode 100644 index 0000000..0ee1f58 Binary files /dev/null and b/logos/stocks/BAND.png differ diff --git a/logos/stocks/BBDC.png b/logos/stocks/BBDC.png new file mode 100644 index 0000000..8f12750 Binary files /dev/null and b/logos/stocks/BBDC.png differ diff --git a/logos/stocks/BCPC.png b/logos/stocks/BCPC.png new file mode 100644 index 0000000..541ac7d Binary files /dev/null and b/logos/stocks/BCPC.png differ diff --git a/logos/stocks/BERY.png b/logos/stocks/BERY.png new file mode 100644 index 0000000..7721a2e Binary files /dev/null and b/logos/stocks/BERY.png differ diff --git a/logos/stocks/BLDR.png b/logos/stocks/BLDR.png new file mode 100644 index 0000000..5820e5b Binary files /dev/null and b/logos/stocks/BLDR.png differ diff --git a/logos/stocks/BMRC.png b/logos/stocks/BMRC.png new file mode 100644 index 0000000..9dfe1ba Binary files /dev/null and b/logos/stocks/BMRC.png differ diff --git a/logos/stocks/BOH.png b/logos/stocks/BOH.png new file mode 100644 index 0000000..1af3d2b Binary files /dev/null and b/logos/stocks/BOH.png differ diff --git a/logos/stocks/BOLT.png b/logos/stocks/BOLT.png new file mode 100644 index 0000000..b9b27b4 Binary files /dev/null and b/logos/stocks/BOLT.png differ diff --git a/logos/stocks/BRKR.png b/logos/stocks/BRKR.png new file mode 100644 index 0000000..8e9bbbc Binary files /dev/null and b/logos/stocks/BRKR.png differ diff --git a/logos/stocks/BURL.png b/logos/stocks/BURL.png new file mode 100644 index 0000000..5483665 Binary files /dev/null and b/logos/stocks/BURL.png differ diff --git a/logos/stocks/BWMN.png b/logos/stocks/BWMN.png new file mode 100644 index 0000000..32c9fe3 Binary files /dev/null and b/logos/stocks/BWMN.png differ diff --git a/logos/stocks/BYD.png b/logos/stocks/BYD.png new file mode 100644 index 0000000..19e8d35 Binary files /dev/null and b/logos/stocks/BYD.png differ diff --git a/logos/stocks/CADE.png b/logos/stocks/CADE.png new file mode 100644 index 0000000..cc54fb6 Binary files /dev/null and b/logos/stocks/CADE.png differ diff --git a/logos/stocks/CASY.png b/logos/stocks/CASY.png new file mode 100644 index 0000000..96ded3e Binary files /dev/null and b/logos/stocks/CASY.png differ diff --git a/logos/stocks/CBU.png b/logos/stocks/CBU.png new file mode 100644 index 0000000..76b830a Binary files /dev/null and b/logos/stocks/CBU.png differ diff --git a/logos/stocks/CCC.png b/logos/stocks/CCC.png new file mode 100644 index 0000000..d680780 Binary files /dev/null and b/logos/stocks/CCC.png differ diff --git a/logos/stocks/CCS.png b/logos/stocks/CCS.png new file mode 100644 index 0000000..e5c1188 Binary files /dev/null and b/logos/stocks/CCS.png differ diff --git a/logos/stocks/CG.png b/logos/stocks/CG.png new file mode 100644 index 0000000..8498be6 Binary files /dev/null and b/logos/stocks/CG.png differ diff --git a/logos/stocks/CHEF.png b/logos/stocks/CHEF.png new file mode 100644 index 0000000..041bfa0 Binary files /dev/null and b/logos/stocks/CHEF.png differ diff --git a/logos/stocks/CLFD.png b/logos/stocks/CLFD.png new file mode 100644 index 0000000..938b650 Binary files /dev/null and b/logos/stocks/CLFD.png differ diff --git a/logos/stocks/CLVS.png b/logos/stocks/CLVS.png new file mode 100644 index 0000000..6ded877 Binary files /dev/null and b/logos/stocks/CLVS.png differ diff --git a/logos/stocks/CLW.png b/logos/stocks/CLW.png new file mode 100644 index 0000000..b421ee7 Binary files /dev/null and b/logos/stocks/CLW.png differ diff --git a/logos/stocks/CMPS.png b/logos/stocks/CMPS.png new file mode 100644 index 0000000..7490b9d Binary files /dev/null and b/logos/stocks/CMPS.png differ diff --git a/logos/stocks/CMS.png b/logos/stocks/CMS.png new file mode 100644 index 0000000..c73d3a0 Binary files /dev/null and b/logos/stocks/CMS.png differ diff --git a/logos/stocks/CNP.png b/logos/stocks/CNP.png new file mode 100644 index 0000000..d253f17 Binary files /dev/null and b/logos/stocks/CNP.png differ diff --git a/logos/stocks/COLD.png b/logos/stocks/COLD.png new file mode 100644 index 0000000..057f34c Binary files /dev/null and b/logos/stocks/COLD.png differ diff --git a/logos/stocks/CONN.png b/logos/stocks/CONN.png new file mode 100644 index 0000000..d2578dd Binary files /dev/null and b/logos/stocks/CONN.png differ diff --git a/logos/stocks/CPRI.png b/logos/stocks/CPRI.png new file mode 100644 index 0000000..4e9af11 Binary files /dev/null and b/logos/stocks/CPRI.png differ diff --git a/logos/stocks/CPT.png b/logos/stocks/CPT.png new file mode 100644 index 0000000..422bacc Binary files /dev/null and b/logos/stocks/CPT.png differ diff --git a/logos/stocks/CRAI.png b/logos/stocks/CRAI.png new file mode 100644 index 0000000..846e208 Binary files /dev/null and b/logos/stocks/CRAI.png differ diff --git a/logos/stocks/CRBP.png b/logos/stocks/CRBP.png new file mode 100644 index 0000000..c6421a4 Binary files /dev/null and b/logos/stocks/CRBP.png differ diff --git a/logos/stocks/CRGO.png b/logos/stocks/CRGO.png new file mode 100644 index 0000000..6a68ef9 Binary files /dev/null and b/logos/stocks/CRGO.png differ diff --git a/logos/stocks/CRNT.png b/logos/stocks/CRNT.png new file mode 100644 index 0000000..31cdd0e Binary files /dev/null and b/logos/stocks/CRNT.png differ diff --git a/logos/stocks/CTLT.png b/logos/stocks/CTLT.png new file mode 100644 index 0000000..208b042 Binary files /dev/null and b/logos/stocks/CTLT.png differ diff --git a/logos/stocks/CYH.png b/logos/stocks/CYH.png new file mode 100644 index 0000000..0e82c92 Binary files /dev/null and b/logos/stocks/CYH.png differ diff --git a/logos/stocks/DAO.png b/logos/stocks/DAO.png new file mode 100644 index 0000000..8733eb3 Binary files /dev/null and b/logos/stocks/DAO.png differ diff --git a/logos/stocks/DBI.png b/logos/stocks/DBI.png new file mode 100644 index 0000000..512f15f Binary files /dev/null and b/logos/stocks/DBI.png differ diff --git a/logos/stocks/DCT.png b/logos/stocks/DCT.png new file mode 100644 index 0000000..8e24a0c Binary files /dev/null and b/logos/stocks/DCT.png differ diff --git a/logos/stocks/DCTH.png b/logos/stocks/DCTH.png new file mode 100644 index 0000000..ac5e404 Binary files /dev/null and b/logos/stocks/DCTH.png differ diff --git a/logos/stocks/DECK.png b/logos/stocks/DECK.png new file mode 100644 index 0000000..f254c2c Binary files /dev/null and b/logos/stocks/DECK.png differ diff --git a/logos/stocks/DFH.png b/logos/stocks/DFH.png new file mode 100644 index 0000000..1a07129 Binary files /dev/null and b/logos/stocks/DFH.png differ diff --git a/logos/stocks/DGX.png b/logos/stocks/DGX.png new file mode 100644 index 0000000..43022ad Binary files /dev/null and b/logos/stocks/DGX.png differ diff --git a/logos/stocks/DLTH.png b/logos/stocks/DLTH.png new file mode 100644 index 0000000..86fd8ea Binary files /dev/null and b/logos/stocks/DLTH.png differ diff --git a/logos/stocks/DNB.png b/logos/stocks/DNB.png new file mode 100644 index 0000000..777e02d Binary files /dev/null and b/logos/stocks/DNB.png differ diff --git a/logos/stocks/DORM.png b/logos/stocks/DORM.png new file mode 100644 index 0000000..f6f4f4f Binary files /dev/null and b/logos/stocks/DORM.png differ diff --git a/logos/stocks/DVN.png b/logos/stocks/DVN.png new file mode 100644 index 0000000..5323a70 Binary files /dev/null and b/logos/stocks/DVN.png differ diff --git a/logos/stocks/EBC.png b/logos/stocks/EBC.png new file mode 100644 index 0000000..28c1126 Binary files /dev/null and b/logos/stocks/EBC.png differ diff --git a/logos/stocks/EH.png b/logos/stocks/EH.png new file mode 100644 index 0000000..f79e231 Binary files /dev/null and b/logos/stocks/EH.png differ diff --git a/logos/stocks/EMAN.png b/logos/stocks/EMAN.png new file mode 100644 index 0000000..18360a4 Binary files /dev/null and b/logos/stocks/EMAN.png differ diff --git a/logos/stocks/ENTG.png b/logos/stocks/ENTG.png new file mode 100644 index 0000000..c20b909 Binary files /dev/null and b/logos/stocks/ENTG.png differ diff --git a/logos/stocks/EPD.png b/logos/stocks/EPD.png new file mode 100644 index 0000000..58cd6a8 Binary files /dev/null and b/logos/stocks/EPD.png differ diff --git a/logos/stocks/ESNT.png b/logos/stocks/ESNT.png new file mode 100644 index 0000000..134dd0b Binary files /dev/null and b/logos/stocks/ESNT.png differ diff --git a/logos/stocks/ESQ.png b/logos/stocks/ESQ.png new file mode 100644 index 0000000..8f87a3e Binary files /dev/null and b/logos/stocks/ESQ.png differ diff --git a/logos/stocks/ESTC.png b/logos/stocks/ESTC.png new file mode 100644 index 0000000..1b8732a Binary files /dev/null and b/logos/stocks/ESTC.png differ diff --git a/logos/stocks/ET.png b/logos/stocks/ET.png new file mode 100644 index 0000000..0f7fb6e Binary files /dev/null and b/logos/stocks/ET.png differ diff --git a/logos/stocks/EVGN.png b/logos/stocks/EVGN.png new file mode 100644 index 0000000..fce532a Binary files /dev/null and b/logos/stocks/EVGN.png differ diff --git a/logos/stocks/EXAS.png b/logos/stocks/EXAS.png new file mode 100644 index 0000000..5565848 Binary files /dev/null and b/logos/stocks/EXAS.png differ diff --git a/logos/stocks/EXK.png b/logos/stocks/EXK.png new file mode 100644 index 0000000..3e21e5f Binary files /dev/null and b/logos/stocks/EXK.png differ diff --git a/logos/stocks/EXPD.png b/logos/stocks/EXPD.png new file mode 100644 index 0000000..0b12369 Binary files /dev/null and b/logos/stocks/EXPD.png differ diff --git a/logos/stocks/FBC.png b/logos/stocks/FBC.png new file mode 100644 index 0000000..42efc34 Binary files /dev/null and b/logos/stocks/FBC.png differ diff --git a/logos/stocks/FBHS.png b/logos/stocks/FBHS.png new file mode 100644 index 0000000..0f7e98d Binary files /dev/null and b/logos/stocks/FBHS.png differ diff --git a/logos/stocks/FC.png b/logos/stocks/FC.png new file mode 100644 index 0000000..5455042 Binary files /dev/null and b/logos/stocks/FC.png differ diff --git a/logos/stocks/FCEL.png b/logos/stocks/FCEL.png new file mode 100644 index 0000000..6c6f561 Binary files /dev/null and b/logos/stocks/FCEL.png differ diff --git a/logos/stocks/FE.png b/logos/stocks/FE.png new file mode 100644 index 0000000..1c5e7a7 Binary files /dev/null and b/logos/stocks/FE.png differ diff --git a/logos/stocks/FERG.png b/logos/stocks/FERG.png new file mode 100644 index 0000000..19b036d Binary files /dev/null and b/logos/stocks/FERG.png differ diff --git a/logos/stocks/FHN.png b/logos/stocks/FHN.png new file mode 100644 index 0000000..2cfb8a9 Binary files /dev/null and b/logos/stocks/FHN.png differ diff --git a/logos/stocks/FLGT.png b/logos/stocks/FLGT.png new file mode 100644 index 0000000..e0f9d51 Binary files /dev/null and b/logos/stocks/FLGT.png differ diff --git a/logos/stocks/FLWS.png b/logos/stocks/FLWS.png new file mode 100644 index 0000000..b364b9d Binary files /dev/null and b/logos/stocks/FLWS.png differ diff --git a/logos/stocks/FOLD.png b/logos/stocks/FOLD.png new file mode 100644 index 0000000..f4feb37 Binary files /dev/null and b/logos/stocks/FOLD.png differ diff --git a/logos/stocks/FRBA.png b/logos/stocks/FRBA.png new file mode 100644 index 0000000..a22cd62 Binary files /dev/null and b/logos/stocks/FRBA.png differ diff --git a/logos/stocks/FRBK.png b/logos/stocks/FRBK.png new file mode 100644 index 0000000..2d40bfd Binary files /dev/null and b/logos/stocks/FRBK.png differ diff --git a/logos/stocks/FTCI.png b/logos/stocks/FTCI.png new file mode 100644 index 0000000..5b6ebaa Binary files /dev/null and b/logos/stocks/FTCI.png differ diff --git a/logos/stocks/FTEK.png b/logos/stocks/FTEK.png new file mode 100644 index 0000000..a8d343b Binary files /dev/null and b/logos/stocks/FTEK.png differ diff --git a/logos/stocks/GBX.png b/logos/stocks/GBX.png new file mode 100644 index 0000000..0557d6c Binary files /dev/null and b/logos/stocks/GBX.png differ diff --git a/logos/stocks/GDI.png b/logos/stocks/GDI.png new file mode 100644 index 0000000..932952e Binary files /dev/null and b/logos/stocks/GDI.png differ diff --git a/logos/stocks/GEHC.png b/logos/stocks/GEHC.png new file mode 100644 index 0000000..3c1da46 Binary files /dev/null and b/logos/stocks/GEHC.png differ diff --git a/logos/stocks/GETR.png b/logos/stocks/GETR.png new file mode 100644 index 0000000..2a72b69 Binary files /dev/null and b/logos/stocks/GETR.png differ diff --git a/logos/stocks/GFF.png b/logos/stocks/GFF.png new file mode 100644 index 0000000..1e5765e Binary files /dev/null and b/logos/stocks/GFF.png differ diff --git a/logos/stocks/GHG.png b/logos/stocks/GHG.png new file mode 100644 index 0000000..0e6a405 Binary files /dev/null and b/logos/stocks/GHG.png differ diff --git a/logos/stocks/GOCO.png b/logos/stocks/GOCO.png new file mode 100644 index 0000000..18c31d9 Binary files /dev/null and b/logos/stocks/GOCO.png differ diff --git a/logos/stocks/GRND.png b/logos/stocks/GRND.png new file mode 100644 index 0000000..bddcb4b Binary files /dev/null and b/logos/stocks/GRND.png differ diff --git a/logos/stocks/GTES.png b/logos/stocks/GTES.png new file mode 100644 index 0000000..665027b Binary files /dev/null and b/logos/stocks/GTES.png differ diff --git a/logos/stocks/GTN.png b/logos/stocks/GTN.png new file mode 100644 index 0000000..7cb4016 Binary files /dev/null and b/logos/stocks/GTN.png differ diff --git a/logos/stocks/HCG.png b/logos/stocks/HCG.png new file mode 100644 index 0000000..abc3277 Binary files /dev/null and b/logos/stocks/HCG.png differ diff --git a/logos/stocks/HEES.png b/logos/stocks/HEES.png new file mode 100644 index 0000000..fb5c2bc Binary files /dev/null and b/logos/stocks/HEES.png differ diff --git a/logos/stocks/HI.png b/logos/stocks/HI.png new file mode 100644 index 0000000..f25891c Binary files /dev/null and b/logos/stocks/HI.png differ diff --git a/logos/stocks/HIW.png b/logos/stocks/HIW.png new file mode 100644 index 0000000..b4f0464 Binary files /dev/null and b/logos/stocks/HIW.png differ diff --git a/logos/stocks/HOFT.png b/logos/stocks/HOFT.png new file mode 100644 index 0000000..f993bea Binary files /dev/null and b/logos/stocks/HOFT.png differ diff --git a/logos/stocks/HQY.png b/logos/stocks/HQY.png new file mode 100644 index 0000000..285f9db Binary files /dev/null and b/logos/stocks/HQY.png differ diff --git a/logos/stocks/HRTG.png b/logos/stocks/HRTG.png new file mode 100644 index 0000000..03ba107 Binary files /dev/null and b/logos/stocks/HRTG.png differ diff --git a/logos/stocks/HTLF.png b/logos/stocks/HTLF.png new file mode 100644 index 0000000..ab76ff7 Binary files /dev/null and b/logos/stocks/HTLF.png differ diff --git a/logos/stocks/HUBG.png b/logos/stocks/HUBG.png new file mode 100644 index 0000000..3418ef7 Binary files /dev/null and b/logos/stocks/HUBG.png differ diff --git a/logos/stocks/HWM.png b/logos/stocks/HWM.png new file mode 100644 index 0000000..99cc112 Binary files /dev/null and b/logos/stocks/HWM.png differ diff --git a/logos/stocks/HXL.png b/logos/stocks/HXL.png new file mode 100644 index 0000000..27fdff1 Binary files /dev/null and b/logos/stocks/HXL.png differ diff --git a/logos/stocks/HYFM.png b/logos/stocks/HYFM.png new file mode 100644 index 0000000..2a27d4d Binary files /dev/null and b/logos/stocks/HYFM.png differ diff --git a/logos/stocks/ICHR.png b/logos/stocks/ICHR.png new file mode 100644 index 0000000..81ae64c Binary files /dev/null and b/logos/stocks/ICHR.png differ diff --git a/logos/stocks/IMAB.png b/logos/stocks/IMAB.png new file mode 100644 index 0000000..08a1da6 Binary files /dev/null and b/logos/stocks/IMAB.png differ diff --git a/logos/stocks/INNV.png b/logos/stocks/INNV.png new file mode 100644 index 0000000..786e1d0 Binary files /dev/null and b/logos/stocks/INNV.png differ diff --git a/logos/stocks/INVH.png b/logos/stocks/INVH.png new file mode 100644 index 0000000..6c8af70 Binary files /dev/null and b/logos/stocks/INVH.png differ diff --git a/logos/stocks/IQ.png b/logos/stocks/IQ.png new file mode 100644 index 0000000..56d7add Binary files /dev/null and b/logos/stocks/IQ.png differ diff --git a/logos/stocks/JAZZ.png b/logos/stocks/JAZZ.png new file mode 100644 index 0000000..c307c7a Binary files /dev/null and b/logos/stocks/JAZZ.png differ diff --git a/logos/stocks/JILL.png b/logos/stocks/JILL.png new file mode 100644 index 0000000..684b487 Binary files /dev/null and b/logos/stocks/JILL.png differ diff --git a/logos/stocks/KBR.png b/logos/stocks/KBR.png new file mode 100644 index 0000000..56ceed9 Binary files /dev/null and b/logos/stocks/KBR.png differ diff --git a/logos/stocks/KIM.png b/logos/stocks/KIM.png new file mode 100644 index 0000000..de05afc Binary files /dev/null and b/logos/stocks/KIM.png differ diff --git a/logos/stocks/KLIC.png b/logos/stocks/KLIC.png new file mode 100644 index 0000000..20e1f72 Binary files /dev/null and b/logos/stocks/KLIC.png differ diff --git a/logos/stocks/KMX.png b/logos/stocks/KMX.png new file mode 100644 index 0000000..cc19c96 Binary files /dev/null and b/logos/stocks/KMX.png differ diff --git a/logos/stocks/L.png b/logos/stocks/L.png new file mode 100644 index 0000000..82ba2ef Binary files /dev/null and b/logos/stocks/L.png differ diff --git a/logos/stocks/LDI.png b/logos/stocks/LDI.png new file mode 100644 index 0000000..d05df30 Binary files /dev/null and b/logos/stocks/LDI.png differ diff --git a/logos/stocks/LMNR.png b/logos/stocks/LMNR.png new file mode 100644 index 0000000..378c903 Binary files /dev/null and b/logos/stocks/LMNR.png differ diff --git a/logos/stocks/LNC.png b/logos/stocks/LNC.png new file mode 100644 index 0000000..285841b Binary files /dev/null and b/logos/stocks/LNC.png differ diff --git a/logos/stocks/LSTR.png b/logos/stocks/LSTR.png new file mode 100644 index 0000000..69c4c75 Binary files /dev/null and b/logos/stocks/LSTR.png differ diff --git a/logos/stocks/LUB.png b/logos/stocks/LUB.png new file mode 100644 index 0000000..24609cf Binary files /dev/null and b/logos/stocks/LUB.png differ diff --git a/logos/stocks/MBII.png b/logos/stocks/MBII.png new file mode 100644 index 0000000..4a28c8a Binary files /dev/null and b/logos/stocks/MBII.png differ diff --git a/logos/stocks/MBUU.png b/logos/stocks/MBUU.png new file mode 100644 index 0000000..bc9b201 Binary files /dev/null and b/logos/stocks/MBUU.png differ diff --git a/logos/stocks/MBWM.png b/logos/stocks/MBWM.png new file mode 100644 index 0000000..af4f3ab Binary files /dev/null and b/logos/stocks/MBWM.png differ diff --git a/logos/stocks/MCRI.png b/logos/stocks/MCRI.png new file mode 100644 index 0000000..0daafa5 Binary files /dev/null and b/logos/stocks/MCRI.png differ diff --git a/logos/stocks/MDC.png b/logos/stocks/MDC.png new file mode 100644 index 0000000..1a94c39 Binary files /dev/null and b/logos/stocks/MDC.png differ diff --git a/logos/stocks/MEI.png b/logos/stocks/MEI.png new file mode 100644 index 0000000..8512a30 Binary files /dev/null and b/logos/stocks/MEI.png differ diff --git a/logos/stocks/MESA.png b/logos/stocks/MESA.png new file mode 100644 index 0000000..b1b21d9 Binary files /dev/null and b/logos/stocks/MESA.png differ diff --git a/logos/stocks/MGOL.png b/logos/stocks/MGOL.png new file mode 100644 index 0000000..e037191 Binary files /dev/null and b/logos/stocks/MGOL.png differ diff --git a/logos/stocks/MNTK.png b/logos/stocks/MNTK.png new file mode 100644 index 0000000..31109ef Binary files /dev/null and b/logos/stocks/MNTK.png differ diff --git a/logos/stocks/MOH.png b/logos/stocks/MOH.png new file mode 100644 index 0000000..259b5ab Binary files /dev/null and b/logos/stocks/MOH.png differ diff --git a/logos/stocks/MOS.png b/logos/stocks/MOS.png new file mode 100644 index 0000000..a3d43cf Binary files /dev/null and b/logos/stocks/MOS.png differ diff --git a/logos/stocks/MPLN.png b/logos/stocks/MPLN.png new file mode 100644 index 0000000..c5434bc Binary files /dev/null and b/logos/stocks/MPLN.png differ diff --git a/logos/stocks/MRDB.png b/logos/stocks/MRDB.png new file mode 100644 index 0000000..7362b00 Binary files /dev/null and b/logos/stocks/MRDB.png differ diff --git a/logos/stocks/MRO.png b/logos/stocks/MRO.png new file mode 100644 index 0000000..bab45d4 Binary files /dev/null and b/logos/stocks/MRO.png differ diff --git a/logos/stocks/MUR.png b/logos/stocks/MUR.png new file mode 100644 index 0000000..400b221 Binary files /dev/null and b/logos/stocks/MUR.png differ diff --git a/logos/stocks/NAPA.png b/logos/stocks/NAPA.png new file mode 100644 index 0000000..ee80f73 Binary files /dev/null and b/logos/stocks/NAPA.png differ diff --git a/logos/stocks/NBIX.png b/logos/stocks/NBIX.png new file mode 100644 index 0000000..ef52f90 Binary files /dev/null and b/logos/stocks/NBIX.png differ diff --git a/logos/stocks/NEWT.png b/logos/stocks/NEWT.png new file mode 100644 index 0000000..4e3c53e Binary files /dev/null and b/logos/stocks/NEWT.png differ diff --git a/logos/stocks/NOMD.png b/logos/stocks/NOMD.png new file mode 100644 index 0000000..0e5132e Binary files /dev/null and b/logos/stocks/NOMD.png differ diff --git a/logos/stocks/NXST.png b/logos/stocks/NXST.png new file mode 100644 index 0000000..1545677 Binary files /dev/null and b/logos/stocks/NXST.png differ diff --git a/logos/stocks/OBIO.png b/logos/stocks/OBIO.png new file mode 100644 index 0000000..c03aee4 Binary files /dev/null and b/logos/stocks/OBIO.png differ diff --git a/logos/stocks/ODP.png b/logos/stocks/ODP.png new file mode 100644 index 0000000..1b1e0b8 Binary files /dev/null and b/logos/stocks/ODP.png differ diff --git a/logos/stocks/OMI.png b/logos/stocks/OMI.png new file mode 100644 index 0000000..92710bb Binary files /dev/null and b/logos/stocks/OMI.png differ diff --git a/logos/stocks/ONB.png b/logos/stocks/ONB.png new file mode 100644 index 0000000..0e4c570 Binary files /dev/null and b/logos/stocks/ONB.png differ diff --git a/logos/stocks/OTTR.png b/logos/stocks/OTTR.png new file mode 100644 index 0000000..34d5717 Binary files /dev/null and b/logos/stocks/OTTR.png differ diff --git a/logos/stocks/PAAS.png b/logos/stocks/PAAS.png new file mode 100644 index 0000000..3a99f14 Binary files /dev/null and b/logos/stocks/PAAS.png differ diff --git a/logos/stocks/PACB.png b/logos/stocks/PACB.png new file mode 100644 index 0000000..78d9608 Binary files /dev/null and b/logos/stocks/PACB.png differ diff --git a/logos/stocks/PAGS.png b/logos/stocks/PAGS.png new file mode 100644 index 0000000..fb5c384 Binary files /dev/null and b/logos/stocks/PAGS.png differ diff --git a/logos/stocks/PBCT.png b/logos/stocks/PBCT.png new file mode 100644 index 0000000..2c205e6 Binary files /dev/null and b/logos/stocks/PBCT.png differ diff --git a/logos/stocks/PCTY.png b/logos/stocks/PCTY.png new file mode 100644 index 0000000..7389c02 Binary files /dev/null and b/logos/stocks/PCTY.png differ diff --git a/logos/stocks/PEAK.png b/logos/stocks/PEAK.png new file mode 100644 index 0000000..4035d82 Binary files /dev/null and b/logos/stocks/PEAK.png differ diff --git a/logos/stocks/PKG.png b/logos/stocks/PKG.png new file mode 100644 index 0000000..ad022fa Binary files /dev/null and b/logos/stocks/PKG.png differ diff --git a/logos/stocks/PRA.png b/logos/stocks/PRA.png new file mode 100644 index 0000000..20e1b8e Binary files /dev/null and b/logos/stocks/PRA.png differ diff --git a/logos/stocks/QRVO.png b/logos/stocks/QRVO.png new file mode 100644 index 0000000..f1a5684 Binary files /dev/null and b/logos/stocks/QRVO.png differ diff --git a/logos/stocks/RDNT.png b/logos/stocks/RDNT.png new file mode 100644 index 0000000..46fbda0 Binary files /dev/null and b/logos/stocks/RDNT.png differ diff --git a/logos/stocks/REG.png b/logos/stocks/REG.png new file mode 100644 index 0000000..3b2ebbf Binary files /dev/null and b/logos/stocks/REG.png differ diff --git a/logos/stocks/RHP.png b/logos/stocks/RHP.png new file mode 100644 index 0000000..e60c4cf Binary files /dev/null and b/logos/stocks/RHP.png differ diff --git a/logos/stocks/RIG.png b/logos/stocks/RIG.png new file mode 100644 index 0000000..ac6f309 Binary files /dev/null and b/logos/stocks/RIG.png differ diff --git a/logos/stocks/RXT.png b/logos/stocks/RXT.png new file mode 100644 index 0000000..efb45ae Binary files /dev/null and b/logos/stocks/RXT.png differ diff --git a/logos/stocks/SAH.png b/logos/stocks/SAH.png new file mode 100644 index 0000000..a487612 Binary files /dev/null and b/logos/stocks/SAH.png differ diff --git a/logos/stocks/SCU.png b/logos/stocks/SCU.png new file mode 100644 index 0000000..5c3182e Binary files /dev/null and b/logos/stocks/SCU.png differ diff --git a/logos/stocks/SGFY.png b/logos/stocks/SGFY.png new file mode 100644 index 0000000..8155b61 Binary files /dev/null and b/logos/stocks/SGFY.png differ diff --git a/logos/stocks/SGTX.png b/logos/stocks/SGTX.png new file mode 100644 index 0000000..a7224bc Binary files /dev/null and b/logos/stocks/SGTX.png differ diff --git a/logos/stocks/SKYT.png b/logos/stocks/SKYT.png new file mode 100644 index 0000000..b9dfd2d Binary files /dev/null and b/logos/stocks/SKYT.png differ diff --git a/logos/stocks/SLQT.png b/logos/stocks/SLQT.png new file mode 100644 index 0000000..e2ccb17 Binary files /dev/null and b/logos/stocks/SLQT.png differ diff --git a/logos/stocks/SMTC.png b/logos/stocks/SMTC.png new file mode 100644 index 0000000..af9c553 Binary files /dev/null and b/logos/stocks/SMTC.png differ diff --git a/logos/stocks/SNDR.png b/logos/stocks/SNDR.png new file mode 100644 index 0000000..8bdbc85 Binary files /dev/null and b/logos/stocks/SNDR.png differ diff --git a/logos/stocks/SOHO.png b/logos/stocks/SOHO.png new file mode 100644 index 0000000..3863326 Binary files /dev/null and b/logos/stocks/SOHO.png differ diff --git a/logos/stocks/SOI.png b/logos/stocks/SOI.png new file mode 100644 index 0000000..aebed94 Binary files /dev/null and b/logos/stocks/SOI.png differ diff --git a/logos/stocks/SPTN.png b/logos/stocks/SPTN.png new file mode 100644 index 0000000..6d484f2 Binary files /dev/null and b/logos/stocks/SPTN.png differ diff --git a/logos/stocks/SQNS.png b/logos/stocks/SQNS.png new file mode 100644 index 0000000..cad1ebf Binary files /dev/null and b/logos/stocks/SQNS.png differ diff --git a/logos/stocks/ST.png b/logos/stocks/ST.png new file mode 100644 index 0000000..b9d8fbc Binary files /dev/null and b/logos/stocks/ST.png differ diff --git a/logos/stocks/STRR.png b/logos/stocks/STRR.png new file mode 100644 index 0000000..01302d8 Binary files /dev/null and b/logos/stocks/STRR.png differ diff --git a/logos/stocks/SU.png b/logos/stocks/SU.png new file mode 100644 index 0000000..b824c0d Binary files /dev/null and b/logos/stocks/SU.png differ diff --git a/logos/stocks/SWBI.png b/logos/stocks/SWBI.png new file mode 100644 index 0000000..bdc26ba Binary files /dev/null and b/logos/stocks/SWBI.png differ diff --git a/logos/stocks/TAC.png b/logos/stocks/TAC.png new file mode 100644 index 0000000..6e749c5 Binary files /dev/null and b/logos/stocks/TAC.png differ diff --git a/logos/stocks/TAP.png b/logos/stocks/TAP.png new file mode 100644 index 0000000..2081bf8 Binary files /dev/null and b/logos/stocks/TAP.png differ diff --git a/logos/stocks/TDUP.png b/logos/stocks/TDUP.png new file mode 100644 index 0000000..7cca048 Binary files /dev/null and b/logos/stocks/TDUP.png differ diff --git a/logos/stocks/TERN.png b/logos/stocks/TERN.png new file mode 100644 index 0000000..82058f7 Binary files /dev/null and b/logos/stocks/TERN.png differ diff --git a/logos/stocks/THG.png b/logos/stocks/THG.png new file mode 100644 index 0000000..1845fc6 Binary files /dev/null and b/logos/stocks/THG.png differ diff --git a/logos/stocks/TIXT.png b/logos/stocks/TIXT.png new file mode 100644 index 0000000..85ba8c8 Binary files /dev/null and b/logos/stocks/TIXT.png differ diff --git a/logos/stocks/TNDM.png b/logos/stocks/TNDM.png new file mode 100644 index 0000000..70dc178 Binary files /dev/null and b/logos/stocks/TNDM.png differ diff --git a/logos/stocks/TRU.png b/logos/stocks/TRU.png new file mode 100644 index 0000000..2bd81d7 Binary files /dev/null and b/logos/stocks/TRU.png differ diff --git a/logos/stocks/TYL.png b/logos/stocks/TYL.png new file mode 100644 index 0000000..7bdeafe Binary files /dev/null and b/logos/stocks/TYL.png differ diff --git a/logos/stocks/UHAL.B.png b/logos/stocks/UHAL.B.png new file mode 100644 index 0000000..70dfdd6 Binary files /dev/null and b/logos/stocks/UHAL.B.png differ diff --git a/logos/stocks/UHAL.png b/logos/stocks/UHAL.png new file mode 100644 index 0000000..70dfdd6 Binary files /dev/null and b/logos/stocks/UHAL.png differ diff --git a/logos/stocks/USNA.png b/logos/stocks/USNA.png new file mode 100644 index 0000000..7e30ee6 Binary files /dev/null and b/logos/stocks/USNA.png differ diff --git a/logos/stocks/VBFC.png b/logos/stocks/VBFC.png new file mode 100644 index 0000000..d7e8ec9 Binary files /dev/null and b/logos/stocks/VBFC.png differ diff --git a/logos/stocks/VEI.png b/logos/stocks/VEI.png new file mode 100644 index 0000000..98b1d40 Binary files /dev/null and b/logos/stocks/VEI.png differ diff --git a/logos/stocks/VRPX.png b/logos/stocks/VRPX.png new file mode 100644 index 0000000..8f4362c Binary files /dev/null and b/logos/stocks/VRPX.png differ diff --git a/logos/stocks/WISA.png b/logos/stocks/WISA.png new file mode 100644 index 0000000..39f4932 Binary files /dev/null and b/logos/stocks/WISA.png differ diff --git a/logos/stocks/WLK.png b/logos/stocks/WLK.png new file mode 100644 index 0000000..8718986 Binary files /dev/null and b/logos/stocks/WLK.png differ diff --git a/logos/stocks/WMG.png b/logos/stocks/WMG.png new file mode 100644 index 0000000..b83d3f6 Binary files /dev/null and b/logos/stocks/WMG.png differ diff --git a/logos/stocks/WPC.png b/logos/stocks/WPC.png new file mode 100644 index 0000000..9bb8957 Binary files /dev/null and b/logos/stocks/WPC.png differ diff --git a/logos/stocks/WPG.png b/logos/stocks/WPG.png new file mode 100644 index 0000000..c850d6f Binary files /dev/null and b/logos/stocks/WPG.png differ diff --git a/logos/stocks/WSO.png b/logos/stocks/WSO.png new file mode 100644 index 0000000..ec2889b Binary files /dev/null and b/logos/stocks/WSO.png differ diff --git a/logos/stocks/WWW.png b/logos/stocks/WWW.png new file mode 100644 index 0000000..633fd82 Binary files /dev/null and b/logos/stocks/WWW.png differ diff --git a/logos/stocks/X.png b/logos/stocks/X.png new file mode 100644 index 0000000..b5e5568 Binary files /dev/null and b/logos/stocks/X.png differ diff --git a/logos/stocks/XPO.png b/logos/stocks/XPO.png new file mode 100644 index 0000000..7309037 Binary files /dev/null and b/logos/stocks/XPO.png differ diff --git a/logos/stocks/ZION.png b/logos/stocks/ZION.png new file mode 100644 index 0000000..149ff45 Binary files /dev/null and b/logos/stocks/ZION.png differ diff --git a/logos/stocks/ZY.png b/logos/stocks/ZY.png new file mode 100644 index 0000000..609324e Binary files /dev/null and b/logos/stocks/ZY.png differ diff --git a/logos/tiny_stocks/APP.png b/logos/tiny_stocks/APP.png new file mode 100644 index 0000000..7686433 Binary files /dev/null and b/logos/tiny_stocks/APP.png differ diff --git a/logos/tiny_stocks/APPS.png b/logos/tiny_stocks/APPS.png new file mode 100644 index 0000000..9260637 Binary files /dev/null and b/logos/tiny_stocks/APPS.png differ diff --git a/logos/tiny_stocks/ATRO.png b/logos/tiny_stocks/ATRO.png new file mode 100644 index 0000000..8d75630 Binary files /dev/null and b/logos/tiny_stocks/ATRO.png differ diff --git a/logos/tiny_stocks/BAND.png b/logos/tiny_stocks/BAND.png new file mode 100644 index 0000000..3f64da5 Binary files /dev/null and b/logos/tiny_stocks/BAND.png differ diff --git a/logos/tiny_stocks/BBDC.png b/logos/tiny_stocks/BBDC.png new file mode 100644 index 0000000..d48fc53 Binary files /dev/null and b/logos/tiny_stocks/BBDC.png differ diff --git a/logos/tiny_stocks/BOH.png b/logos/tiny_stocks/BOH.png new file mode 100644 index 0000000..8092403 Binary files /dev/null and b/logos/tiny_stocks/BOH.png differ diff --git a/logos/tiny_stocks/BWMN.png b/logos/tiny_stocks/BWMN.png new file mode 100644 index 0000000..a30fac6 Binary files /dev/null and b/logos/tiny_stocks/BWMN.png differ diff --git a/logos/tiny_stocks/CLFD.png b/logos/tiny_stocks/CLFD.png new file mode 100644 index 0000000..aecfc81 Binary files /dev/null and b/logos/tiny_stocks/CLFD.png differ diff --git a/logos/tiny_stocks/CRGO.png b/logos/tiny_stocks/CRGO.png new file mode 100644 index 0000000..400cd34 Binary files /dev/null and b/logos/tiny_stocks/CRGO.png differ diff --git a/logos/tiny_stocks/CRNT.png b/logos/tiny_stocks/CRNT.png new file mode 100644 index 0000000..4bd6a13 Binary files /dev/null and b/logos/tiny_stocks/CRNT.png differ diff --git a/logos/tiny_stocks/CTLT.png b/logos/tiny_stocks/CTLT.png new file mode 100644 index 0000000..28056b3 Binary files /dev/null and b/logos/tiny_stocks/CTLT.png differ diff --git a/logos/tiny_stocks/DAO.png b/logos/tiny_stocks/DAO.png new file mode 100644 index 0000000..a0a0fee Binary files /dev/null and b/logos/tiny_stocks/DAO.png differ diff --git a/logos/tiny_stocks/DNB.png b/logos/tiny_stocks/DNB.png new file mode 100644 index 0000000..2f87f91 Binary files /dev/null and b/logos/tiny_stocks/DNB.png differ diff --git a/logos/tiny_stocks/DORM.png b/logos/tiny_stocks/DORM.png new file mode 100644 index 0000000..cc7d336 Binary files /dev/null and b/logos/tiny_stocks/DORM.png differ diff --git a/logos/tiny_stocks/EH.png b/logos/tiny_stocks/EH.png new file mode 100644 index 0000000..db99f34 Binary files /dev/null and b/logos/tiny_stocks/EH.png differ diff --git a/logos/tiny_stocks/EMAN.png b/logos/tiny_stocks/EMAN.png new file mode 100644 index 0000000..7300198 Binary files /dev/null and b/logos/tiny_stocks/EMAN.png differ diff --git a/logos/tiny_stocks/ESNT.png b/logos/tiny_stocks/ESNT.png new file mode 100644 index 0000000..92b2cf3 Binary files /dev/null and b/logos/tiny_stocks/ESNT.png differ diff --git a/logos/tiny_stocks/ESQ.png b/logos/tiny_stocks/ESQ.png new file mode 100644 index 0000000..71fcd9f Binary files /dev/null and b/logos/tiny_stocks/ESQ.png differ diff --git a/logos/tiny_stocks/FERG.png b/logos/tiny_stocks/FERG.png new file mode 100644 index 0000000..d6a54e6 Binary files /dev/null and b/logos/tiny_stocks/FERG.png differ diff --git a/logos/tiny_stocks/FLGT.png b/logos/tiny_stocks/FLGT.png new file mode 100644 index 0000000..f2ebb98 Binary files /dev/null and b/logos/tiny_stocks/FLGT.png differ diff --git a/logos/tiny_stocks/FRBA.png b/logos/tiny_stocks/FRBA.png new file mode 100644 index 0000000..d397cb9 Binary files /dev/null and b/logos/tiny_stocks/FRBA.png differ diff --git a/logos/tiny_stocks/FTCI.png b/logos/tiny_stocks/FTCI.png new file mode 100644 index 0000000..363efca Binary files /dev/null and b/logos/tiny_stocks/FTCI.png differ diff --git a/logos/tiny_stocks/GETR.png b/logos/tiny_stocks/GETR.png new file mode 100644 index 0000000..42cea89 Binary files /dev/null and b/logos/tiny_stocks/GETR.png differ diff --git a/logos/tiny_stocks/GRND.png b/logos/tiny_stocks/GRND.png new file mode 100644 index 0000000..1f506d6 Binary files /dev/null and b/logos/tiny_stocks/GRND.png differ diff --git a/logos/tiny_stocks/HQY.png b/logos/tiny_stocks/HQY.png new file mode 100644 index 0000000..9aa12f4 Binary files /dev/null and b/logos/tiny_stocks/HQY.png differ diff --git a/logos/tiny_stocks/JILL.png b/logos/tiny_stocks/JILL.png new file mode 100644 index 0000000..1cfeaca Binary files /dev/null and b/logos/tiny_stocks/JILL.png differ diff --git a/logos/tiny_stocks/KIM.png b/logos/tiny_stocks/KIM.png new file mode 100644 index 0000000..2397f61 Binary files /dev/null and b/logos/tiny_stocks/KIM.png differ diff --git a/logos/tiny_stocks/LDI.png b/logos/tiny_stocks/LDI.png new file mode 100644 index 0000000..0ef203e Binary files /dev/null and b/logos/tiny_stocks/LDI.png differ diff --git a/logos/tiny_stocks/LMNR.png b/logos/tiny_stocks/LMNR.png new file mode 100644 index 0000000..947726a Binary files /dev/null and b/logos/tiny_stocks/LMNR.png differ diff --git a/logos/tiny_stocks/MPLN.png b/logos/tiny_stocks/MPLN.png new file mode 100644 index 0000000..5e22883 Binary files /dev/null and b/logos/tiny_stocks/MPLN.png differ diff --git a/logos/tiny_stocks/MRDB.png b/logos/tiny_stocks/MRDB.png new file mode 100644 index 0000000..a0646f7 Binary files /dev/null and b/logos/tiny_stocks/MRDB.png differ diff --git a/logos/tiny_stocks/NOMD.png b/logos/tiny_stocks/NOMD.png new file mode 100644 index 0000000..2fb641c Binary files /dev/null and b/logos/tiny_stocks/NOMD.png differ diff --git a/logos/tiny_stocks/SMTC.png b/logos/tiny_stocks/SMTC.png new file mode 100644 index 0000000..5089a97 Binary files /dev/null and b/logos/tiny_stocks/SMTC.png differ diff --git a/logos/tiny_stocks/SNDR.png b/logos/tiny_stocks/SNDR.png new file mode 100644 index 0000000..1315ac6 Binary files /dev/null and b/logos/tiny_stocks/SNDR.png differ diff --git a/logos/tiny_stocks/SQNS.png b/logos/tiny_stocks/SQNS.png new file mode 100644 index 0000000..41bbb04 Binary files /dev/null and b/logos/tiny_stocks/SQNS.png differ diff --git a/logos/tiny_stocks/TAC.png b/logos/tiny_stocks/TAC.png new file mode 100644 index 0000000..fbc80cb Binary files /dev/null and b/logos/tiny_stocks/TAC.png differ diff --git a/logos/tiny_stocks/TDUP.png b/logos/tiny_stocks/TDUP.png new file mode 100644 index 0000000..9804219 Binary files /dev/null and b/logos/tiny_stocks/TDUP.png differ diff --git a/logos/tiny_stocks/TNDM.png b/logos/tiny_stocks/TNDM.png new file mode 100644 index 0000000..bf8ca37 Binary files /dev/null and b/logos/tiny_stocks/TNDM.png differ diff --git a/logos/tiny_stocks/UHAL.B.png b/logos/tiny_stocks/UHAL.B.png new file mode 100644 index 0000000..b52c36e Binary files /dev/null and b/logos/tiny_stocks/UHAL.B.png differ diff --git a/logos/tiny_stocks/UHAL.png b/logos/tiny_stocks/UHAL.png new file mode 100644 index 0000000..b52c36e Binary files /dev/null and b/logos/tiny_stocks/UHAL.png differ diff --git a/logos/tiny_stocks/VRPX.png b/logos/tiny_stocks/VRPX.png new file mode 100644 index 0000000..b4d8d14 Binary files /dev/null and b/logos/tiny_stocks/VRPX.png differ diff --git a/logos/tiny_stocks/WISA.png b/logos/tiny_stocks/WISA.png new file mode 100644 index 0000000..cb65adc Binary files /dev/null and b/logos/tiny_stocks/WISA.png differ diff --git a/logos/tiny_stocks/XPO.png b/logos/tiny_stocks/XPO.png new file mode 100644 index 0000000..9832eae Binary files /dev/null and b/logos/tiny_stocks/XPO.png differ diff --git a/logos/tiny_stocks/ZION.png b/logos/tiny_stocks/ZION.png new file mode 100644 index 0000000..d59714d Binary files /dev/null and b/logos/tiny_stocks/ZION.png differ diff --git a/logos/tiny_stocks/ZY.png b/logos/tiny_stocks/ZY.png new file mode 100644 index 0000000..ffb2c6f Binary files /dev/null and b/logos/tiny_stocks/ZY.png differ diff --git a/server.py b/server.py index 8e0695f..f11fdf4 100755 --- a/server.py +++ b/server.py @@ -119,12 +119,13 @@ app = Flask(__name__) def index(): global command all_features = ['Current Weather','Daily Forecast','News', 'Sports (Upcoming Games)','Sports (Past Games)','Sports (Live Games)', - 'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex', 'Commodities', 'Indices'] + 'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex', 'Commodities', 'Indices', 'Movies'] global professional f = open('csv/display_settings.json', 'r') feature_settings = json.load(f) + feature_settings2 = feature_settings[0] f.close() @@ -146,6 +147,12 @@ def index(): with open('api_keys.txt', 'r') as f: api_key2 = f.readlines() + try: + with open('movie_api_key.txt', 'r') as f: + movie_api = f.readlines() + except: + movie_api = '' + with open('/etc/wpa_supplicant/wpa_supplicant.conf', 'r') as f: wifiline = f.readlines() @@ -170,6 +177,10 @@ def index(): crypto_settings = json.load(f) f.close() + f= open('csv/movie_settings.json', 'r') + movie_settings = json.load(f) + f.close() + f = open('csv/forex_settings.json', 'r') forex_settings = json.load(f) f.close() @@ -225,6 +236,11 @@ def index(): except: api_keys = '' + try: + movie_api_key = movie_api[0] + except: + movie_api_key = '' + try: wifi_SSID = wifiline[5][6:].replace('"','') except: @@ -238,7 +254,8 @@ def index(): templateData = { 'system_info':system_info, - 'currently_displaying': currently_displaying, + 'currently_displaying': currently_displaying, + 'feature_settings2': feature_settings2, 'not_displaying': not_displaying, 'not_displaying2': not_displaying2, 'stocks_settings': stocks_settings, @@ -248,6 +265,7 @@ def index(): 'forex_settings': forex_settings, 'current_weather': current_weather, 'daily_weather': daily_weather, + 'movie_settings': movie_settings, 'news_settings': news_settings, 'upcoming_games': upcoming_games, 'past_games': past_games, @@ -259,6 +277,7 @@ def index(): 'professional':professional, 'general_settings':general_settings, 'api_keys':api_keys, + 'movie_api_key':movie_api_key, 'wifi_SSID':wifi_SSID, 'wifi_PSK':wifi_PSK } @@ -273,10 +292,10 @@ def save_displaying(input_settings): global professional all_settings = ['Stocks', 'Crypto', 'Forex', 'Commodities', 'Indices', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)', - 'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages'] + 'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages', 'Movies'] professional = len(input_settings) == 2 if professional: - all_settings = ['Stocks', 'Crypto', 'Forex', 'Commodities', 'Indices', 'Current Weather', 'News', 'Daily Forecast', 'Sports (Upcoming Games)', 'Sports (Past Games)', 'Sports (Team Stats)'] + all_settings = ['Stocks', 'Crypto', 'Forex', 'Commodities', 'Indices', 'Current Weather', 'News', 'Daily Forecast', 'Sports (Upcoming Games)', 'Sports (Past Games)', 'Sports (Team Stats)', 'Sports (Live Games)', 'Custom Messages', 'Custom Images', 'Movies'] positions = [] @@ -415,6 +434,8 @@ def save(): save_weather_settings(input_settings) elif feature == 'News': save_news_settings(input_settings) + elif feature == 'Movies': + save_movie_settings(input_settings) elif 'Sports' in feature: save_sports_settings(input_settings) @@ -623,6 +644,22 @@ def saveWeatherAPIKey(): f.write(line) return index() + + +@app.route("/saveMovieAPIKey", methods = ['PUT', 'POST']) +def saveMovieAPIKey(): + + data= request.data.decode('utf-8') + settings = json.loads(data) + + key = settings['api_key'] + + with open('movie_api_key.txt', 'w') as f: + f.write(str(key)) + + return index() + + @app.route("/screensaver", methods = ['PUT', 'POST']) def screensaver(): global displaying_screensaver @@ -798,6 +835,37 @@ def save_news_settings(input_settings): json.dump(last_updates, f) f.close() + +def save_movie_settings(input_settings): + filename = 'movie_settings.json' + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + + + + current_settings['speed'] = input_settings['speed'].lower() + current_settings['speed2'] = input_settings['speed2'].lower() + current_settings['animation'] = input_settings['animation'].lower() + current_settings['title'] = input_settings['title'] + current_settings['category'] = input_settings['category'] + + + f = open('csv/' + filename, 'w') + json.dump(current_settings, f) + f.close() + #api_caller.sendline('n') + f = open('csv/last_updates.json', 'r') + last_updates = json.load(f) + f.close() + + last_updates['movies']['force'] = True + + f = open('csv/last_updates.json', 'w') + json.dump(last_updates, f) + f.close() + + def save_sports_settings(input_settings): feature = input_settings['feature'] diff --git a/setup_config_files.sh b/setup_config_files.sh index bf73eb4..e4e864e 100755 --- a/setup_config_files.sh +++ b/setup_config_files.sh @@ -13,15 +13,15 @@ rm *.json touch crypto_settings.json last_updates.json system_info.json touch league_tables.json mkdir sports -touch current_weather.json stocks_settings.json daily_weather.json live_games.json commodities_settings.json indices_settings.json +touch current_weather.json stocks_settings.json daily_weather.json live_games.json commodities_settings.json indices_settings.json movie_settings.json touch display_settings.json message_settings.json upcoming_games.json forex_settings.json touch GIF_settings.json news_settings.json image_settings.json past_games.json general_settings.json -filenames="crypto_settings.json last_updates.json league_tables.json current_weather.json stocks_settings.json daily_weather.json live_games.json commodities_settings.json indices_settings.json display_settings.json message_settings.json upcoming_games.json forex_settings.json GIF_settings.json news_settings.json image_settings.json past_games.json" +filenames="crypto_settings.json last_updates.json league_tables.json current_weather.json stocks_settings.json daily_weather.json live_games.json commodities_settings.json indices_settings.json movie_settings.json display_settings.json message_settings.json upcoming_games.json forex_settings.json GIF_settings.json news_settings.json image_settings.json past_games.json" echo '{"update_available": false, "first_boot": true}' >> system_info.json echo [\"Standard\", [[\"Stocks\", \"Crypto\", \"Forex\"]]] >> display_settings.json -echo '{"stocks": {"time": "07/03/2022 12:33:06", "force": true}, "crypto": {"time": "07/03/2022 12:28:51", "force": true}, "news": {"time": "07/03/2022 12:28:51", "force": true}, "weather": {"time": "07/03/2022 12:28:51", "force": true}, "forex": {"time": "07/03/2022 12:28:51", "force": true}, "sports_l": {"time": "07/03/2022 12:32:46", "force": true}, "sports_p": {"time": "07/03/2022 12:32:26", "force": true}, "sports_u": {"time": "07/03/2022 12:31:55", "force": true}, "sports_t": {"time": "07/03/2022 12:32:56", "force": true}, "commodities": {"time": "07/03/2022 12:32:56", "force": true}, "indices": {"time": "07/03/2022 12:32:56", "force": true}}' >> last_updates.json +echo '{"stocks": {"time": "07/03/2022 12:33:06", "force": true}, "crypto": {"time": "07/03/2022 12:28:51", "force": true}, "news": {"time": "07/03/2022 12:28:51", "force": true}, "weather": {"time": "07/03/2022 12:28:51", "force": true}, "forex": {"time": "07/03/2022 12:28:51", "force": true}, "sports_l": {"time": "07/03/2022 12:32:46", "force": true}, "sports_p": {"time": "07/03/2022 12:32:26", "force": true}, "sports_u": {"time": "07/03/2022 12:31:55", "force": true}, "sports_t": {"time": "07/03/2022 12:32:56", "force": true}, "commodities": {"time": "07/03/2022 12:32:56", "force": true}, "indices": {"time": "07/03/2022 12:32:56", "force": true}, "movies": {"time": "07/03/2022 12:32:56", "force": true}}' >> last_updates.json echo '{"feature": "Stocks", "speed": "medium","speed2": "medium", "animation": "down", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"ETH,USD": {"current": "2629.32", "24hr_change": "-27.6432", "percent_change": "-1.04"}, "BTC,USD": {"current": "38161.00", "24hr_change": "-50.8386", "percent_change": "-0.13"}, "BNB,USD": {"current": "372.57", "24hr_change": "0.4140", "percent_change": "0.11"}, "ADA,BTC": {"current": "0.0000", "24hr_change": "-0.0000", "percent_change": "-3.74"}}}' >> crypto_settings.json @@ -40,6 +40,7 @@ echo '{"speed": "medium", "speed2": "medium", "animation": "down", "title": true echo '{"feature": "News", "speed": "medium", "speed2": "medium", "animation": "down", "country": "US", "category": "General", "title": true, "headlines": [], "use_category": true, "use_country": false, "num_headlines": "10"}' >> news_settings.json echo '{"speed": "slow", "speed2": "medium","animation": "down", "title": true, "pause": "/", "images": []}' >> image_settings.json echo '{"feature": "Sports (Past Games)", "speed2": "medium", "speed": "medium", "animation": "down", "title": true, "leagues": {}}' >> past_games.json +echo '{"feature": "Movies", "speed": "fast", "speed2": "fast", "animation": "continuous", "category": "Popular All", "title": true, "movies": [{"title": "Avatar: The Way of Water", "language": "EN", "votes": "8.1", "date": "2022-12-14", "media_type": "Movie", "genre": ["Sci-Fi", "Action", "Adventure"], "backdrop": "198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg", "logo": "https://image.tmdb.org/t/p/w500/198vrF8k7mfQ4FjDJsBmdQcaiyq.jpg"}, {"title": "Violent Night", "language": "EN", "votes": "7.3", "date": "2022-11-30", "media_type": "Movie", "genre": ["Action", "Comedy", "Crime", "Thriller"], "backdrop": "g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg", "logo": "https://image.tmdb.org/t/p/w500/g9Kb3RaLjsybI1jpqHQ3QZTCYpB.jpg"}, {"title": "Avatar", "language": "EN", "votes": "7.5", "date": "2009-12-15", "media_type": "Movie", "genre": ["Action", "Adventure", "Fantasy", "Sci-Fi"], "backdrop": "Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg", "logo": "https://image.tmdb.org/t/p/w500/Yc9q6QuWrMp9nuDm5R8ExNqbEq.jpg"}, {"title": "The Banshees of Inisherin", "language": "EN", "votes": "7.7", "date": "2022-10-21", "media_type": "Movie", "genre": ["Drama", "Comedy"], "backdrop": "9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg", "logo": "https://image.tmdb.org/t/p/w500/9Md4CqzUGDtK5oEkRRvozLkGc9d.jpg"}, {"title": "Wednesday", "language": "EN", "votes": "8.8", "date": "2022-11-23", "media_type": "Tv", "genre": ["Sci-Fi & Fantasy", "Mystery", "Comedy"], "backdrop": "iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg", "logo": "https://image.tmdb.org/t/p/w500/iHSwvRVsRyxpX7FE7GbviaDvgGZ.jpg"}, {"title": "1923", "language": "EN", "votes": "8.8", "date": "2022-12-18", "media_type": "Tv", "genre": ["Drama", "Western"], "backdrop": "9I6LgZ5110ycg4pyobJxGTFWFCF.jpg", "logo": "https://image.tmdb.org/t/p/w500/9I6LgZ5110ycg4pyobJxGTFWFCF.jpg"}, {"title": "The Recruit", "language": "EN", "votes": "7.2", "date": "2022-12-16", "media_type": "Tv", "genre": ["Drama", "Crime"], "backdrop": "rey2eh6752C2UbGYRileKk1PVTo.jpg", "logo": "https://image.tmdb.org/t/p/w500/rey2eh6752C2UbGYRileKk1PVTo.jpg"}, {"title": "Black Adam", "language": "EN", "votes": "7.2", "date": "2022-10-19", "media_type": "Movie", "genre": ["Action", "Fantasy", "Sci-Fi"], "backdrop": "bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg", "logo": "https://image.tmdb.org/t/p/w500/bQXAqRx2Fgc46uCVWgoPz5L5Dtr.jpg"}, {"title": "Nanny", "language": "EN", "votes": "5.4", "date": "2022-11-23", "media_type": "Movie", "genre": ["Horror", "Drama"], "backdrop": "nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg", "logo": "https://image.tmdb.org/t/p/w500/nfuPlOK6ywGzKGb0yf7VJKyTFWb.jpg"}, {"title": "Tom Clancy's Jack Ryan", "language": "EN", "votes": "7.7", "date": "2018-08-30", "media_type": "Tv", "genre": ["Action & Adventure", "Drama", "War & Politics"], "backdrop": "6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg", "logo": "https://image.tmdb.org/t/p/w500/6ovk8nrrSmN1ieT14zBAxcHbMU7.jpg"}, {"title": "High Heat", "language": "EN", "votes": "6.5", "date": "2022-12-16", "media_type": "Movie", "genre": ["Action", "Comedy", "Crime"], "backdrop": "gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg", "logo": "https://image.tmdb.org/t/p/w500/gjNM0odqkq5F7V58OjfTxPJ9p9Z.jpg"}, {"title": "A Not So Merry Christmas", "language": "ES", "votes": "4.8", "date": "2022-12-20", "media_type": "Movie", "genre": ["Comedy"], "backdrop": "8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg", "logo": "https://image.tmdb.org/t/p/w500/8uyJzaiGbiezZ9K48Cy5wXeqnYw.jpg"}, {"title": "Guillermo del Toro's Pinocchio", "language": "EN", "votes": "8.5", "date": "2022-11-09", "media_type": "Movie", "genre": ["Animation", "Fantasy", "Drama"], "backdrop": "e782pDRAlu4BG0ahd777n8zfPzZ.jpg", "logo": "https://image.tmdb.org/t/p/w500/e782pDRAlu4BG0ahd777n8zfPzZ.jpg"}, {"title": "His Dark Materials", "language": "EN", "votes": "8.0", "date": "2019-11-03", "media_type": "Tv", "genre": ["Sci-Fi & Fantasy", "Drama"], "backdrop": "dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg", "logo": "https://image.tmdb.org/t/p/w500/dGOhplPZTL0SKyb0ocTFBHIuKUC.jpg"}, {"title": "The Fabelmans", "language": "EN", "votes": "7.8", "date": "2022-11-11", "media_type": "Movie", "genre": ["Drama", "Comedy"], "backdrop": "6RCf9jzKxyjblYV4CseayK6bcJo.jpg", "logo": "https://image.tmdb.org/t/p/w500/6RCf9jzKxyjblYV4CseayK6bcJo.jpg"}, {"title": "The Seven Deadly Sins: Grudge of Edinburgh Part 1", "language": "JA", "votes": "7.8", "date": "2022-12-20", "media_type": "Movie", "genre": ["Animation", "Fantasy", "Adventure", "Action"], "backdrop": "24fe6ou97ammOg3O6ShCgaiolp4.jpg", "logo": "https://image.tmdb.org/t/p/w500/24fe6ou97ammOg3O6ShCgaiolp4.jpg"}, {"title": "Mindcage", "language": "EN", "votes": "7.6", "date": "2022-12-16", "media_type": "Movie", "genre": ["Mystery", "Thriller", "Crime", "Drama"], "backdrop": "An2M2gm0p8POaiGTcZvP1JnUItH.jpg", "logo": "https://image.tmdb.org/t/p/w500/An2M2gm0p8POaiGTcZvP1JnUItH.jpg"}, {"title": "Private Lesson", "language": "TR", "votes": "7.3", "date": "2022-12-16", "media_type": "Movie", "genre": ["Comedy", "Romance"], "backdrop": "uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg", "logo": "https://image.tmdb.org/t/p/w500/uZtYhcnk3WWvUzQkJLqnNywMQpb.jpg"}, {"title": "Sonic Prime", "language": "EN", "votes": "8.7", "date": "2022-12-15", "media_type": "Tv", "genre": ["Animation", "Family"], "backdrop": "1Iiz2uLcZuLn4Khog2yiKpbl11.jpg", "logo": "https://image.tmdb.org/t/p/w500/1Iiz2uLcZuLn4Khog2yiKpbl11.jpg"}, {"title": "The Big 4", "language": "ID", "votes": "7.0", "date": "2022-12-19", "media_type": "Movie", "genre": ["Action", "Comedy", "Crime"], "backdrop": "clO1mWRYT24ogzN3o6LsqHjqrQu.jpg", "logo": "https://image.tmdb.org/t/p/w500/clO1mWRYT24ogzN3o6LsqHjqrQu.jpg"}]}' >> movie_settings.json echo '{"brightness": 10, "country_code": "GB", "hostname": "fintic"}' >> general_settings.json chmod 777 * @@ -59,7 +60,9 @@ touch 'Current Weather Prof.ppm' touch 'Current Weather.ppm' touch 'Custom GIFs.gif' touch 'Custom Images.ppm' +touch 'Custom Images Prof.ppm' touch 'Custom Messages.ppm' +touch 'Custom Messages Prof.ppm' touch 'Daily Forecast.ppm' touch 'Daily Forecast Prof.ppm' touch 'Forex Prof.ppm' @@ -67,6 +70,7 @@ touch 'Forex.ppm' touch 'News Prof.ppm' touch 'News.ppm' touch 'Sports (Live Games).ppm' +touch 'Sports (Live Games) Prof.ppm' touch 'Sports (Past Games).ppm' touch 'Sports (Past Games) Prof.ppm' touch 'Sports (Team Stats).ppm' @@ -83,6 +87,8 @@ touch 'Commodities.ppm' touch 'Commodities Prof.ppm' touch 'Indices.ppm' touch 'Indices Prof.ppm' +touch 'Movies.ppm' +touch 'Movies Prof.ppm' chmod 777 * diff --git a/static/app.js b/static/app.js index 765456a..ad552df 100755 --- a/static/app.js +++ b/static/app.js @@ -46,6 +46,7 @@ var gifsFeatures = document.querySelectorAll("#gifs-features li"); var messagesFeatures = document.querySelectorAll("#messages-features li"); var commoditiesFeatures = document.querySelectorAll("#commodities-features li"); var indicesFeatures = document.querySelectorAll("#indices-features li"); +var moviesFeatures = document.querySelectorAll("#movies-features li"); var allFeaturesList = [ stocksFeatures, @@ -63,6 +64,7 @@ var allFeaturesList = [ messagesFeatures, commoditiesFeatures, indicesFeatures, + moviesFeatures, ]; // features remove buttons @@ -87,6 +89,7 @@ var gifsRemoveBtn = document.getElementById("gifs-remove-btn"); var messagesRemoveBtn = document.getElementById("messages-remove-btn"); var commoditiesRemoveBtn = document.getElementById("commodities-remove-btn"); var indicesRemoveBtn = document.getElementById("indices-remove-btn"); +var moviesRemoveBtn = document.getElementById("movies-remove-btn"); var allFeaturesRemoveBtns = [ stocksRemoveBtn, @@ -104,6 +107,7 @@ var allFeaturesRemoveBtns = [ messagesRemoveBtn, commoditiesRemoveBtn, indicesRemoveBtn, + moviesRemoveBtn, ]; // features increase buttons var stocksincreaseBtn = document.getElementById("stocks-increase-btn"); @@ -127,6 +131,7 @@ var gifsincreaseBtn = document.getElementById("gifs-increase-btn"); var messagesincreaseBtn = document.getElementById("messages-increase-btn"); var commoditiesincreaseBtn = document.getElementById("commodities-increase-btn"); var indicesincreaseBtn = document.getElementById("indices-increase-btn"); +var moviesincreaseBtn = document.getElementById("movies-increase-btn"); var allFeaturesIncreaseBtns = [ stocksincreaseBtn, @@ -144,6 +149,7 @@ var allFeaturesIncreaseBtns = [ messagesincreaseBtn, commoditiesincreaseBtn, indicesincreaseBtn, + moviesincreaseBtn, ]; // features decrease buttons @@ -168,6 +174,7 @@ var gifsDecreaseBtn = document.getElementById("gifs-decrease-btn"); var messagesDecreaseBtn = document.getElementById("messages-decrease-btn"); var commoditiesDecreaseBtn = document.getElementById("commodities-decrease-btn"); var indicesDecreaseBtn = document.getElementById("indices-decrease-btn"); +var moviesDecreaseBtn = document.getElementById("movies-decrease-btn"); var allFeaturesDecreaseBtns = [ stocksDecreaseBtn, @@ -185,6 +192,7 @@ var allFeaturesDecreaseBtns = [ messagesDecreaseBtn, commoditiesDecreaseBtn, indicesDecreaseBtn, + moviesDecreaseBtn, ]; const changeVarValue = () => { @@ -209,6 +217,7 @@ const changeVarValue = () => { messagesFeatures = document.querySelectorAll("#messages-features li"); commoditiesFeatures = document.querySelectorAll("#commodities-features li"); indicesFeatures = document.querySelectorAll("#indices-features li"); + moviesFeatures = document.querySelectorAll("#movies-features li"); allFeaturesList = [ stocksFeatures, @@ -226,6 +235,7 @@ const changeVarValue = () => { messagesFeatures, commoditiesFeatures, indicesFeatures, + moviesFeatures, ]; }; @@ -596,6 +606,7 @@ var gifs = document.getElementById("gifs-features"); var messages = document.getElementById("messages-features"); var commodities = document.getElementById("commodities-features"); var indices = document.getElementById("indices-features"); +var movies = document.getElementById("movies-features"); var allFeatures = [ stocks, @@ -613,6 +624,7 @@ var allFeatures = [ messages, commodities, indices, + movies, ]; // features select box @@ -621,6 +633,7 @@ var upcomingGamesSelect = document.getElementById("inputTransition73"); var pastGamesSelect = document.getElementById("inputTransition83"); var liveGamesSelect = document.getElementById("inputTransition93"); var teamStatsSelect = document.getElementById("inputTransition103"); +var moviesSelect = document.getElementById("inputTransition64"); var allFeaturesSelectBox = [ null, null, @@ -637,6 +650,7 @@ var allFeaturesSelectBox = [ null, null, null, + moviesSelect, ]; // features select add buttons @@ -661,6 +675,7 @@ var allFeaturesSelectAddBtn = [ null, null, null, + null, ]; allFeaturesSelectAddBtn.map((value, index) => { @@ -695,6 +710,7 @@ var allFeaturesFile = [ null, null, null, + null, ]; // features file add button var imagesFileAddBtn = document.getElementById("inputTextBtn11"); @@ -716,6 +732,7 @@ var allFeaturesFileAddBtn = [ null, null, null, + null, ]; // features input text @@ -744,6 +761,7 @@ var allFeaturesText = [ messagesText, commoditiesText, indicesText, + null, ]; // features text add button @@ -772,6 +790,7 @@ var allFeaturesTextAddBtn = [ messagesTextAddBtn, commoditiesTextAddBtn, indicesTextAddBtn, + null, ]; @@ -791,6 +810,7 @@ var allFeaturesLimit = [ 20, 30, 40, + null, ]; @@ -910,6 +930,7 @@ shutdownButton.addEventListener("click", () => { fetch("/shutdown", { method: "GET", }); + document.getElementById('yooo').style.display = "block"; }); @@ -919,6 +940,7 @@ restartButton.addEventListener("click", () => { fetch("/restart", { method: "GET", }); + document.getElementById('yooo').style.display = "block"; }); var resetButton = document.getElementById("reset-btn"); @@ -1047,6 +1069,7 @@ function getFeatureSettings() { "Custom Messages", "Commodities", "Indices", + "Movies", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1103,6 +1126,9 @@ function getFeatureSettings() { case 15: s = getTradingSettings(page); break; + case 16: + s = getMovieSettings(page); + break; } settings = { ...settings, ...s }; // merge both sets of settings @@ -1226,6 +1252,7 @@ function saveWeatherAPIKey(){ "Custom Messages", "Commodities", "Indices", + "Movies", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1246,7 +1273,48 @@ function saveWeatherAPIKey(){ } +function saveMovieAPIKey(){ + let featureSelector = document.getElementById("drop"); + feature = getSelected(featureSelector); + let features = [ + "Stocks", + "Crypto", + "Forex", + "Current Weather", + "Daily Forecast", + "News", + "Sports (Upcoming Games)", + "Sports (Past Games)", + "Sports (Live Games)", + "Sports (Team Stats)", + "Custom Images", + "Custom GIFs", + "Custom Messages", + "Commodities", + "Indices", + "Movies", + ]; + let pageNum = features.indexOf(feature) + 1; + let pageSelector = "Page" + pageNum.toString(); + let page = document.getElementById(pageSelector); + + let api_key = page.querySelectorAll(".api-key")[0].value; + let settings = { + api_key:api_key + }; + + console.log(settings); + + fetch("/saveMovieAPIKey", { + method: "POST", + body: JSON.stringify(settings), + }); +} + + +var movieAPIbtn = document.getElementById("movie-api-btn"); +movieAPIbtn.addEventListener("click", saveMovieAPIKey); var weatherAPIbtn = document.getElementById("weather-api-btn"); weatherAPIbtn.addEventListener("click", saveWeatherAPIKey); @@ -1274,6 +1342,21 @@ function getNewsSettings(page) { return settings; } +function getMovieSettings(page) { + + let category = getSelected(page.querySelectorAll(".movie-categories")[0]); + let title = page.querySelectorAll(".title-select")[0].checked; + let api_key = page.querySelectorAll(".api-key")[0]; + + settings = { + category: category, + title: title, + api_key: api_key + }; + + return settings; +} + function getSportsSettings(page) { let title = page.querySelectorAll(".title-select")[0].checked; let leagues_el = page.querySelectorAll(".league-list")[0]; @@ -1482,7 +1565,6 @@ let bottomRowText = document.querySelector("#bottom-row-text"); displayFormatBtn.addEventListener("click", () => { selectedDisplayText.innerText = displayFormatDropDown.value; - localStorage.setItem("displayFormat", displayFormatDropDown.value); if (selectedDisplayText.innerText === "Professional Two Rows") { topRowText.style.display = "inline"; bottomRowText.style.display = "inline"; @@ -1507,7 +1589,6 @@ let resetSettingsBtn = document.querySelector("#reset-btn") resetSettingsBtn.addEventListener("click", () => { selectedDisplayText.innerText = "Standard Scrolling"; - localStorage.setItem("displayFormat", "Standard Scrolling"); topRowText.style.display = "none"; bottomRowText.style.display = "none"; secondRow.style.display = "none"; @@ -1579,7 +1660,7 @@ inputAnimationBtn.addEventListener("click", () => { // scroll speed row two let inputScrollSpeedRow = []; -for (let i = 1; i <= 15; i++) { +for (let i = 1; i <= 16; i++) { inputScrollSpeedRow.push( document.getElementById( i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}` @@ -1604,8 +1685,8 @@ window.onload = () => { //getWifiPass && (wifiPassInput.value = getWifiPass); //getCountryCode && (countryCodeInput.value = getCountryCode); - let getDispayFormat = localStorage.getItem("displayFormat"); - getDispayFormat && (displayFormatDropDown.value = getDispayFormat); +// let getDispayFormat = localStorage.getItem("displayFormat"); +// getDispayFormat && (displayFormatDropDown.value = getDispayFormat); selectedDisplayText.innerText = displayFormatDropDown.value; // getInputAnimation && (inputAnimation.value = getInputAnimation); @@ -1724,6 +1805,26 @@ function showWeatherP() { } +// Display message asking for restart of ticker when new API key added for movie + +function showMovieP() { + if(document.getElementById("api-key-movie").value==="") { + + document.getElementById('movie-api-p').style.display = "none"; + } + + else if (document.getElementById("api-key-movie").value==="Movies API Key") { + document.getElementById('movie-api-p').style.display = "none"; + + } + + else { + document.getElementById('movie-api-p').style.display = "block" + } + + } + + // Disable adding cities when no API key detected @@ -2193,14 +2294,14 @@ var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/; // createLi = false; } - else if (!["^DJI","^GSPC","^NDX","^RUT","^VIX","^GSPTSE","^MXX","^BVSP","^GDAXI","^FTSE","^IBEX","^FCHI","^SSMI","^BFX","^ATX","^AEX","^OMX", + else if (!["^DJI","^GSPC","^NDX","^RUT","^VIX","^GSPTSE","^MXX","^BVSP","^GDAXI","^FTSE","^IBEX","^FCHI","^SSMI","^BFX","^ATX","^AEX","^OMX","^IXIC","FTSEMIB.MI", "^OMXH25","PSI20.LS","^STOXX","^STOXX50E","^N100","^KS11","^NZ50","^AXJO","^STI","000001.SS","399001.SZ","^N225","^NSEI","^BSESN","^HSI","^TWII","^JKSE","PSEI.PS","^SET.BK","XU100.IS"].includes(x)) { document.getElementById('demo9').style.display = "block"; document.getElementById("inputText21").value = ''; text = "Invalid index symbol" } - + else { text = "Input OK"; document.getElementById('demo9').style.display = "none"; diff --git a/static/style.css b/static/style.css index ef42760..e4fbfe4 100755 --- a/static/style.css +++ b/static/style.css @@ -1117,6 +1117,10 @@ h3 { color:red; } +#movie-api-p { + color:red; +} + label:hover { cursor:text; } diff --git a/stockTicker.py b/stockTicker.py index c8e7886..4714eaf 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -12,7 +12,7 @@ import threading from PIL import Image, ImageDraw, ImageFont, ImageSequence Image.init() - +import pytz import time import csv import requests @@ -68,22 +68,22 @@ class StockTicker(): 'Daily Forecast':self.getDailyWeatherImage, 'Current Weather': self.getTodayWeatherImage, 'Sports (Team Stats)':lambda : self.getLeagueTableImage('premier_league'), 'Sports (Past Games)': lambda:self.getLeagueImage('NBA', 'past'), 'Sports (Upcoming Games)': lambda : self.getLeagueImage('NHL', 'future'), 'Sports (Live Games)': lambda: self.getLeagueImage('NBA', 'live'), - 'News':self.getNewsImage, 'Custom Messages': self.getUserMessages, 'Commodities': self.getCommoditiesImage, 'Indices': self.getIndicesImage, + 'News':self.getNewsImage, 'Custom Messages': self.getUserMessages, 'Commodities': self.getCommoditiesImage, 'Indices': self.getIndicesImage, 'Movies': self.getMoviesImage, 'Stocks Prof': self.getStockProfessional, 'Crypto Prof': self.getCryptoProfessional, 'Forex Prof': self.getForexProfessional, 'Current Weather Prof': self.getTodayWeatherProfessional, 'News Prof':self.getNewsProfessional, 'Commodities Prof':self.getCommoditiesProfessional, 'Indices Prof': self.getIndicesProfessional, 'Daily Forecast Prof':self.getDailyWeatherProfessional, 'Sports (Team Stats) Prof':lambda : self.getLeagueTableProfessional('NHL'), 'Sports (Upcoming Games) Prof': lambda : self.getLeagueProfessional('NHL', 'future'), - 'Sports (Past Games) Prof': lambda : self.getLeagueProfessional('NBA', 'past')} + 'Sports (Past Games) Prof': lambda : self.getLeagueProfessional('NBA', 'past'), 'Custom Messages Prof': self.getUserMessagesProfessional, 'Custom Images Prof': self.getUserImagesProfessional, 'Movies Prof': self.getMoviesProfessional, 'Sports (Live Games) Prof': lambda : self.getLeagueProfessional('NBA', 'live')} self.JSONs = {'Stocks': 'csv/stocks_settings.json', 'Crypto': 'csv/crypto_settings.json', 'Forex': 'csv/forex_settings.json', 'Daily Forecast':'csv/daily_weather.json', 'Current Weather': 'csv/current_weather.json', 'Commodities':'csv/commodities_settings.json', 'Indices': 'csv/indices_settings.json', 'Sports (Team Stats)': 'csv/league_tables.json', 'Sports (Past Games)': 'csv/past_games.json', - 'Sports (Upcoming Games)': 'csv/upcoming_games.json', 'Sports (Live Games)': 'csv/live_games.json', + 'Sports (Upcoming Games)': 'csv/upcoming_games.json', 'Sports (Live Games)': 'csv/live_games.json', 'Movies': 'csv/movie_settings.json', 'News':'csv/news_settings.json', 'Custom Images': 'csv/image_settings.json', 'Custom GIFs': 'csv/GIF_settings.json', 'Custom Messages': 'csv/message_settings.json', 'Stocks Prof': 'csv/stocks_settings.json', 'Crypto Prof': 'csv/crypto_settings.json', 'Forex Prof': 'csv/forex_settings.json', 'Current Weather Prof': 'csv/current_weather.json', 'News Prof':'csv/news_settings.json', 'Commodities Prof':'csv/commodities_settings.json', 'Indices Prof': 'csv/indices_settings.json', - 'Daily Forecast Prof':'csv/daily_weather.json', 'Sports (Team Stats) Prof': 'csv/league_tables.json', 'Sports (Upcoming Games) Prof': 'csv/upcoming_games.json', 'Sports (Past Games) Prof': 'csv/past_games.json'} + 'Daily Forecast Prof':'csv/daily_weather.json', 'Sports (Team Stats) Prof': 'csv/league_tables.json', 'Sports (Upcoming Games) Prof': 'csv/upcoming_games.json', 'Sports (Past Games) Prof': 'csv/past_games.json', 'Custom Messages Prof': 'csv/message_settings.json', 'Custom Images Prof': 'csv/image_settings.json', 'Movies Prof': 'csv/movie_settings.json', 'Sports (Live Games) Prof': 'csv/live_games.json'} def openImage(self, image_file): @@ -716,9 +716,14 @@ class StockTicker(): 'White':(255,255,255), 'Red':(255,0,0), 'Green':(0,255,0), + 'Dark Green':(0,100,0), 'Blue':(0,0,255), - 'Purple':(255,0,255), + 'Purple':(145,0,255), + 'Pink':(255,0,255), 'Yellow':(255,255,0), + 'Orange':(255,130,0), + 'Gold':(255,190,0), + 'Gray':(100,100,100), 'Cyan':(0,255,255)} imgs = [] for ind, message in enumerate(all_settings['messages']): @@ -749,6 +754,71 @@ class StockTicker(): return imgs + + def getUserMessagesProfessional(self): + + f = open('csv/message_settings.json', 'r') + all_settings = json.load(f) + f.close() + + if all_settings['title']: + title_img = self.openImage('feature_titles/small_feature_titles/message.png') + image_list = [title_img] + else: + image_list = [] + + colours = {'Black':(0,0,0), + 'White':(255,255,255), + 'Red':(255,0,0), + 'Green':(0,255,0), + 'Dark Green':(0,100,0), + 'Blue':(0,0,255), + 'Purple':(145,0,255), + 'Pink':(255,0,255), + 'Yellow':(255,255,0), + 'Orange':(255,130,0), + 'Gold':(255,190,0), + 'Gray':(100,100,100), + 'Cyan':(0,255,255)} + + blank = Image.new('RGB', (0, 16)) + + for i, message in enumerate(all_settings['messages']): + if (i == len(all_settings['messages'])-1): + font = ImageFont.load("./fonts/6x13.pil") + location = (5, 2) + + + r,g,b = colours[message['text_colour']] + + background = colours[message['background_colour']] + msg_img = self.textImage(message['text'], font, int(r), int(g), int(b), True, w_buff = 11, background = background, location = location) + + img = Image.new('RGB', (msg_img.size[0] + 5, 32)) + img.paste(msg_img, (0,0)) + + image_list.append(img) + image_list.append(blank) + + else: + font = ImageFont.load("./fonts/6x13.pil") + location = (5, 2) + + + r,g,b = colours[message['text_colour']] + + background = colours[message['background_colour']] + msg_img = self.textImage(message['text'], font, int(r), int(g), int(b), True, w_buff = 11, background = background, location = location) + + img = Image.new('RGB', (msg_img.size[0] + 130, 32)) + img.paste(msg_img, (0,0)) + + image_list.append(img) + image_list.append(blank) + + return self.stitchImage(image_list) + + def displayGIF(self, gif, delay = 0.5, repeat = True): # To iterate through the entire gif i = 0 @@ -1909,14 +1979,13 @@ class StockTicker(): #logo = logo.resize((int(width/2), int(height/2))) - img = Image.new('RGB', (headline_img.size[0]+ source_img.size[0] + logo.size[0] +5, 32)) - img.paste(headline_img, (source_img.size[0]+ logo.size[0] -5, 3)) - img.paste(source_img, (2,3)) - - img= self.stitchImage([logo,img]) - - - + img = Image.new('RGB', (headline_img.size[0]+ source_img.size[0] + logo.size[0] +22, 32)) + img.paste(headline_img, (source_img.size[0]+logo.size[0] + 10, 3)) + img.paste(source_img, (logo.size[0]+2,3)) + img.paste(logo, (0,0)) + + + image_list.append(img) image_list.append(blank) @@ -1935,18 +2004,14 @@ class StockTicker(): return news_image + def getLeagueImage(self, league=False, time = 'past'): if time in ['past', 'live']: filepath = 'csv/{}_games.json'.format(time) - else: - filepath = 'csv/upcoming_games.json' - - - f = open(filepath, 'r') all_settings = json.load(f) f.close() @@ -1958,145 +2023,402 @@ class StockTicker(): else: imgs = [] - leagues_info = all_settings['leagues'] - leagues = list(leagues_info.keys()) - - for league in leagues: - try: - x_offset = 0 - img = Image.new('RGB', (10000, 32)) - league_info = leagues_info[league] - - + + if time == 'live': + for league in leagues: try: - league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') - img.paste(league_logo, (x_offset,0)) - x_offset += league_logo.size[0] +self.blank.size[0] - except: + x_offset = 0 + if league == 'NFL': + f = open('csv/live_nfl.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['NFL'][0] + elif league == 'NHL': + f = open('csv/live_nhl.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['NHL'][0] + elif league == 'NBA': + f = open('csv/live_nba.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['NBA'][0] + elif league == 'MLB': + f = open('csv/live_mlb.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['MLB'][0] + elif league == 'MLS': + f = open('csv/live_mls.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['MLS'][0] + elif league == 'PREMIERLEAGUE': + f = open('csv/live_pl.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['PREMIERLEAGUE'][0] + + img = Image.new('RGB', (10000, 32)) + + try: + league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + img.paste(league_logo, (x_offset,0)) + x_offset += league_logo.size[0] +self.blank.size[0] + except: + pass + + slight_large_font = ImageFont.load("./fonts/9x15.pil") + small_font = ImageFont.load("./fonts/5x7.pil") + med_font = ImageFont.load("./fonts/7x14B.pil") + large_font = ImageFont.load("./fonts/9x18B.pil") + extra_small_font = ImageFont.load("./fonts/4x6.pil") + + try: + sports_info = self.readSportsCSV(league) + except: + pass + + buff_size = 25 + + if all_settings['leagues'][league][2] == 'no_live' and all_settings['leagues'][league][3] == 'no_upcoming': + no_match = self.textImage(('No live games').upper(), slight_large_font, r = 255, g = 255 , b = 255) + img.paste(no_match, (x_offset,10)) + x_offset += no_match.size[0] + buff_size + + elif all_settings['leagues'][league][3] != 'no_upcoming': + next_match = self.textImage('Next game: ' + all_settings['leagues'][league][3], slight_large_font, r=255,g=255,b=255) + img.paste(next_match, (x_offset,10)) + x_offset += next_match.size[0] + buff_size + + else: + for match in league_info: + + dateEvent = match['time'] + date_timage = self.textImage(dateEvent, small_font, r=255, g=255, b=255) + + strHomeTeam = match['home_team'] + strAwayTeam = match['away_team'] + intHomeScore = str(match['home_score']) + intAwayScore = str(match['away_score']) + + try: + home_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strHomeTeam]['logo'])) + except Exception as e: + home_logo = self.textImage(strHomeTeam.replace(' ', '\n'), extra_small_font, r = 255, g = 255, b = 255) + + try: + away_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strAwayTeam]['logo'])) + except Exception as e: + away_logo = self.textImage(strAwayTeam.replace(' ', '\n'), extra_small_font, r = 255, g = 255, b = 255) + + img.paste(home_logo, (x_offset,0)) + + x_offset += home_logo.size[0] + 4 + + score_image = self.textImage(intHomeScore + '-' + intAwayScore, large_font, h_buff = 5, r = 255, g = 255, b = 255) + + try: + h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) + except: + pass + try: + a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) + except: + pass + try: + hc_timage = self.textImage(sports_info[strHomeTeam]['code'], small_font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) + except Exception as e: + hc_timage = self.textImage('.', extra_small_font, r = 255, g = 255, b = 255) + try: + ac_timage = self.textImage(sports_info[strAwayTeam]['code'], small_font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) + except Exception as e: + ac_timage = self.textImage('.', extra_small_font, r = 255, g = 255, b = 255) + + vs_timage = self.textImage('VS', extra_small_font, r = 255, g = 255, b = 255) + + vs_size = hc_timage.size[0] + ac_timage.size[0] + vs_timage.size[0] + + main_offset = x_offset + int(max(vs_size, date_timage.size[0], score_image.size[0])/2) + img.paste(date_timage,(main_offset - int(date_timage.size[0]/2),0)) + img.paste(vs_timage, (main_offset - int(vs_timage.size[0]/2),10)) + img.paste(hc_timage, (main_offset - int(vs_timage.size[0]/2) - hc_timage.size[0], 9)) + img.paste(score_image, (main_offset - int(score_image.size[0]/2), 15)) + if match['isLive'] == 'post': + if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + u_image = Image.new("RGB", (hc_timage.size[0] -2, 1)) + u_image1 = ImageDraw.Draw(u_image) + u_image1.line((0,0,hc_timage.size[0]-2,0), fill="red", width = 0) + img.paste(u_image, (main_offset - int(vs_timage.size[0]/2)-hc_timage.size[0], hc_timage.size[1]+7)) + img.paste(ac_timage, (main_offset + int(vs_timage.size[0]/2),9)) + if match['isLive'] == 'post': + if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + ua_image = Image.new("RGB", (ac_timage.size[0] -2, 1)) + ua_image1 = ImageDraw.Draw(ua_image) + ua_image1.line((0,0,ac_timage.size[0]-2,0), fill="red", width = 0) + img.paste(ua_image, (main_offset + int(vs_timage.size[0]/2), ac_timage.size[1]+7)) + x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + ac_timage.size[0], int(score_image.size[0]/2)) + 4) + + img.paste(away_logo, (x_offset,0)) + x_offset += away_logo.size[0] + buff_size + + img = img.crop((0,0,x_offset,32)) + imgs.append(img) + except Exception as e: pass - small_font = ImageFont.load("./fonts/5x7.pil") - med_font = ImageFont.load("./fonts/7x14B.pil") - large_font = ImageFont.load("./fonts/9x18B.pil") - sports_info = self.readSportsCSV(league) - - buff_size = 25 - - for match in league_info: - strHomeTeam = match['home_team'] - strAwayTeam = match['away_team'] - - if time != 'future': - intHomeScore = str(match['home_score']) - intAwayScore = str(match['away_score']) - - dateEvent = match['date'].replace('-', '.') - - - try: - - home_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strHomeTeam]['logo'])) - - except Exception as e: - home_logo = self.textImage(strHomeTeam.replace(' ', '\n'), small_font, r = 255, g = 255, b = 255) - - - try: - - away_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strAwayTeam]['logo'])) - - except Exception as e: - away_logo = self.textImage(strAwayTeam.replace(' ', '\n'), small_font, r = 255, g = 255, b = 255) - - - date_timage = self.textImage(dateEvent, small_font, r = 255, g = 255, b = 255) - - img.paste(home_logo, (x_offset,0)) - - x_offset += home_logo.size[0] + 2 - - - if time == 'future': - img.paste(date_timage, (x_offset+5, 0)) - - - h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) - a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) - - - hc_timage = self.textImage(sports_info[strHomeTeam]['code'], med_font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) - ac_timage = self.textImage(sports_info[strAwayTeam]['code'], med_font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) - vs_timage = self.textImage('vs', med_font, r = 255, g = 255, b = 255, h_buff = 5) - - img.paste(hc_timage, (x_offset, 9)) - img.paste(vs_timage, (x_offset + hc_timage.size[0], 9)) - img.paste(ac_timage, (x_offset + hc_timage.size[0] + vs_timage.size[0], 9)) - x_offset += max( date_timage.size[0], hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0]) + else: + for league in leagues: + try: + x_offset = 0 + if (league =='PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + img = Image.new('RGB', (10000, 32)) else: - - score_image = self.textImage(intHomeScore + '-' + intAwayScore, large_font, h_buff = 5, r = 255, g = 255, b = 255) - - #vs_timage = self.textImage(sports_info[home_team]['code'] + 'vs' + sports_info[away_team]['code'], small_font, r = 255, g = 255, b = 255) - - h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) - a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) - - hc_timage = self.textImage(sports_info[strHomeTeam]['code'], small_font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) - ac_timage = self.textImage(sports_info[strAwayTeam]['code'], small_font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) - vs_timage = self.textImage('vs', small_font, r = 255, g = 255, b = 255) - - if date_timage.size[0] > score_image.size[0]: - img.paste(date_timage, (x_offset+2, 0)) - img.paste(hc_timage, (x_offset+6, 9)) - img.paste(vs_timage, (x_offset+5 + hc_timage.size[0], 9)) - img.paste(ac_timage, (x_offset+6 + hc_timage.size[0] + vs_timage.size[0], 9)) - img.paste(score_image, (x_offset + 2 + int((date_timage.size[0] - score_image.size[0])/2), 15)) - else: - - img.paste(date_timage, (x_offset+1+int((score_image.size[0] - date_timage.size[0] )/2), 0)) - vs_size = hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0] - img.paste(hc_timage, (x_offset + 1 + int((score_image.size[0] - vs_size)/2), 9)) - img.paste(vs_timage, (x_offset + int((score_image.size[0] - vs_size)/2) + hc_timage.size[0], 9)) - img.paste(ac_timage, (x_offset+1 + int((score_image.size[0] - vs_size)/2) + hc_timage.size[0] + vs_timage.size[0], 9)) - - img.paste(score_image, (x_offset+1, 15)) - - - x_offset += max( date_timage.size[0]+4, hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0]+4, 2 + int(score_image.size[0])) - - #img.paste(vs_timage, (x_offset+4, 9)) + img = Image.new('RGB', (10000, 32)) + league_info = leagues_info[league] - #if league == 'NHL': - # - #img.paste(round_timage, (x_offset+ 7, 8)) - #x_offset += max(home_timage.size[0], away_timage.size[0], date_timage.size[0], round_timage.size[0], score_image.size[0]) - img.paste(away_logo, (x_offset,0)) - - x_offset += away_logo.size[0] - x_offset += buff_size - img = img.crop((0,0,x_offset ,32)) - imgs.append(img) - except Exception as e: - pass -# logf = open('log.txt', "a") -# exc_type, exc_obj, exc_tb = sys.exc_info() -# fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] -# logf.write(str(e)) -# logf.write('. file: ' + fname) -# logf.write('. line: ' + str(exc_tb.tb_lineno)) -# logf.write('. type: ' + str(exc_type)) -# logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) -# logf.close() + try: + league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + x_offset += self.blank.size[0] + else: + img.paste(league_logo, (x_offset,0)) + x_offset += league_logo.size[0] +self.blank.size[0] + except: + pass + + + small_font = ImageFont.load("./fonts/5x7.pil") + med_font = ImageFont.load("./fonts/7x14B.pil") + large_font = ImageFont.load("./fonts/9x18B.pil") + extra_small_font = ImageFont.load("./fonts/4x6.pil") + try: + sports_info = self.readSportsCSV(league) + except: + pass + + buff_size = 25 + + for match in league_info: + + dateEvent = match['date'].replace('-', '.') + date_timage = self.textImage(dateEvent, small_font, r=255, g=255, b=255) + + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + event = match['event'] + venue = match['venue'] + city = match['city'] + country = match['country'] + season = match['season'] + + if time != 'future': + golf_standings1 = match['golf_standings'][::2] + golf_standings2 = match['golf_standings'][1::2] + + img.paste(league_logo, (x_offset, 0)) + x_offset += league_logo.size[0] + 2 + + if time == 'future': + + event_timage = self.textImage(event, med_font, r=255, g=255, b=0) + venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0) + city_timage = self.textImage(city, small_font, r=255, g=255, b=255) + country_timage = self.textImage(country, small_font, r=255, g=255, b=255) + date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171) + season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255) + season_timage = self.textImage(season, small_font, r=255, g=255, b=255) + + #date + img.paste(date1_timage, (x_offset + 2, 26)) + img.paste(date_timage, (x_offset + date1_timage.size[0] + 3, 26)) + #event + img.paste(event_timage, (x_offset + 2, 0)) + #venue + img.paste(venue_timage,(x_offset + 2, 16)) + #country + img.paste(country_timage,(x_offset + event_timage.size[0] + 5,5)) + #city + img.paste(city_timage,(x_offset + 15 + venue_timage.size[0], 16)) + #season + img.paste(season1_timage,(x_offset + 2 + date1_timage.size[0] + date_timage.size[0] + 20,26)) + img.paste(season_timage,(x_offset + 2 + date1_timage.size[0] + date_timage.size[0] + 20 + season1_timage.size[0],26)) + + x_offset += max(2 + event_timage.size[0] + country_timage.size[0] + 5, 2 + venue_timage.size[0] + city_timage.size[0] + 15, 2 + date1_timage.size[0] + date_timage.size[0] + 20 + season1_timage.size[0] + season_timage.size[0] + 3) + x_offset += buff_size + + else: + event_timage = self.textImage(event, med_font, r=255, g=255, b=0) + venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0) + city_timage = self.textImage(city, small_font, r=255, g=255, b=255) + country_timage = self.textImage(country, small_font, r=255, g=255, b=255) + date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171) + season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255) + season_timage = self.textImage(season, small_font, r=255, g=255, b=255) + + #date + img.paste(date1_timage, (x_offset + 2, 26)) + img.paste(date_timage, (x_offset + date1_timage.size[0] + 3, 26)) + #event + img.paste(event_timage, (x_offset + 2, 0)) + #venue + img.paste(venue_timage,(x_offset + 2, 16)) + #country + img.paste(country_timage,(x_offset + event_timage.size[0] + 5,5)) + #city + img.paste(city_timage,(x_offset + 15 + venue_timage.size[0], 16)) + #season + img.paste(season1_timage,(x_offset + 2 + date1_timage.size[0] + date_timage.size[0] + 20,26)) + img.paste(season_timage,(x_offset + 2 + date1_timage.size[0] + date_timage.size[0] + 20 + season1_timage.size[0],26)) + + x_offset += max(2 + event_timage.size[0] + country_timage.size[0] + 5, 2 + venue_timage.size[0] + city_timage.size[0] + 15, 2 + date1_timage.size[0] + date_timage.size[0] + 20 + season1_timage.size[0] + season_timage.size[0] + 3) + x_offset2 = x_offset + + for each_player in golf_standings1: + symbol1_timage = self.textImage('|', small_font, r=255, g=255, b=0) + img.paste(symbol1_timage, (x_offset + 5, 7)) + golf_standings1_timage = self.textImage(each_player, small_font, r=255, g=255, b=255) + img.paste(golf_standings1_timage, (x_offset + symbol1_timage.size[0] + 7, 7)) + x_offset += (golf_standings1_timage.size[0] + symbol1_timage.size[0] + 7) + + for each_player2 in golf_standings2: + symbol2_timage = self.textImage('|', small_font, r=255, g=255, b=0) + img.paste(symbol2_timage, (x_offset2 + 5, 20)) + golf_standings2_timage = self.textImage(each_player2, small_font, r=255, g=255, b=255) + img.paste(golf_standings2_timage, (x_offset2 + symbol2_timage.size[0] + 7, 20)) + x_offset2 += (golf_standings2_timage.size[0] + symbol2_timage.size[0] + 7) + + if x_offset >= x_offset2: + x_offset += buff_size + else: + x_offset = x_offset2 + x_offset += buff_size + else: + strHomeTeam = match['home_team'] + strAwayTeam = match['away_team'] + + if time != 'future': + intHomeScore = str(match['home_score']) + intAwayScore = str(match['away_score']) + + try: + + home_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strHomeTeam]['logo'])) + + except Exception as e: + home_logo = self.textImage(strHomeTeam.replace(' ', '\n'), extra_small_font, r = 255, g = 255, b = 255) + + try: + + away_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strAwayTeam]['logo'])) + + except Exception as e: + away_logo = self.textImage(strAwayTeam.replace(' ', '\n'), extra_small_font, r = 255, g = 255, b = 255) + + img.paste(home_logo, (x_offset,0)) + + x_offset += home_logo.size[0] + 4 + + if time == 'future': + #img.paste(date_timage, (x_offset+5, 0)) + + try: + h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) + except: + pass + try: + a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) + except: + pass + vs_timage = self.textImage('vs', med_font, r = 255, g = 255, b = 255, h_buff = 5) + try: + hc_timage = self.textImage(sports_info[strHomeTeam]['code'], med_font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) + except Exception as e: + hc_timage = self.textImage('.', extra_small_font, r = 255, g = 255, b = 255) + try: + ac_timage = self.textImage(sports_info[strAwayTeam]['code'], med_font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) + except Exception as e: + ac_timage = self.textImage('.', extra_small_font, r = 255, g = 255, b = 255) + + vs_size = vs_timage.size[0] + ac_timage.size[0] + hc_timage.size[0] + + main_offset = 5 + x_offset + int(max(vs_size, date_timage.size[0])/2) + + img.paste(date_timage, (main_offset - int(date_timage.size[0]/2), 0)) + img.paste(vs_timage, (main_offset - int(vs_timage.size[0]/2),9)) + img.paste(hc_timage, (main_offset - int(vs_timage.size[0]/2) - hc_timage.size[0], 9)) + img.paste(ac_timage, (main_offset + int(vs_timage.size[0]/2),9)) + x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + ac_timage.size[0]) + 6) + else: + score_image = self.textImage(intHomeScore + '-' + intAwayScore, large_font, h_buff = 5, r = 255, g = 255, b = 255) + try: + h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) + except: + pass + try: + a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) + except: + pass + try: + hc_timage = self.textImage(sports_info[strHomeTeam]['code'], small_font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) + except Exception as e: + hc_timage = self.textImage('.', extra_small_font, r = 255, g = 255, b = 255) + try: + ac_timage = self.textImage(sports_info[strAwayTeam]['code'], small_font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) + except Exception as e: + ac_timage = self.textImage('.', extra_small_font, r = 255, g = 255, b = 255) + + vs_timage = self.textImage('VS', extra_small_font, r = 255, g = 255, b = 255) + + vs_size = hc_timage.size[0] + ac_timage.size[0] + vs_timage.size[0] + + main_offset = x_offset + int(max(vs_size, date_timage.size[0], score_image.size[0])/2) + img.paste(date_timage,(main_offset - int(date_timage.size[0]/2),0)) + img.paste(vs_timage,(main_offset - int(vs_timage.size[0]/2),10)) + img.paste(hc_timage, (main_offset - int(vs_timage.size[0]/2) - hc_timage.size[0], 9)) + img.paste(score_image, (main_offset - int(score_image.size[0]/2), 15)) + if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + u_image = Image.new("RGB", (hc_timage.size[0] -2, 1)) + u_image1 = ImageDraw.Draw(u_image) + u_image1.line((0,0,hc_timage.size[0]-2,0), fill="red", width = 0) + img.paste(u_image, (main_offset - int(vs_timage.size[0]/2)-hc_timage.size[0], hc_timage.size[1]+7)) + img.paste(ac_timage, (main_offset + int(vs_timage.size[0]/2),9)) + if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + ua_image = Image.new("RGB", (ac_timage.size[0] -2, 1)) + ua_image1 = ImageDraw.Draw(ua_image) + ua_image1.line((0,0,ac_timage.size[0]-2,0), fill="red", width = 0) + img.paste(ua_image, (main_offset + int(vs_timage.size[0]/2), ac_timage.size[1]+7)) + + x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + ac_timage.size[0], int(score_image.size[0]/2)) + 4) + + img.paste(away_logo, (x_offset,0)) + + x_offset += away_logo.size[0] + x_offset += buff_size + + img = img.crop((0,0,x_offset ,32)) + imgs.append(img) + except Exception as e: + pass + # logf = open('log.txt', "a") + # exc_type, exc_obj, exc_tb = sys.exc_info() + # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + # logf.write(str(e)) + # logf.write('. file: ' + fname) + # logf.write('. line: ' + str(exc_tb.tb_lineno)) + # logf.write('. type: ' + str(exc_type)) + # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) + # logf.close() return self.stitchImage(imgs) - + + def getLeagueTableImage(self, league = False): f = open('csv/league_tables.json', 'r') @@ -2306,9 +2628,7 @@ class StockTicker(): if time in ['past', 'live']: filepath = 'csv/{}_games.json'.format(time) - else: - filepath = 'csv/upcoming_games.json' f = open(filepath, 'r') @@ -2316,140 +2636,467 @@ class StockTicker(): f.close() title_img = self.openImage('feature_titles/sports_'+ time + '.png') + imgs = [] if all_settings['title']: title_img = self.openImage('feature_titles/small_feature_titles/sports_{}.png'.format(time)) imgs = [title_img, self.blank] else: imgs = [] - leagues_info = all_settings['leagues'] leagues = list(leagues_info.keys()) - for league in leagues: - try: - x_offset = 0 - img = Image.new('RGB', (10000, 32)) - league_info = leagues_info[league] - - #league logo + if time == 'live': + for league in leagues: try: - league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') - width, height = league_logo.size - league_logo2 = league_logo.resize((int(width/2), int(height/2))) - img.paste(league_logo2, (x_offset,0)) - x_offset += (league_logo2.size[0]+10) + x_offset = 0 + if league == 'NFL': + f = open('csv/live_nfl.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['NFL'][0] + elif league == 'NHL': + f = open('csv/live_nhl.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['NHL'][0] + elif league == 'NBA': + f = open('csv/live_nba.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['NBA'][0] + elif league == 'MLB': + f = open('csv/live_mlb.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['MLB'][0] + elif league == 'MLS': + f = open('csv/live_mls.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['MLS'][0] + elif league == 'PREMIERLEAGUE': + f = open('csv/live_pl.json', 'r') + all_settings = json.load(f) + f.close() + league_info = all_settings['leagues']['PREMIERLEAGUE'][0] + + img = Image.new('RGB', (10000, 32)) + + try: + league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + width, height = league_logo.size + league_logo2 = league_logo.resize((int(width/2), int(height/2))) + img.paste(league_logo2, (x_offset,0)) + x_offset += (league_logo2.size[0]+10) + except: + pass + + font = ImageFont.load("./fonts/6x10.pil") + small_font = ImageFont.load("./fonts/4x6.pil") + + try: + sports_info = self.readSportsCSV(league) + except: + pass + + buff_size = 20 + + if all_settings['leagues'][league][2] == 'no_live' and all_settings['leagues'][league][3] == 'no_upcoming': + no_match = self.textImage(('No live games').upper(), font, r = 255, g = 255 , b = 255) + img.paste(no_match, (x_offset,4)) + x_offset += no_match.size[0] + + elif all_settings['leagues'][league][3] != 'no_upcoming': + next_match = self.textImage('Next game: ' + all_settings['leagues'][league][3], font, r=255,g=255,b=255) + img.paste(next_match, (x_offset,4)) + x_offset += next_match.size[0] + + else: + + for match in league_info: + + dateEvent = match['time'] + date_timage = self.textImage(dateEvent, small_font, r = 255, g = 255, b = 255) + + strHomeTeam = match['home_team'] + strAwayTeam = match['away_team'] + intHomeScore = str(match['home_score']) + intAwayScore = str(match['away_score']) + + try: + home_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strHomeTeam]['logo'])) + width1, height1 = home_logo.size + home_logo1 = home_logo.resize((int(width1/2), int(height1/2))) + except Exception as e: + home_logo1 = self.textImage(strHomeTeam, small_font, r = 255, g = 255, b = 255) + + try: + away_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strAwayTeam]['logo'])) + width2, height2 = away_logo.size + away_logo1 = away_logo.resize((int(width2/2), int(height2/2))) + except Exception as e: + away_logo1 = self.textImage(strAwayTeam, small_font, r = 255, g = 255, b = 255) + + error = False + + img.paste(home_logo1, (x_offset,0)) + x_offset += (home_logo1.size[0] + 2) + + score_image = self.textImage(intHomeScore + '-' + intAwayScore, font, h_buff = 5, r = 255, g = 255, b = 255) + + try: + h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) + except: + pass + try: + a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) + except: + pass + try: + hc_timage = self.textImage(sports_info[strHomeTeam]['code'], font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) + except: + hc_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255) + error = True + try: + ac_timage = self.textImage(sports_info[strAwayTeam]['code'], font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) + except: + ac_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255) + error = True + + if date_timage.size[0] > (hc_timage.size[0] + 2 + score_image.size[0] + ac_timage.size[0]): + x_offset10 = x_offset + int((date_timage.size[0]/2)-(score_image.size[0]/2)-hc_timage.size[0]) + img.paste(date_timage,(x_offset, 0)) + img.paste(score_image, (x_offset + int((date_timage.size[0]/2)-(score_image.size[0]/2)), 5)) + x_offset += date_timage.size[0] + img.paste(hc_timage,(x_offset10, 5)) + if match['isLive'] == 'post': + if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + u_image = Image.new("RGB", (hc_timage.size[0] -3, 1)) + u_image1 = ImageDraw.Draw(u_image) + u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0) + img.paste(u_image, (x_offset10, hc_timage.size[1]+4)) + x_offset10 += hc_timage.size[0] + score_image.size[0] + img.paste(ac_timage,(x_offset10, 5)) + if match['isLive'] == 'post': + if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + ua_image = Image.new("RGB", (ac_timage.size[0] -3, 1)) + ua_image1 = ImageDraw.Draw(ua_image) + ua_image1.line((0,0,ac_timage.size[0]-3,0), fill="red", width = 0) + img.paste(ua_image, (x_offset10, ac_timage.size[1]+4)) + x_offset10 += ac_timage.size[0] + if error: + img.paste(away_logo1, (max(x_offset + date_timage.size[0], x_offset10),0)) + x_offset += (away_logo1.size[0] + date_timage.size[0]) + else: + img.paste(away_logo1, (max(x_offset,x_offset10),0)) + x_offset += away_logo1.size[0] + + + else: + x_offset_date = (x_offset + hc_timage.size[0] + int(score_image.size[0]/2) - int(date_timage.size[0]/2)) + img.paste(date_timage, (x_offset_date,0)) + #img.paste(date_timage, (x_offset+20+int((score_image.size[0] - date_timage.size[0])/2),0)) + img.paste(hc_timage, (x_offset, 5)) + + if match['isLive'] == 'post': + if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + u_image = Image.new("RGB", (hc_timage.size[0] -3, 1)) + u_image1 = ImageDraw.Draw(u_image) + u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0) + img.paste(u_image, (x_offset, hc_timage.size[1]+4)) + + x_offset += hc_timage.size[0] + img.paste(score_image, (x_offset, 5)) + x_offset += score_image.size[0] + img.paste(ac_timage, (x_offset, 5)) + if match['isLive'] == 'post': + if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + ua_image = Image.new("RGB", (ac_timage.size[0] -3, 1)) + ua_image1 = ImageDraw.Draw(ua_image) + ua_image1.line((0,0,ac_timage.size[0]-3,0), fill="red", width = 0) + img.paste(ua_image, (x_offset, ac_timage.size[1]+4)) + x_offset += ac_timage.size[0] + x_offset_date += date_timage.size[0] + if error: + img.paste(away_logo1, (max(x_offset + date_timage.size[0], x_offset_date),0)) + x_offset += (away_logo1.size[0] + date_timage.size[0]) + else: + img.paste(away_logo1, (max(x_offset,x_offset_date),0)) + x_offset += away_logo1.size[0] + x_offset += buff_size + x_offset += 20 + img = img.crop((0,0,x_offset ,16)) + imgs.append(img) except: pass - font = ImageFont.load("./fonts/6x10.pil") - small_font = ImageFont.load("./fonts/4x6.pil") + else: + for league in leagues: + try: + x_offset = 0 + img = Image.new('RGB', (10000, 32)) + league_info = leagues_info[league] - sports_info = self.readSportsCSV(league) + #league logo + try: + league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + width, height = league_logo.size + league_logo2 = league_logo.resize((int(width/2), int(height/2))) - buff_size = 20 + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + x_offset += 10 + else: + img.paste(league_logo2, (x_offset,0)) + x_offset += (league_logo2.size[0]+10) + except: + pass - for match in league_info: - strHomeTeam = match['home_team'] - strAwayTeam = match['away_team'] - - if time != 'future': - intHomeScore = str(match['home_score']) - intAwayScore = str(match['away_score']) - - dateEvent = match['date'].replace('-', '.') - + font = ImageFont.load("./fonts/6x10.pil") + small_font = ImageFont.load("./fonts/4x6.pil") try: - - home_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strHomeTeam]['logo'])) - width1, height1 = home_logo.size - home_logo1 = home_logo.resize((int(width1/2), int(height1/2))) - except Exception as e: - home_logo1 = self.textImage(strHomeTeam.replace(' ', '\n'), font, r = 255, g = 255, b = 255) - - - try: - - away_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strAwayTeam]['logo'])) - width2, height2 = away_logo.size - away_logo1 = away_logo.resize((int(width2/2), int(height2/2))) - except Exception as e: - away_logo1 = self.textImage(strAwayTeam.replace(' ', '\n'), font, r = 255, g = 255, b = 255) + sports_info = self.readSportsCSV(league) + except: + pass + + buff_size = 20 - date_timage = self.textImage(dateEvent, small_font, r = 255, g = 255, b = 255) + for match in league_info: + + dateEvent = match['date'].replace('-', '.') + date_timage = self.textImage(dateEvent, small_font, r = 255, g = 255, b = 255) + + if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'): + event = match['event'] + venue = match['venue'] + city = match['city'] + country = match['country'] + season = match['season'] + + if time != 'future': + golf_standings1 = match['golf_standings'][::2] + golf_standings2 = match['golf_standings'][1::2] + + img.paste(league_logo2, (x_offset, 0)) + x_offset += league_logo2.size[0] + 5 + + if time == 'future': + + event_timage = self.textImage(event, small_font, r=255, g=255, b=0) + venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0) + city_timage = self.textImage(city, small_font, r=255, g=255, b=255) + country_timage = self.textImage(country, small_font, r=255, g=255, b=255) + season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255) + season_timage = self.textImage(season, small_font, r=255, g=255, b=255) + date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171) + + #event + img.paste(event_timage, (x_offset, 1)) + #venue + img.paste(venue_timage,(x_offset, 9)) + x_offset += (max(event_timage.size[0], venue_timage.size[0]) + 5) + #date + img.paste(date1_timage, (x_offset, 1)) + img.paste(date_timage, (x_offset + date1_timage.size[0] + 2, 1)) + #city + img.paste(city_timage,(x_offset, 9)) + #country + img.paste(country_timage,(x_offset + city_timage.size[0] + 7,9)) + #season + img.paste(season1_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + 5,1)) + img.paste(season_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5,1)) + + x_offset += max(date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5 + season_timage.size[0], city_timage.size[0] + 7 + country_timage.size[0]) + x_offset += (buff_size - 10) + else: + event_timage = self.textImage(event, small_font, r=255, g=255, b=0) + venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0) + city_timage = self.textImage(city, small_font, r=255, g=255, b=255) + country_timage = self.textImage(country, small_font, r=255, g=255, b=255) + season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255) + season_timage = self.textImage(season, small_font, r=255, g=255, b=255) + date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171) + + #event + img.paste(event_timage, (x_offset, 1)) + #venue + img.paste(venue_timage,(x_offset, 9)) + x_offset += (max(event_timage.size[0], venue_timage.size[0]) + 5) + #date + img.paste(date1_timage, (x_offset, 1)) + img.paste(date_timage, (x_offset + date1_timage.size[0] + 2, 1)) + #city + img.paste(city_timage,(x_offset, 9)) + #country + img.paste(country_timage,(x_offset + city_timage.size[0] + 7,9)) + #season + img.paste(season1_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + 5,1)) + img.paste(season_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5,1)) + + x_offset += max(date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5 + season_timage.size[0], city_timage.size[0] + 7 + country_timage.size[0]) + x_offset2 = x_offset + + for each_player in golf_standings1: + symbol1_timage = self.textImage('|', small_font, r=255, g=255, b=0) + img.paste(symbol1_timage, (x_offset + 5, 1)) + golf_standings1_timage = self.textImage(each_player, small_font, r=255, g=255, b=255) + img.paste(golf_standings1_timage, (x_offset + symbol1_timage.size[0] + 7, 1)) + x_offset += (golf_standings1_timage.size[0] + symbol1_timage.size[0] + 7) + + for each_player2 in golf_standings2: + symbol2_timage = self.textImage('|', small_font, r=255, g=255, b=0) + img.paste(symbol2_timage, (x_offset2 + 5, 9)) + golf_standings2_timage = self.textImage(each_player2, small_font, r=255, g=255, b=255) + img.paste(golf_standings2_timage, (x_offset2 + symbol2_timage.size[0] + 7, 9)) + x_offset2 += (golf_standings2_timage.size[0] + symbol2_timage.size[0] + 7) + + if x_offset >= x_offset2: + x_offset += (buff_size - 10) + else: + x_offset = x_offset2 + x_offset += (buff_size - 10) + + else: + strHomeTeam = match['home_team'] + strAwayTeam = match['away_team'] + + if time != 'future': + intHomeScore = str(match['home_score']) + intAwayScore = str(match['away_score']) + + try: + + home_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strHomeTeam]['logo'])) + width1, height1 = home_logo.size + home_logo1 = home_logo.resize((int(width1/2), int(height1/2))) + except Exception as e: + home_logo1 = self.textImage(strHomeTeam, small_font, r = 255, g = 255, b = 255) + + + try: + + away_logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[strAwayTeam]['logo'])) + width2, height2 = away_logo.size + away_logo1 = away_logo.resize((int(width2/2), int(height2/2))) + except Exception as e: + away_logo1 = self.textImage(strAwayTeam, small_font, r = 255, g = 255, b = 255) + + error = False + + img.paste(home_logo1, (x_offset,0)) + x_offset += (home_logo1.size[0] + 2) - img.paste(home_logo1, (x_offset,0)) - x_offset += (home_logo1.size[0] + 2) + if time == 'future': + try: + h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) + except: + pass + try: + a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) + except: + pass + try: + hc_timage = self.textImage(sports_info[strHomeTeam]['code'], font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) + except: + hc_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255) + error = True + try: + ac_timage = self.textImage(sports_info[strAwayTeam]['code'], font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) + except: + ac_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255) + error = True + + vs_timage = self.textImage('vs', font, r = 255, g = 255, b = 255, h_buff = 5) + x_offsetdate2 = x_offset + int((hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0])/2)- int(date_timage.size[0]/2) + img.paste(date_timage, (x_offsetdate2,0)) + x_offsetdate2 += date_timage.size[0] + img.paste(hc_timage, (x_offset, 5)) + x_offset += hc_timage.size[0] + img.paste(vs_timage, (x_offset, 5)) + x_offset += vs_timage.size[0] + img.paste(ac_timage, (x_offset, 5)) + x_offset += ac_timage.size[0] + #x_offset += max(date_timage.size[0], (hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0])) + else: + score_image = self.textImage(intHomeScore + '-' + intAwayScore, font, h_buff = 5, r = 255, g = 255, b = 255) + try: + h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) + except: + pass + try: + a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) + except: + pass + + try: + hc_timage = self.textImage(sports_info[strHomeTeam]['code'], font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) + except: + hc_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255) + error = True + try: + ac_timage = self.textImage(sports_info[strAwayTeam]['code'], font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) + except: + ac_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255) + error = True + + x_offsetdate2 = x_offset + hc_timage.size[0] + int(score_image.size[0]/2)- int(date_timage.size[0]/2) + img.paste(date_timage, (x_offsetdate2,0)) + x_offsetdate2 += date_timage.size[0] + #img.paste(date_timage, (x_offset+20+int((score_image.size[0] - date_timage.size[0])/2),0)) + img.paste(hc_timage, (x_offset, 5)) + if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + u_image = Image.new("RGB", (hc_timage.size[0] -3, 1)) + u_image1 = ImageDraw.Draw(u_image) + u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0) + img.paste(u_image, (x_offset, hc_timage.size[1]+4)) + x_offset += hc_timage.size[0] + img.paste(score_image, (x_offset, 5)) + x_offset += score_image.size[0] + img.paste(ac_timage, (x_offset, 5)) + if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore): + ua_image = Image.new("RGB", (ac_timage.size[0] -3, 1)) + ua_image1 = ImageDraw.Draw(ua_image) + ua_image1.line((0,0,ac_timage.size[0]-3,0), fill="red", width = 0) + img.paste(ua_image, (x_offset, ac_timage.size[1]+4)) + x_offset += ac_timage.size[0] + + # if date_timage.size[0] > score_image.size[0]: + # img.paste(date_timage, (x_offset+2, 0)) + # img.paste(hc_timage, (x_offset+6, 5)) + # img.paste(vs_timage, (x_offset+5 + hc_timage.size[0], 5)) + # img.paste(ac_timage, (x_offset+6 + hc_timage.size[0] + vs_timage.size[0], 5)) + # img.paste(score_image, (x_offset + 2 + int((date_timage.size[0] - score_image.size[0])/2), 5)) + # else: + + # img.paste(date_timage, (x_offset+1+int((score_image.size[0] - date_timage.size[0] )/2), 0)) + # vs_size = hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0] + # img.paste(hc_timage, (x_offset + 1 + int((score_image.size[0] - vs_size)/2), 5)) + # img.paste(vs_timage, (x_offset + int((score_image.size[0] - vs_size)/2) + hc_timage.size[0], 5)) + # img.paste(ac_timage, (x_offset+1 + int((score_image.size[0] - vs_size)/2) + hc_timage.size[0] + vs_timage.size[0], 5)) + # img.paste(score_image, (x_offset+1, 5)) + + # x_offset += max( date_timage.size[0]+4, hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0]+4, 2 + int(score_image.size[0])) + + if error: + img.paste(away_logo1, (max(x_offset + date_timage.size[0], x_offsetdate2),0)) + x_offset += (away_logo1.size[0] + date_timage.size[0]) + else: + img.paste(away_logo1, (max(x_offset, x_offsetdate2),0)) + x_offset += away_logo1.size[0] + x_offset += buff_size + x_offset += 20 + img = img.crop((0,0,x_offset ,16)) + imgs.append(img) + except: + pass - if time == 'future': - img.paste(date_timage, (x_offset+5, 0)) - - h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) - a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) - - - hc_timage = self.textImage(sports_info[strHomeTeam]['code'], font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) - ac_timage = self.textImage(sports_info[strAwayTeam]['code'], font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) - vs_timage = self.textImage('vs', font, r = 255, g = 255, b = 255, h_buff = 5) - - img.paste(hc_timage, (x_offset, 5)) - x_offset += hc_timage.size[0] - img.paste(vs_timage, (x_offset, 5)) - x_offset += vs_timage.size[0] - img.paste(ac_timage, (x_offset, 5)) - x_offset += ac_timage.size[0] - #x_offset += max(date_timage.size[0], (hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0])) - else: - - score_image = self.textImage(intHomeScore + '-' + intAwayScore, font, h_buff = 5, r = 255, g = 255, b = 255) - h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', '')) - a_colour = mcolors.to_rgb(sports_info[strAwayTeam]['colour'].replace(' ', '')) - - hc_timage = self.textImage(sports_info[strHomeTeam]['code'], font, r = int(h_colour[0]*255), g = int(h_colour[1]*255), b = int(h_colour[2]*255)) - ac_timage = self.textImage(sports_info[strAwayTeam]['code'], font, r = int(a_colour[0]*255), g = int(a_colour[1]*255), b = int(a_colour[2]*255)) - - img.paste(date_timage, (x_offset+20+int((score_image.size[0] - date_timage.size[0])/2),0)) - img.paste(hc_timage, (x_offset, 5)) - x_offset += hc_timage.size[0] - img.paste(score_image, (x_offset, 5)) - x_offset += score_image.size[0] - img.paste(ac_timage, (x_offset, 5)) - x_offset += ac_timage.size[0] - - # if date_timage.size[0] > score_image.size[0]: - # img.paste(date_timage, (x_offset+2, 0)) - # img.paste(hc_timage, (x_offset+6, 5)) - # img.paste(vs_timage, (x_offset+5 + hc_timage.size[0], 5)) - # img.paste(ac_timage, (x_offset+6 + hc_timage.size[0] + vs_timage.size[0], 5)) - # img.paste(score_image, (x_offset + 2 + int((date_timage.size[0] - score_image.size[0])/2), 5)) - # else: - - # img.paste(date_timage, (x_offset+1+int((score_image.size[0] - date_timage.size[0] )/2), 0)) - # vs_size = hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0] - # img.paste(hc_timage, (x_offset + 1 + int((score_image.size[0] - vs_size)/2), 5)) - # img.paste(vs_timage, (x_offset + int((score_image.size[0] - vs_size)/2) + hc_timage.size[0], 5)) - # img.paste(ac_timage, (x_offset+1 + int((score_image.size[0] - vs_size)/2) + hc_timage.size[0] + vs_timage.size[0], 5)) - # img.paste(score_image, (x_offset+1, 5)) - - # x_offset += max( date_timage.size[0]+4, hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0]+4, 2 + int(score_image.size[0])) - - img.paste(away_logo1, (x_offset,0)) - - x_offset += away_logo1.size[0] - x_offset += buff_size - x_offset += 20 - img = img.crop((0,0,x_offset ,16)) - imgs.append(img) - - except: - pass return self.stitchImage(imgs) @@ -3339,6 +3986,59 @@ class StockTicker(): return imgs + + + def getUserImagesProfessional(self): + + f = open('csv/image_settings.json', 'r') + all_settings = json.load(f) + f.close() + + if all_settings['title']: + title_img = self.openImage('feature_titles/small_feature_titles/images.png') + image_list = [title_img] + else: + image_list = [] + + blank = Image.new('RGB', (0, 16)) + + for i,image in enumerate(all_settings['images']): + + if (i == len(all_settings['images'])-1): + try: + user_image = self.openImage(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), image)) + + user_image.thumbnail((99999, 16)) + #user_image.convert('RGB') + + img = Image.new('RGB', (user_image.size[0] + 5, 32)) + img.paste(user_image, (0,0)) + + image_list.append(img) + image_list.append(blank) + + except Exception as e: + pass + + else: + try: + user_image = self.openImage(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), image)) + + user_image.thumbnail((99999, 16)) + #user_image.convert('RGB') + + img = Image.new('RGB', (user_image.size[0] + 130, 32)) + img.paste(user_image, (0,0)) + + image_list.append(img) + image_list.append(blank) + + except Exception as e: + pass + + return self.stitchImage(image_list) + + def getUserGIFs(self): f = open('csv/GIF_settings.json', 'r') all_settings = json.load(f) @@ -3411,6 +4111,140 @@ class StockTicker(): return GIFs + + def getMoviesImage(self): + + f = open('csv/movie_settings.json', 'r') + all_movie_settings = json.load(f) + f.close() + + if all_movie_settings['title']: + title_img = self.openImage('feature_titles/movies.png') + image_list = [title_img] + else: + image_list = [] + + font = ImageFont.load("./fonts/6x13.pil") + small_font = ImageFont.load("./fonts/5x8.pil") + + for movie in all_movie_settings['movies']: + + x_offset = 0 + + movie_title_img = self.textImage(movie['title'] + ' (' + movie['media_type'] + ')', font, r = 255, g = 180, b = 0) + lang_img = self.textImage('Lan:' + movie['language'], small_font, r = 255, g = 0, b = 100) + vote_img = self.textImage(movie['votes'], small_font, r = 255, g = 255, b = 255) + star_img = Image.open('logos/star.png').convert('RGB') + date_img = self.textImage(movie['date'], small_font, r = 0, g = 162, b = 255) + + try: + logo = Image.open('logos/movies/' + movie['backdrop']) + logo.thumbnail((9000,32)) + logo.convert('P') + except: + logo = self.textImage('No Logo', small_font, r=255, g=255, b=255) + + x_offset += logo.size[0] + 3 + genre_offset = 0 + + for genre in movie['genre']: + genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255) + genre_offset += genre_img.size[0] + + img = Image.new('RGB', (max(x_offset + movie_title_img.size[0], x_offset + date_img.size[0] + 3 + star_img.size[0] + vote_img.size[0] + 3, x_offset + date_img.size[0] + 3 + genre_offset) + 15, 32)) + + + img.paste(logo, (0, 0)) + img.paste(movie_title_img, (x_offset,0)) + img.paste(date_img, (x_offset, 14)) + img.paste(lang_img, (x_offset, 23)) + x_offset += max(date_img.size[0], lang_img.size[0]) + 3 + x_offset2 = x_offset + img.paste(star_img, (x_offset2 , 14)) + img.paste(vote_img, (x_offset2 + star_img.size[0] + 3, 14)) + + for genre in movie['genre'][:-1]: + genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255) + img.paste(genre_img, (x_offset2, 23)) + x_offset2 += genre_img.size[0] + else: + genre_img2 = self.textImage(movie['genre'][-1], small_font, r = 255, g = 255, b = 255) + img.paste(genre_img2, (x_offset2, 23)) + x_offset2 += genre_img2.size[0] + + image_list.append(img) + + return self.stitchImage(image_list) + + + def getMoviesProfessional(self): + + f = open('csv/movie_settings.json', 'r') + all_movie_settings = json.load(f) + f.close() + + if all_movie_settings['title']: + title_img = self.openImage('feature_titles/small_feature_titles/movies.png') + image_list = [title_img] + else: + image_list = [] + + font = ImageFont.load("./fonts/6x10.pil") + small_font = ImageFont.load("./fonts/4x6.pil") + + for movie in all_movie_settings['movies']: + + x_offset = 0 + + movie_title_img = self.textImage(movie['title'] + ' (' + movie['media_type'] + ')', font, r = 255, g = 180, b = 0) + lang_img = self.textImage('Lan:' + movie['language'], small_font, r = 255, g = 0, b = 100) + vote_img = self.textImage(movie['votes'], small_font, r = 255, g = 255, b = 255) + star_img = Image.open('logos/star.png').convert('RGB') + date_img = self.textImage(movie['date'], small_font, r = 0, g = 162, b = 255) + + try: + logo = Image.open('logos/movies/' + movie['backdrop']) + logo.thumbnail((1000,16)) + logo.convert('P') + except: + logo = self.textImage('No Logo', small_font, r=255, g=255, b=255) + + x_offset += logo.size[0] + 3 + genre_offset = 0 +# img = Image.new('RGB', (200,16)) + + for genre in movie['genre']: + genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255) + genre_offset += genre_img.size[0] + + img = Image.new('RGB', (max(x_offset + movie_title_img.size[0] + 3 + star_img.size[0] + 2 + vote_img.size[0] + 10, x_offset + date_img.size[0] + 7 + lang_img.size[0] + 7 + genre_offset + 10), 16)) + + img.paste(logo, (0, 0)) + img.paste(movie_title_img, (x_offset,0)) + x_offset2 = x_offset + movie_title_img.size[0] + 3 + img.paste(star_img, (x_offset2, 1)) + x_offset2 += star_img.size[0] + 2 + img.paste(vote_img, (x_offset2, 2)) + img.paste(date_img, (x_offset, 10)) + x_offset += date_img.size[0] + 7 + img.paste(lang_img, (x_offset, 10)) + x_offset += lang_img.size[0] + 7 + + for genre in movie['genre'][:-1]: + genre_img = self.textImage(genre + ',', small_font, r = 255, g = 255, b = 255) + img.paste(genre_img, (x_offset, 10)) + x_offset += genre_img.size[0] + else: + genre_img2 = self.textImage(movie['genre'][-1], small_font, r = 255, g = 255, b = 255) + img.paste(genre_img2, (x_offset, 10)) + x_offset += genre_img2.size[0] + + image_list.append(img) + + return self.stitchImage(image_list) + + + def displayStocks(self): self.scrollImageTransition(['final.ppm', 'final.ppm'], offset_x = 0, offset_y = 0) @@ -3427,6 +4261,10 @@ class StockTicker(): sports_stats = self.getLeagueTableProfessional() sports_upcoming = self.getLeagueProfessional() sports_past = self.getLeagueProfessional() + sports_live = self.getLeagueProfessional() + movies = self.getMoviesProfessional() + messages = self.getUserMessagesProfessional() + images = self.getUserImagesProfessional() x_offset = 0 news.paste(weather, (x_offset, 16)) @@ -3449,6 +4287,14 @@ class StockTicker(): x_offset += sports_upcoming.size[0] news.paste(sports_past, (x_offset, 16)) x_offset += sports_past.size[0] + news.paste(sports_live, (x_offset, 16)) + x_offset += sports_live.size[0] + news.paste(movies, (x_offset, 16)) + x_offset += movies.size[0] + news.paste(messages, (x_offset, 16)) + x_offset += messages.size[0] + news.paste(images, (x_offset, 16)) + x_offset += images.size[0] self.double_buffer = self.matrix.CreateFrameCanvas() while True: kill = stock_ticker.scrollImage(news, offset_x = 128) @@ -3524,7 +4370,10 @@ class StockTicker(): self.scrollFunctionsAnimated(['commodities', 'commodities'],animation = 'traditional') elif msg == 'WI': #indices - self.scrollFunctionsAnimated(['indices', 'indices'],animation = 'traditional') + self.scrollFunctionsAnimated(['indices', 'indices'],animation = 'traditional') + + elif msg == 'MO': #movies + self.scrollFunctionsAnimated(['movies', 'movies'],animation = 'traditional') elif msg == 'A': #everything diff --git a/templates/index.html b/templates/index.html index f727df4..8d03a82 100644 --- a/templates/index.html +++ b/templates/index.html @@ -67,7 +67,7 @@ - + @@ -75,6 +75,10 @@
+ +Version 1.2.0
+Version 1.3.0
@@ -190,7 +194,7 @@ - + @@ -353,10 +357,10 @@