diff --git a/csv/commodities_settings.json b/csv/commodities_settings.json deleted file mode 100644 index 043aa5c..0000000 --- a/csv/commodities_settings.json +++ /dev/null @@ -1 +0,0 @@ -{"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}} \ No newline at end of file diff --git a/csv/indices_settings.json b/csv/indices_settings.json deleted file mode 100644 index af92599..0000000 --- a/csv/indices_settings.json +++ /dev/null @@ -1 +0,0 @@ -{"feature": "Stocks", "speed": "fast", "speed2": "slow", "animation": "up", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"^HSI": {"name": "HSI", "current": "18083.06", "point_change": "1003.55", "percent_change": "5.88"}, "^GSPC": {"name": "S&P 500", "current": "3790.93", "point_change": "112.50", "percent_change": "3.06"}, "^RUT": {"name": "RUSSELL 2000", "current": "1775.77", "point_change": "66.90", "percent_change": "3.91"}, "^GDAXI": {"name": "DAX", "current": "12648.95", "point_change": "-21.53", "percent_change": "-0.17"}, "^FTSE": {"name": "FTSE 100", "current": "7058.68", "point_change": "-27.82", "percent_change": "-0.39"}, "^FCHI": {"name": "CAC 40", "current": "6031.45", "point_change": "-8.24", "percent_change": "-0.14"}, "399001.SZ": {"name": "SZSE", "current": "10778.61", "point_change": "-140.83", "percent_change": "-1.29"}, "^STOXX50E": {"name": "STOXX 50", "current": "3476.55", "point_change": "-7.93", "percent_change": "-0.23"}, "^AXJO": {"name": "ASX 200", "current": "6815.70", "point_change": "116.40", "percent_change": "1.74"}, "^DJI": {"name": "DOW JONES", "current": "30316.32", "point_change": "825.43", "percent_change": "2.80"}, "^STOXX": {"name": "STOXX 600", "current": "402.33", "point_change": "-0.70", "percent_change": "-0.17"}}} \ No newline at end of file diff --git a/csv/ipo_settings.json b/csv/ipo_settings.json deleted file mode 100644 index c16386b..0000000 --- a/csv/ipo_settings.json +++ /dev/null @@ -1 +0,0 @@ -{"feature": "IPO", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "symbols": ["No Data"]} \ No newline at end of file diff --git a/csv/last_updates.json b/csv/last_updates.json index 02368cb..45420d7 100644 --- a/csv/last_updates.json +++ b/csv/last_updates.json @@ -1 +1 @@ -{"scheduler":{"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}, "ipo": {"time": "05/10/2022 02:31:40", "force": false}, "prepost": {"time": "05/10/2022 02:31:40", "force": false}} +{"scheduler":{"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}, "ipo": {"time": "05/10/2022 02:31:40", "force": false}, "prepost": {"time": "05/10/2022 02:31:40", "force": false}, "economic": {"time": "05/10/2022 02:31:40", "force": false}} diff --git a/csv/movie_settings.json b/csv/movie_settings.json deleted file mode 100644 index 52e9431..0000000 --- a/csv/movie_settings.json +++ /dev/null @@ -1 +0,0 @@ -{"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/database_caller.py b/database_caller.py index 0f43ce2..5013dd1 100755 --- a/database_caller.py +++ b/database_caller.py @@ -149,9 +149,13 @@ def getCookiesnCrumb(): def updateStocks(api_key, logf): try: - f = open('csv/stocks_settings.json', 'r') - all_stocks_settings = json.load(f) - f.close() + try: + f = open('csv/stocks_settings.json', 'r') + all_stocks_settings = json.load(f) + f.close() + except: + all_stocks_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": False} + stock_info = all_stocks_settings['symbols'] symbols = list(stock_info.keys()) @@ -175,9 +179,8 @@ def updateStocks(api_key, logf): stock_info[data[symbol]['quote']['symbol']] = {'current': data[symbol]['quote']['latestPrice'], 'change': data[symbol]['quote']['change'], 'percent_change':data[symbol]['quote']['changePercent'] * 100} all_stocks_settings['symbols'] = stock_info - f = open('csv/stocks_settings.json', 'w+') - json.dump(all_stocks_settings, f) - f.close() + with open('csv/stocks_settings.json', 'w+') as f: + json.dump(all_stocks_settings, f) elif 'query1.finance.yahoo.com/v7' in url: response = requests.get(url, headers=headers) @@ -212,9 +215,8 @@ def updateStocks(api_key, logf): stock_info[stock['symbol']] = {'current': stock['regularMarketPrice'], 'change': stock['regularMarketChange'], 'percent_change':stock['regularMarketChangePercent']} all_stocks_settings['symbols'] = stock_info - f = open('csv/stocks_settings.json', 'w+') - json.dump(all_stocks_settings, f) - f.close() + with open('csv/stocks_settings.json', 'w+') as f: + json.dump(all_stocks_settings, f) except: pass #logf = open('log.txt', "a") @@ -311,10 +313,12 @@ def updateStocksPrePost(api_key, logf): def updateCommodities(api_key, logf): try: - - f = open('csv/commodities_settings.json', 'r') - all_commodities_settings = json.load(f) - f.close() + try: + f = open('csv/commodities_settings.json', 'r') + all_commodities_settings = json.load(f) + f.close() + except: + all_commodities_settings = {"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}} commodity_info = all_commodities_settings['symbols'] symbols = list(commodity_info.keys()) @@ -337,9 +341,9 @@ def updateCommodities(api_key, logf): commodity_info[commodity['symbol']] = {'current': commodity['price'], 'unit': commodity['unit'], '24hr_change': commodity['price_over_24hr'], 'percent_change': commodity['percent_over_24hr']} all_commodities_settings['symbols'] = commodity_info - f = open('csv/commodities_settings.json', 'w+') - json.dump(all_commodities_settings, f) - f.close() + + with open('csv/commodities_settings.json', 'w+') as f: + json.dump(all_commodities_settings, f) except: pass @@ -366,10 +370,12 @@ def human_format(num): def updateMovies(api_key, logf): - f = open('csv/movie_settings.json', 'r') - all_settings = json.load(f) - f.close() - + try: + f = open('csv/movie_settings.json', 'r') + all_settings = json.load(f) + f.close() + except: + all_settings = {"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 Clancys 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 Toros 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"}]} if all_settings['category'] == 'Popular Movies': url = 'https://api.themoviedb.org/3/trending/movie/day?' @@ -483,9 +489,8 @@ def updateMovies(api_key, logf): all_settings['movies'] = this_out - f = open('csv/movie_settings.json', 'w+') - json.dump(all_settings, f) - f.close() + with open('csv/movie_settings.json', 'w+') as f: + json.dump(all_settings, f) def updateIpo(api_key, logf): @@ -501,9 +506,12 @@ def updateIpo(api_key, logf): ipo_url = 'https://finnhub.io/api/v1/calendar/ipo?from='+start_date+'&to='+end_date+'&token='+api_key - f = open('csv/ipo_settings.json', 'r') - ipo_settings = json.load(f) - f.close() + try: + f = open('csv/ipo_settings.json', 'r') + ipo_settings = json.load(f) + f.close() + except: + ipo_settings = {"feature": "IPO", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "symbols": ["No Data"]} data = requests.get(ipo_url) all_ipo = data.json() @@ -537,18 +545,19 @@ def updateIpo(api_key, logf): ipo_list = ['No Data'] ipo_settings['symbols'] = ipo_list - f = open('csv/ipo_settings.json', 'w+') - json.dump(ipo_settings, f) - f.close() + with open('csv/ipo_settings.json', 'w+') as f: + json.dump(ipo_settings, f) def updateIndices(api_key, logf): try: - - f = open('csv/indices_settings.json', 'r') - all_indices_settings = json.load(f) - f.close() + try: + f = open('csv/indices_settings.json', 'r') + all_indices_settings = json.load(f) + f.close() + except: + all_indices_settings = {"feature": "Stocks", "speed": "fast", "speed2": "slow", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"^HSI": {"name": "HSI", "current": "18083.06", "point_change": "1003.55", "percent_change": "5.88"}, "^GSPC": {"name": "S&P 500", "current": "3790.93", "point_change": "112.50", "percent_change": "3.06"}, "^RUT": {"name": "RUSSELL 2000", "current": "1775.77", "point_change": "66.90", "percent_change": "3.91"}, "^GDAXI": {"name": "DAX", "current": "12648.95", "point_change": "-21.53", "percent_change": "-0.17"}, "^FTSE": {"name": "FTSE 100", "current": "7058.68", "point_change": "-27.82", "percent_change": "-0.39"}, "^FCHI": {"name": "CAC 40", "current": "6031.45", "point_change": "-8.24", "percent_change": "-0.14"}, "399001.SZ": {"name": "SZSE", "current": "10778.61", "point_change": "-140.83", "percent_change": "-1.29"}, "^STOXX50E": {"name": "STOXX 50", "current": "3476.55", "point_change": "-7.93", "percent_change": "-0.23"}, "^AXJO": {"name": "ASX 200", "current": "6815.70", "point_change": "116.40", "percent_change": "1.74"}, "^DJI": {"name": "DOW JONES", "current": "30316.32", "point_change": "825.43", "percent_change": "2.80"}, "^STOXX": {"name": "STOXX 600", "current": "402.33", "point_change": "-0.70", "percent_change": "-0.17"}}} index_info = all_indices_settings['symbols'] symbols = list(index_info.keys()) @@ -571,9 +580,8 @@ def updateIndices(api_key, logf): index_info[index['symbol']] = {'name': index['name'], 'current': index['price'], 'point_change': index['change'], 'percent_change': index['percent_change']} all_indices_settings['symbols'] = index_info - f = open('csv/indices_settings.json', 'w+') - json.dump(all_indices_settings, f) - f.close() + with open('csv/indices_settings.json', 'w+') as f: + json.dump(all_indices_settings, f) except: pass @@ -591,15 +599,14 @@ def updateIndices(api_key, logf): def updateCrypto(api_key, logf): - - try: - - - f = open('csv/crypto_settings.json', 'r') - all_crypto_settings = json.load(f) - f.close() + try: + f = open('csv/crypto_settings.json', 'r') + all_crypto_settings = json.load(f) + f.close() + except: + all_crypto_settings = {"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"}}} coin_info = all_crypto_settings['symbols'] symbol_base = list(coin_info.keys()) @@ -618,8 +625,6 @@ def updateCrypto(api_key, logf): response = requests.get(url) data = response.json() - - coin_info = {} if len(data) > 0: for sb in symbol_base: @@ -633,13 +638,11 @@ def updateCrypto(api_key, logf): coin_info[symbol.upper() + ',' + base.upper()] = {'current': d['price'], '24hr_change': d['price_over_24hr'], 'percent_change': d['percent_over_24hr']} all_crypto_settings['symbols'] = coin_info - f = open('csv/crypto_settings.json', 'w+') - json.dump(all_crypto_settings, f) - f.close() + with open('csv/crypto_settings.json', 'w+') as f: + json.dump(all_crypto_settings, f) except: 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] @@ -651,13 +654,14 @@ def updateCrypto(api_key, logf): #logf.close() def updateForex(api_key, logf): - - try: - f = open('csv/forex_settings.json', 'r') - all_forex_settings = json.load(f) - f.close() + try: + f = open('csv/forex_settings.json', 'r') + all_forex_settings = json.load(f) + f.close() + except: + all_forex_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"EUR,USD": {"current": "1.1334", "24hr_change": "-0.0003", "percent_change": "0.00"}, "USD,JPY": {"current": "114.960", "24hr_change": "0.1600", "percent_change": "0.14"}, "GBP,USD": {"current": "1.3577", "24hr_change": "-0.0031", "percent_change": "-0.23"}, "USD,CHF": {"current": "0.9198", "24hr_change": "0.0029", "percent_change": "0.32"}}} forex_info = all_forex_settings['symbols'] symbol_base = list(forex_info.keys()) @@ -666,12 +670,8 @@ def updateForex(api_key, logf): bases = [sb.split(',')[1] for sb in symbol_base] unique_bases = list(set(bases)) - targets = ','.join(symbols) - url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/forex?symbols=' - - for i,s in enumerate(symbols): url += s + '-' + bases[i] + ',' url = url[:-1] #remove last comma @@ -679,24 +679,18 @@ def updateForex(api_key, logf): response = requests.get(url) data = response.json() - - - if len(data) > 0: + if len(data) > 0: c_dict = {} for sb in symbol_base: for d in data: if d['uid'].replace('/',',') == sb: c_dict[d['uid'].replace('/',',')] = {'current': d['rate'], '24hr_change': d['rate_over_24hr'], 'percent_change':d['percent_over_24hr']} - - - all_forex_settings['symbols'] = c_dict - f = open( "csv/forex_settings.json", 'w+' ) - json.dump(all_forex_settings, f) - f.close() + with open('csv/forex_settings.json', 'w+') as f: + json.dump(all_forex_settings, f) except: pass #logf = open('log.txt', "a") @@ -709,13 +703,124 @@ def updateForex(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 updateNews(api_key, logf): + +def updateEconomic(api_key, logf): try: - f = open('csv/news_settings.json', 'r') - all_settings = json.load(f) - f.close() + with open('csv/economic_settings.json','r') as f: + all_economic_settings = json.load(f) + except: + all_economic_settings = {"feature": "Economic Calendar", "speed": "medium", "speed2": "medium", "animation": "up", "importance": "Med - High", "title": True, "timezone": "US/Eastern", "countries": ["United States"], "events": []} + + try: + url = 'https://economic-calendar.tradingview.com/events' + headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'} + country_codes = { + 'United States':'US', 'Canada':'CA', 'Hong Kong':'HK', 'China':'CN', 'Germany':'DE','France':'FR', 'Italy':'IT', 'Singapore':'SG', + 'South Korea':'KR', 'Japan':'JP', 'Australia':'AU', 'New Zealand':'NZ', 'India':'IN', 'Switzerland':'CH', 'United Kingdom':'GB', + 'Spain':'ES', 'Portugal':'PT', 'Netherlands':'NL', 'Belgium':'BE', 'Austria':'AT', 'Denmark':'DK', 'Turkey':'TR', 'Brazil':'BR', + 'Mexico':'MX', 'Sweden':'SE', 'Finland':'FI', 'Norway':'NO', 'Taiwan':'TW', 'Indonesia':'ID', 'Philippines':'PH', 'Thailand':'TH', + 'South Africa':'ZA'} + + country = all_economic_settings['countries'] + if all_economic_settings['importance'] == 'Low - High': + importance = -1 + elif all_economic_settings['importance'] == 'Med - High': + importance = 0 + elif all_economic_settings['importance'] == 'High': + importance = 1 + country_codes_list = [country_codes[c] for c in country] + result = ",".join(country_codes_list) + timezone = pytz.timezone(all_economic_settings['timezone']) + date_local = datetime.now(timezone) + date_local = (date_local - timedelta(hours=2)).strftime('%Y-%m-%dT%H:%M:00') + #date_local = datetime.now(timezone).strftime('%Y-%m-%dT00:00:00') + date_local2 = datetime.now(timezone).strftime('%Y-%m-%dT23:59:00') + date_from = timezone.localize(datetime.strptime(date_local,'%Y-%m-%dT%H:%M:%S')).astimezone(pytz.timezone('GMT')).strftime('%Y-%m-%dT%H:%M:%S.000Z') + date_to = timezone.localize(datetime.strptime(date_local2,'%Y-%m-%dT%H:%M:%S')).astimezone(pytz.timezone('GMT')).strftime('%Y-%m-%dT%H:%M:%S.000Z') + + params = { + 'from': date_from, + 'to': date_to, + 'countries': result, + 'minImportance': importance + } + + data = requests.get(url, params=params, headers=headers).json() + events = [] + + try: + for each in data['result']: + try: + print(each['actual'], each['previous'], each['forecast']) + time = pytz.timezone('GMT').localize(datetime.strptime(each['date'], '%Y-%m-%dT%H:%M:%S.%fZ')).astimezone(timezone).strftime('%a %m/%d %H:%M%p') + if datetime.now(timezone).strftime('%a %m/%d %H:%M%p') >= time: + happened = True + else: + happened = False + try: + unit = str(each['unit']) + except: + unit = '' + try: + scale = str(each['scale']) + except: + scale = '' + if scale != '': + if each['actual'] != '' and each['actual'] is not None: + each['actual'] = str(each['actual']) + scale + if each['previous'] != '' and each['previous'] is not None: + each['previous'] = str(each['previous']) + scale + if each['forecast'] != '' and each['forecast'] is not None: + each['forecast'] = str(each['forecast']) + scale + if unit != '' and scale != '': + if each['actual'] != '' and each['actual'] is not None: + each['actual'] = str(each['actual']) + ' ' + unit + if each['previous'] != '' and each['previous'] is not None: + each['previous']= str(each['previous']) + ' ' + unit + if each['forecast'] != '' and each['forecast'] is not None: + each['forecast'] = str(each['forecast']) + ' ' + unit + elif unit != '' and scale == '': + if each['actual'] != '' and each['actual'] is not None: + each['actual'] = str(each['actual']) + unit + if each['previous'] != '' and each['previous'] is not None: + each['previous']= str(each['previous']) + unit + if each['forecast'] != '' and each['forecast'] is not None: + each['forecast'] = str(each['forecast']) + unit + + events.append({ + 'title':each['title'], + 'indicator':each['indicator'], + 'period':each['period'], + 'country':each['country'], + 'importance':each['importance'], + 'time':time, + 'actual':each['actual'], + 'previous':each['previous'], + 'forecast':each['forecast'], + 'happened': happened + }) + except: + pass + except: + pass + all_economic_settings['events'] = events + with open('csv/economic_settings.json', 'w+') as f: + json.dump(all_economic_settings, f) + except: + pass + + + +def updateNews(api_key, logf): + try: + try: + f = open('csv/news_settings.json', 'r') + all_settings = json.load(f) + f.close() + except: + all_settings = {"feature": "News", "speed": "medium", "speed2": "medium", "animation": "down", "country": "US", "category": "General", "title": True, "headlines": [], "use_category": True, "use_country": False, "num_headlines": "10"} if all_settings['use_country']: if all_settings['country'] == 'Worldwide': @@ -744,15 +849,10 @@ def updateNews(api_key, logf): all_settings['headlines'] = headlines - f = open('csv/news_settings.json', 'w+') - json.dump(all_settings, f) - f.close() - - - + with open('csv/news_settings.json', 'w+') as f: + json.dump(all_settings, f) except: 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] @@ -779,12 +879,18 @@ def updateWeather(api_key, logf): 80: ['Rain', 'light intensity shower rain'], 81: ['Rain', 'shower rain'], 82: ['Rain', 'heavy intensity shower rain'], 95: ['Thunderstorm', 'Slight or moderate'], 96: ['Thunderstorm', 'slight hail'], 99: ['Thunderstorm', 'heavy hail'] } - f = open('csv/daily_weather.json', 'r') - all_daily_settings = json.load(f) - f.close() - f = open('csv/current_weather.json', 'r') - all_current_settings = json.load(f) - f.close() + try: + f = open('csv/daily_weather.json', 'r') + all_daily_settings = json.load(f) + f.close() + except: + all_daily_settings = {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/hour", "colour": "white", "city_colour": "yellow", "title": True, "locations": {"Hong Kong": [{"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 28.2, "max_temp": 30.8, "temp": 30.4, "rain_chance": 17, "humidity": 77, "wind_speed": 11.1, "uv": 5.3, "clouds": 100, "wind_direction": 193, "visibility": 10000}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 27.9, "max_temp": 32.3}, {"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 27.7, "max_temp": 31.2}, {"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 28.1, "max_temp": 31.5}, {"main_weather": "Rain", "description": "light intensity shower rain", "min_temp": 28.5, "max_temp": 31.1}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 28.9, "max_temp": 31.5}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 29.0, "max_temp": 31.9}]}, "current_weather": False, "speed2": "medium"} + try: + f = open('csv/current_weather.json', 'r') + all_current_settings = json.load(f) + f.close() + except: + all_current_settings = {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/hour", "colour": "white", "city_colour": "yellow", "title": True, "locations": {"Hong Kong": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 30.4, "min_temp": 28.2, "max_temp": 30.8, "feels_like": 36.0, "humidity": 77, "clouds": 100, "visibility": 10000, "uv": 5.3, "rain_chance": 17, "wind_speed": 11.1, "wind_direction": 193, "is_day": 1}}, "current_weather": True, "speed2": "medium"} current_locations = list(all_current_settings['locations'].keys()) daily_locations = list(all_daily_settings['locations'].keys()) @@ -856,13 +962,12 @@ def updateWeather(api_key, logf): all_current_settings['locations'] = current_weathers all_daily_settings['locations'] = daily_weathers - f = open("csv/current_weather.json", 'w+') - json.dump(all_current_settings, f) - f.close() - f = open("csv/daily_weather.json", 'w+') - json.dump(all_daily_settings, f) - f.close() + with open('csv/current_weather.json', 'w+') as f: + json.dump(all_current_settings, f) + + with open("csv/daily_weather.json", 'w+') as f: + json.dump(all_daily_settings, f) except: pass @@ -874,7 +979,6 @@ def updateWeather(api_key, logf): #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() @@ -882,10 +986,12 @@ def updateLeagueTables(api_key, logf): url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?stats=' try: - f = open('csv/league_tables.json', 'r') - all_settings = json.load(f) - - f.close() + try: + f = open('csv/league_tables.json', 'r') + all_settings = json.load(f) + f.close() + except: + all_settings = {"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": True, "top20": 20, "leagues": {'NFL':[]}} leagues = all_settings['leagues'].keys() leagues_info = {} @@ -954,13 +1060,10 @@ def updateLeagueTables(api_key, logf): leagues_info[league.upper()] = teams all_settings['leagues'] = leagues_info - f = open( "csv/league_tables.json".format(league), 'w+' ) - json.dump(all_settings, f) - - f.close() + with open("csv/league_tables.json".format(league), 'w+') as f: + json.dump(all_settings, f) except: 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] @@ -995,18 +1098,24 @@ 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: + 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') all_settings = json.load(f) f.close() + except: + if time == 'past': + all_settings = {"feature": "Sports (Past Games)", "speed2": "medium", "speed": "medium", "animation": "down", "title": True, "leagues": {"NFL": []}} + elif time == 'upcoming': + all_settings = {"feature": "Sports (Upcoming Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "leagues": {"NFL": [{"date": "2021-11-22", "time": "01:20:00", "round": "11", "home_team": "Los Angeles Chargers", "home_score": "41", "away_team": "Pittsburgh Steelers", "away_score": "37"}]}} + elif time == 'livescore': + all_settings = {"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "leagues": {}} + try: if time == 'livescore': try: leagues_info = {} @@ -1045,9 +1154,8 @@ def updateLeagueEvents(api_key, time, logf): all_settings['leagues'] = leagues_info - f = open( "csv/live_games.json", 'w+' ) - json.dump(all_settings, f) - f.close() + with open('csv/live_games.json', 'w+') as f: + json.dump(all_settings, f) except: pass @@ -1301,9 +1409,8 @@ def updateLeagueEvents(api_key, time, logf): 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() + with open("csv/{}_games.json".format(time), 'w+') as f: + json.dump(all_settings, f) except: pass @@ -1386,11 +1493,7 @@ if __name__ == '__main__': t = time.time() - - - - - update_frequencies = {'stocks':2, 'crypto':7, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440, 'commodities': 15, 'indices': 15, 'movies': 1440, 'ipo': 1440, 'prepost': 15} #minutes + update_frequencies = {'stocks':2, 'crypto':7, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440, 'commodities': 15, 'indices': 15, 'movies': 1440, 'ipo': 1440, 'prepost': 15, 'economic': 15} #minutes NY_zone = pytz.timezone('America/New_York') CET_zone = pytz.timezone('EST') @@ -1417,15 +1520,15 @@ if __name__ == '__main__': weather_key = api_keys[1].strip() except Exception as e: weather_key = False - 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() +# 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: movie_key = open('movie_api_key.txt').readlines()[0] @@ -1457,7 +1560,6 @@ if __name__ == '__main__': try: while True: - try: f = open('csv/last_updates.json', 'r') last_updates = json.load(f) @@ -1468,7 +1570,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}, "movies": {"time": "06/03/2022 04:10:09", "force": True}, "ipo": {"time": "06/03/2022 04:10:09", "force": True}, "prepost": {"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}, "ipo": {"time": "06/03/2022 04:10:09", "force": True}, "prepost": {"time": "06/03/2022 04:10:09", "force": True}, "economic": {"time": "06/03/2022 04:10:09", "force": True}} try: if last_updates['scheduler']['force']: @@ -1516,8 +1618,6 @@ if __name__ == '__main__': #msg = getInput() - - NY_time = datetime.now(NY_zone).replace(tzinfo=None) #stocks @@ -1568,50 +1668,58 @@ if __name__ == '__main__': # crypto crypto_time = datetime.strptime(last_updates['crypto']['time'], "%d/%m/%Y %H:%M:%S") - NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff = (NY_time - crypto_time).total_seconds()/60 #minutes - - + if last_updates['crypto']['force'] or diff >= update_frequencies['crypto']:# or msg == 'c': crypto_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") #updateCrypto(api_key, logf) - - last_updates['crypto']['time'] = crypto_time last_updates['crypto']['force'] = False update_process = Process(target = updateCrypto, args = (api_key,logf)) update_process.start() update_processes.append(update_process) + # commodities commodities_time = datetime.strptime(last_updates['commodities']['time'], "%d/%m/%Y %H:%M:%S") - - + NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff = (NY_time - commodities_time).total_seconds()/60 #minutes - - + if last_updates['commodities']['force'] or diff >= update_frequencies['commodities']:# or msg == 'c': commodities_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") #updateCrypto(api_key, logf) - - + last_updates['commodities']['time'] = commodities_time last_updates['commodities']['force'] = False update_process = Process(target = updateCommodities, args = (api_key,logf)) update_process.start() update_processes.append(update_process) + + + # economic calendar + economic_time = datetime.strptime(last_updates['economic']['time'], "%d/%m/%Y %H:%M:%S") + + NY_time = datetime.now(NY_zone).replace(tzinfo=None) + diff = (NY_time - economic_time).total_seconds()/60 #minutes + + if last_updates['economic']['force'] or diff >= update_frequencies['economic']:# or msg == 'c': + economic_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") + last_updates['economic']['time'] = economic_time + last_updates['economic']['force'] = False + update_process = Process(target = updateEconomic, args = (api_key,logf)) + update_process.start() + update_processes.append(update_process) + # indices indices_time = datetime.strptime(last_updates['indices']['time'], "%d/%m/%Y %H:%M:%S") - - + NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff = (NY_time - indices_time).total_seconds()/60 #minutes - - + if last_updates['indices']['force'] or diff >= update_frequencies['indices']:# or msg == 'c': indices_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") @@ -1621,14 +1729,13 @@ 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 @@ -1640,12 +1747,10 @@ if __name__ == '__main__': # ipos ipo_time = datetime.strptime(last_updates['ipo']['time'], "%d/%m/%Y %H:%M:%S") - - + NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff = (NY_time - ipo_time).total_seconds()/60 #minutes - - + if last_updates['ipo']['force'] or diff >= update_frequencies['ipo']: ipo_time = NY_time.strftime("%d/%m/%Y %H:%M:%S") last_updates['ipo']['time'] = ipo_time @@ -1657,8 +1762,7 @@ if __name__ == '__main__': # weather weather_time = datetime.strptime(last_updates['weather']['time'], "%d/%m/%Y %H:%M:%S") - - + NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff = (NY_time - weather_time).total_seconds()/60 #minutes if last_updates['weather']['force'] or diff >= update_frequencies['weather']:# or msg == 'w': @@ -1799,11 +1903,8 @@ if __name__ == '__main__': time.sleep(10) - except: 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] @@ -1813,8 +1914,3 @@ if __name__ == '__main__': # 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() - - - - - diff --git a/feature_titles/economy.png b/feature_titles/economy.png new file mode 100644 index 0000000..abea06e Binary files /dev/null and b/feature_titles/economy.png differ diff --git a/feature_titles/small_feature_titles/economy.png b/feature_titles/small_feature_titles/economy.png new file mode 100644 index 0000000..8410c5a Binary files /dev/null and b/feature_titles/small_feature_titles/economy.png differ diff --git a/logos/economic_logos/AT.png b/logos/economic_logos/AT.png new file mode 100644 index 0000000..4601ee6 Binary files /dev/null and b/logos/economic_logos/AT.png differ diff --git a/logos/economic_logos/AU.png b/logos/economic_logos/AU.png new file mode 100644 index 0000000..d844540 Binary files /dev/null and b/logos/economic_logos/AU.png differ diff --git a/logos/economic_logos/BE.png b/logos/economic_logos/BE.png new file mode 100644 index 0000000..28abbe2 Binary files /dev/null and b/logos/economic_logos/BE.png differ diff --git a/logos/economic_logos/BR.png b/logos/economic_logos/BR.png new file mode 100644 index 0000000..a20d8f9 Binary files /dev/null and b/logos/economic_logos/BR.png differ diff --git a/logos/economic_logos/CA.png b/logos/economic_logos/CA.png new file mode 100644 index 0000000..91010f4 Binary files /dev/null and b/logos/economic_logos/CA.png differ diff --git a/logos/economic_logos/CH.png b/logos/economic_logos/CH.png new file mode 100644 index 0000000..fff4724 Binary files /dev/null and b/logos/economic_logos/CH.png differ diff --git a/logos/economic_logos/CN.png b/logos/economic_logos/CN.png new file mode 100644 index 0000000..6ae59c6 Binary files /dev/null and b/logos/economic_logos/CN.png differ diff --git a/logos/economic_logos/DE.png b/logos/economic_logos/DE.png new file mode 100644 index 0000000..6de38d0 Binary files /dev/null and b/logos/economic_logos/DE.png differ diff --git a/logos/economic_logos/DK.png b/logos/economic_logos/DK.png new file mode 100644 index 0000000..b4ee743 Binary files /dev/null and b/logos/economic_logos/DK.png differ diff --git a/logos/economic_logos/ES.png b/logos/economic_logos/ES.png new file mode 100644 index 0000000..2d133f3 Binary files /dev/null and b/logos/economic_logos/ES.png differ diff --git a/logos/economic_logos/EU.png b/logos/economic_logos/EU.png new file mode 100644 index 0000000..dae9e98 Binary files /dev/null and b/logos/economic_logos/EU.png differ diff --git a/logos/economic_logos/FI.png b/logos/economic_logos/FI.png new file mode 100644 index 0000000..36df82b Binary files /dev/null and b/logos/economic_logos/FI.png differ diff --git a/logos/economic_logos/FR.png b/logos/economic_logos/FR.png new file mode 100644 index 0000000..470fad7 Binary files /dev/null and b/logos/economic_logos/FR.png differ diff --git a/logos/economic_logos/GB.png b/logos/economic_logos/GB.png new file mode 100644 index 0000000..b2034d2 Binary files /dev/null and b/logos/economic_logos/GB.png differ diff --git a/logos/economic_logos/HK.png b/logos/economic_logos/HK.png new file mode 100644 index 0000000..a283f1a Binary files /dev/null and b/logos/economic_logos/HK.png differ diff --git a/logos/economic_logos/ID.png b/logos/economic_logos/ID.png new file mode 100644 index 0000000..3d2ebd7 Binary files /dev/null and b/logos/economic_logos/ID.png differ diff --git a/logos/economic_logos/IN.png b/logos/economic_logos/IN.png new file mode 100644 index 0000000..aec404c Binary files /dev/null and b/logos/economic_logos/IN.png differ diff --git a/logos/economic_logos/IT.png b/logos/economic_logos/IT.png new file mode 100644 index 0000000..9602249 Binary files /dev/null and b/logos/economic_logos/IT.png differ diff --git a/logos/economic_logos/JP.png b/logos/economic_logos/JP.png new file mode 100644 index 0000000..b037ade Binary files /dev/null and b/logos/economic_logos/JP.png differ diff --git a/logos/economic_logos/KR.png b/logos/economic_logos/KR.png new file mode 100644 index 0000000..ac59219 Binary files /dev/null and b/logos/economic_logos/KR.png differ diff --git a/logos/economic_logos/MX.png b/logos/economic_logos/MX.png new file mode 100644 index 0000000..9903222 Binary files /dev/null and b/logos/economic_logos/MX.png differ diff --git a/logos/economic_logos/NL.png b/logos/economic_logos/NL.png new file mode 100644 index 0000000..6fa2c82 Binary files /dev/null and b/logos/economic_logos/NL.png differ diff --git a/logos/economic_logos/NO.png b/logos/economic_logos/NO.png new file mode 100644 index 0000000..ba406b9 Binary files /dev/null and b/logos/economic_logos/NO.png differ diff --git a/logos/economic_logos/NZ.png b/logos/economic_logos/NZ.png new file mode 100644 index 0000000..bf04ed3 Binary files /dev/null and b/logos/economic_logos/NZ.png differ diff --git a/logos/economic_logos/PH.png b/logos/economic_logos/PH.png new file mode 100644 index 0000000..4f5f8e3 Binary files /dev/null and b/logos/economic_logos/PH.png differ diff --git a/logos/economic_logos/PT.png b/logos/economic_logos/PT.png new file mode 100644 index 0000000..80b9b39 Binary files /dev/null and b/logos/economic_logos/PT.png differ diff --git a/logos/economic_logos/SE.png b/logos/economic_logos/SE.png new file mode 100644 index 0000000..8459810 Binary files /dev/null and b/logos/economic_logos/SE.png differ diff --git a/logos/economic_logos/SG.png b/logos/economic_logos/SG.png new file mode 100644 index 0000000..f8ca181 Binary files /dev/null and b/logos/economic_logos/SG.png differ diff --git a/logos/economic_logos/TH.png b/logos/economic_logos/TH.png new file mode 100644 index 0000000..bb43f24 Binary files /dev/null and b/logos/economic_logos/TH.png differ diff --git a/logos/economic_logos/TR.png b/logos/economic_logos/TR.png new file mode 100644 index 0000000..587e1b5 Binary files /dev/null and b/logos/economic_logos/TR.png differ diff --git a/logos/economic_logos/TW.png b/logos/economic_logos/TW.png new file mode 100644 index 0000000..d3e389f Binary files /dev/null and b/logos/economic_logos/TW.png differ diff --git a/logos/economic_logos/US.png b/logos/economic_logos/US.png new file mode 100644 index 0000000..f051711 Binary files /dev/null and b/logos/economic_logos/US.png differ diff --git a/logos/economic_logos/ZA.png b/logos/economic_logos/ZA.png new file mode 100644 index 0000000..6f9928b Binary files /dev/null and b/logos/economic_logos/ZA.png differ diff --git a/logos/high_imp.png b/logos/high_imp.png new file mode 100644 index 0000000..77c75e3 Binary files /dev/null and b/logos/high_imp.png differ diff --git a/logos/indicator.png b/logos/indicator.png new file mode 100644 index 0000000..36ebf5c Binary files /dev/null and b/logos/indicator.png differ diff --git a/logos/indices/DX-Y.NYB.png b/logos/indices/DX-Y.NYB.png new file mode 100644 index 0000000..f051711 Binary files /dev/null and b/logos/indices/DX-Y.NYB.png differ diff --git a/logos/low_imp.png b/logos/low_imp.png new file mode 100644 index 0000000..c40e6f3 Binary files /dev/null and b/logos/low_imp.png differ diff --git a/logos/med_imp.png b/logos/med_imp.png new file mode 100644 index 0000000..7545c9e Binary files /dev/null and b/logos/med_imp.png differ diff --git a/logos/period.png b/logos/period.png new file mode 100644 index 0000000..d286a03 Binary files /dev/null and b/logos/period.png differ diff --git a/logos/stocks/LCID.png b/logos/stocks/LCID.png index 5c54129..97e48e7 100644 Binary files a/logos/stocks/LCID.png and b/logos/stocks/LCID.png differ diff --git a/server.py b/server.py index 60187c9..8b9ebbd 100755 --- a/server.py +++ b/server.py @@ -121,30 +121,40 @@ 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', 'Movies', 'IPO Calendar'] + 'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex', 'Commodities', 'Indices', 'Movies', + 'IPO Calendar', 'Economic Calendar'] global professional - f = open('csv/display_settings.json', 'r') - feature_settings = json.load(f) - feature_settings2 = feature_settings[0] - f.close() - - + try: + f = open('csv/display_settings.json', 'r') + feature_settings = json.load(f) + feature_settings2 = feature_settings[0] + f.close() + except: + feature_settings = ["Standard", [["Stocks", "Crypto", "Forex"]]] + feature_settings2 = feature_settings[0] if not professional: - f = open('csv/display_settings.json', 'r') - currently_displaying = json.load(f)[1] - f.close() + try: + f = open('csv/display_settings.json', 'r') + currently_displaying = json.load(f)[1] + f.close() + except: + currently_displaying = ["Standard", [["Stocks", "Crypto", "Forex"]]][1] not_displaying = [f for f in all_features if f not in currently_displaying[0]] not_displaying2 = [f for f in all_features if f not in currently_displaying[0]] elif professional: - f = open('csv/display_settings.json', 'r') - currently_displaying = json.load(f)[1] - f.close() + try: + f = open('csv/display_settings.json', 'r') + currently_displaying = json.load(f)[1] + f.close() + except: + currently_displaying = ["Standard", [["Stocks", "Crypto", "Forex"]]][1] not_displaying = [f for f in all_features if f not in currently_displaying[0]] not_displaying2 = [f for f in all_features if f not in currently_displaying[1]] + # with open('api_keys.txt', 'r') as f: # api_key2 = f.readlines() @@ -169,78 +179,161 @@ def index(): logos_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos') LogoList = os.listdir(logos_path) - f = open('csv/stocks_settings.json', 'r') - stocks_settings = json.load(f) - f.close() + try: + f = open('csv/stocks_settings.json', 'r') + stocks_settings = json.load(f) + f.close() + except: + stocks_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": False} - f = open('csv/commodities_settings.json', 'r') - commodities_settings = json.load(f) - f.close() - - f = open('csv/indices_settings.json', 'r') - indices_settings = json.load(f) - f.close() - - f= open('csv/crypto_settings.json', 'r') - crypto_settings = json.load(f) - f.close() - - f= open('csv/movie_settings.json', 'r') - movie_settings = json.load(f) - f.close() + dict1 = { + "Aluminum": "ALU", "Brent Crude Oil": "BRENTOIL", "Coffee": "COFFEE", "Copper": "XCU", "Corn": "CORN", "Cotton": "COTTON", "Gold": "XAU", + "Palladium": "XPD", "Platinum": "XPT", "Rice": "RICE", "Silver": "XAG", "Soybean": "SOYBEAN", "Sugar": "SUGAR", "Wheat": "WHEAT", + "WTI Crude Oil": "WTIOIL", "Ethanol": "ETHANOL", "Crude Palm Oil": "CPO", "Natural Gas": "NG", "Cocoa": "COCOA", "Robusta": "ROBUSTA", + "Lumber": "LUMBER", "Rubber": "RUBBER", "Live Cattle": "CATTLE", "Lean Hog": "HOG"} + try: + f = open('csv/commodities_settings.json', 'r') + commodities_settings = json.load(f) + f.close() + except: + commodities_settings = {"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}} + try: + reversed_dict1 = {value: key for key, value in dict1.items()} + commodities_settings['symbols'] = [reversed_dict1[value] for value in commodities_settings['symbols']] + except: + pass - f= open('csv/ipo_settings.json', 'r') - ipo_settings = json.load(f) - f.close() - f = open('csv/forex_settings.json', 'r') - forex_settings = json.load(f) - f.close() + dict2 = {'BIST 100 - Istanbul': 'XU100.IS', 'SET - Bangkok': '^SET.BK', 'PSEI - Philippines': 'PSEI.PS', 'JKSE - Jakarta': '^JKSE', + 'TAIEX - Taiwan': '^TWII', 'HSI - Hong Kong': '^HSI', 'SENSEX - India': '^BSESN', 'NIFTY 50 - India': '^NSEI', 'Nikkei 225 - Japan': '^N225', + 'SZSE - Shenzhen': '399001.SZ', 'SSE - Shanghai': '000001.SS', 'STI - Singapore': '^STI', 'ASX 200 - Australia': '^AXJO', + 'NZX 50 - New Zealand': '^NZ50', 'KOSPI - South Korea': '^KS11','Euronext 100 - EU': '^N100', 'STOXX 50 - EU': '^STOXX50E', + 'STOXX 600 - EU': '^STOXX', 'PSI 20 - Lisbon': 'PSI20.LS', 'FTSE MIB - Italy': 'FTSEMIB.MI', 'OMXH25 - Helsinki': '^OMXH25', + 'OMXS30 - Stockholm': '^OMX', 'AEX - Amsterdam': '^AEX', 'ATX - Austria': '^ATX', 'BEL 20 - Brussels': '^BFX', + 'SSMI - Switzerland': '^SSMI', 'CAC 40 - France': '^FCHI', 'IBEX 35 - Spain': '^IBEX', 'FTSE 100 - UK': '^FTSE', 'Dax - Germany': '^GDAXI', + 'Bovespa - Brazil': '^BVSP', 'IPC - Mexico': '^MXX', 'S&P/TSX - Canada': '^GSPTSE', 'VIX - USA': '^VIX', 'Russell 2000 - USA': '^RUT', + 'Nasdaq Composite - USA': '^IXIC', 'Nasdaq 100 - USA': '^NDX', 'S&P 500 - USA': '^GSPC', 'Dow Jones - USA': '^DJI', 'U.S. Dollar (DXY) - USA': 'DX-Y.NYB'} + try: + f = open('csv/indices_settings.json', 'r') + indices_settings = json.load(f) + f.close() + except: + indices_settings = {"feature": "Stocks", "speed": "fast", "speed2": "slow", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"^HSI": {"name": "HSI", "current": "18083.06", "point_change": "1003.55", "percent_change": "5.88"}, "^GSPC": {"name": "S&P 500", "current": "3790.93", "point_change": "112.50", "percent_change": "3.06"}, "^RUT": {"name": "RUSSELL 2000", "current": "1775.77", "point_change": "66.90", "percent_change": "3.91"}, "^GDAXI": {"name": "DAX", "current": "12648.95", "point_change": "-21.53", "percent_change": "-0.17"}, "^FTSE": {"name": "FTSE 100", "current": "7058.68", "point_change": "-27.82", "percent_change": "-0.39"}, "^FCHI": {"name": "CAC 40", "current": "6031.45", "point_change": "-8.24", "percent_change": "-0.14"}, "399001.SZ": {"name": "SZSE", "current": "10778.61", "point_change": "-140.83", "percent_change": "-1.29"}, "^STOXX50E": {"name": "STOXX 50", "current": "3476.55", "point_change": "-7.93", "percent_change": "-0.23"}, "^AXJO": {"name": "ASX 200", "current": "6815.70", "point_change": "116.40", "percent_change": "1.74"}, "^DJI": {"name": "DOW JONES", "current": "30316.32", "point_change": "825.43", "percent_change": "2.80"}, "^STOXX": {"name": "STOXX 600", "current": "402.33", "point_change": "-0.70", "percent_change": "-0.17"}}} + try: + reversed_dict2 = {value: key for key, value in dict2.items()} + indices_settings['symbols'] = [reversed_dict2[value] for value in indices_settings['symbols']] + except: + pass + + try: + f= open('csv/crypto_settings.json', 'r') + crypto_settings = json.load(f) + f.close() + except: + crypto_settings = {"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"}}} - f = open('csv/current_weather.json', 'r') - current_weather= json.load(f) - f.close() + try: + f= open('csv/movie_settings.json', 'r') + movie_settings = json.load(f) + f.close() + except: + movie_settings = {"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 Clancys 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 Toros 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"}]} + + try: + f= open('csv/ipo_settings.json', 'r') + ipo_settings = json.load(f) + f.close() + except: + ipo_settings = {"feature": "IPO", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "symbols": ["No Data"]} - f = open('csv/daily_weather.json', 'r') - daily_weather = json.load(f) - f.close() + try: + f = open('csv/forex_settings.json', 'r') + forex_settings = json.load(f) + f.close() + except: + forex_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"EUR,USD": {"current": "1.1334", "24hr_change": "-0.0003", "percent_change": "0.00"}, "USD,JPY": {"current": "114.960", "24hr_change": "0.1600", "percent_change": "0.14"}, "GBP,USD": {"current": "1.3577", "24hr_change": "-0.0031", "percent_change": "-0.23"}, "USD,CHF": {"current": "0.9198", "24hr_change": "0.0029", "percent_change": "0.32"}}} + + try: + f = open('csv/current_weather.json', 'r') + current_weather = json.load(f) + f.close() + except: + current_weather = {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/hour", "colour": "white", "city_colour": "yellow", "title": True, "locations": {"Hong Kong": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 30.4, "min_temp": 28.2, "max_temp": 30.8, "feels_like": 36.0, "humidity": 77, "clouds": 100, "visibility": 10000, "uv": 5.3, "rain_chance": 17, "wind_speed": 11.1, "wind_direction": 193, "is_day": 1}}, "current_weather": True, "speed2": "medium"} - f = open('csv/news_settings.json', 'r') - news_settings = json.load(f) - f.close() + try: + f = open('csv/daily_weather.json', 'r') + daily_weather = json.load(f) + f.close() + except: + daily_weather = {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/hour", "colour": "white", "city_colour": "yellow", "title": True, "locations": {"Hong Kong": [{"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 28.2, "max_temp": 30.8, "temp": 30.4, "rain_chance": 17, "humidity": 77, "wind_speed": 11.1, "uv": 5.3, "clouds": 100, "wind_direction": 193, "visibility": 10000}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 27.9, "max_temp": 32.3}, {"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 27.7, "max_temp": 31.2}, {"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 28.1, "max_temp": 31.5}, {"main_weather": "Rain", "description": "light intensity shower rain", "min_temp": 28.5, "max_temp": 31.1}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 28.9, "max_temp": 31.5}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 29.0, "max_temp": 31.9}]}, "current_weather": False, "speed2": "medium"} - f = open('csv/upcoming_games.json', 'r') - upcoming_games = json.load(f) - f.close() + try: + f = open('csv/news_settings.json', 'r') + news_settings = json.load(f) + f.close() + except: + news_settings = {"feature": "News", "speed": "medium", "speed2": "medium", "animation": "down", "country": "US", "category": "General", "title": True, "headlines": [], "use_category": True, "use_country": False, "num_headlines": "10"} + + try: + f = open('csv/upcoming_games.json', 'r') + upcoming_games = json.load(f) + f.close() + except: + upcoming_games = {"feature": "Sports (Upcoming Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "leagues": {"NFL": [{"date": "2021-11-22", "time": "01:20:00", "round": "11", "home_team": "Los Angeles Chargers", "home_score": "41", "away_team": "Pittsburgh Steelers", "away_score": "37"}]}} - f = open('csv/live_games.json', 'r') - live_games = json.load(f) - f.close() + try: + f = open('csv/live_games.json', 'r') + live_games = json.load(f) + f.close() + except: + live_games = {"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "leagues": {}} - f = open('csv/past_games.json', 'r') - past_games = json.load(f) - f.close() + try: + f = open('csv/past_games.json', 'r') + past_games = json.load(f) + f.close() + except: + past_games = {"feature": "Sports (Past Games)", "speed2": "medium", "speed": "medium", "animation": "down", "title": True, "leagues": {}} - f = open('csv/league_tables.json', 'r') - team_stats = json.load(f) - f.close() + try: + f = open('csv/league_tables.json', 'r') + team_stats = json.load(f) + f.close() + except: + team_stats = {"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": True, "top20": 20, "leagues": {}} - f = open('csv/image_settings.json', 'r') - image_settings = json.load(f) - f.close() + try: + f = open('csv/image_settings.json', 'r') + image_settings = json.load(f) + f.close() + except: + image_settings = {"speed": "slow", "speed2": "medium","animation": "down", "title": True, "pause": "/", "images": []} - f = open('csv/GIF_settings.json', 'r') - GIF_settings = json.load(f) - f.close() + try: + f = open('csv/GIF_settings.json', 'r') + GIF_settings = json.load(f) + f.close() + except: + GIF_settings = {"speed": "medium", "speed2": "medium", "animation": "down", "title": True, "pause": "2", "images": []} - f = open('csv/message_settings.json', 'r') - message_settings = json.load(f) - f.close() + try: + f = open('csv/message_settings.json', 'r') + message_settings = json.load(f) + f.close() + except: + message_settings = {"feature": "Custom Messages", "speed": "medium", "speed2": "medium", "animation": "down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic!", "text_colour": "White", "size": "Large", "background_colour": "Black"}, {"name": "get_started", "text": "To get started, connect your device to the \"Fintic Hotspot\" and access \"fintic.local:1024\" on your web browser. You can connect your ticker to Wi-Fi there.", "text_colour": "White", "size": "Small", "background_colour": "Black"}]} f = open('csv/general_settings.json', 'r') general_settings = json.load(f) f.close() + try: + f = open('csv/economic_settings.json', 'r') + economic_settings = json.load(f) + f.close() + except: + economic_settings = {"feature": "Economic Calendar", "speed": "medium", "speed2": "medium", "animation": "up", "importance": "Med - High", "title": True, "timezone": "US/Eastern", "countries": ["United States"], "events": []} + try: f = open('csv/scheduler.json','r') scheduler_settings = json.load(f) @@ -303,7 +396,8 @@ def index(): 'ipo_api_key':ipo_api_key, 'wifi_SSID':wifi_SSID, 'wifi_PSK':wifi_PSK, - 'scheduler_settings':scheduler_settings + 'scheduler_settings':scheduler_settings, + 'economic_settings':economic_settings } @@ -409,25 +503,19 @@ 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', 'Movies', 'IPO Calendar'] + 'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages', 'Movies', 'IPO Calendar', 'Economic Calendar'] 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)', 'Sports (Live Games)', 'Custom Messages', 'Custom Images', 'Movies', 'IPO Calendar'] + 'Sports (Past Games)', 'Sports (Team Stats)', 'Sports (Live Games)', 'Custom Messages', 'Custom Images', 'Movies', 'IPO Calendar', 'Economic Calendar'] - positions = [] display_settings = [] if professional: - input_settings[0] = [i for i in input_settings[0] if i in all_settings] input_settings[1] = [i for i in input_settings[1] if i in all_settings] - - - - s = "Professional" if professional else "Standard" display_settings = [s] + [input_settings] with open('csv/display_settings.json', 'w') as f: @@ -543,13 +631,9 @@ def save(): global uploading - data = str(request.data.decode('utf-8')) - - - input_settings = json.loads(data) - + input_settings = json.loads(data) save_displaying(input_settings['displaying']) @@ -566,12 +650,13 @@ def save(): save_movie_settings(input_settings) elif feature == 'IPO Calendar': save_ipo_settings(input_settings) + elif feature == 'Economic Calendar': + save_economic_settings(input_settings) elif 'Sports' in feature: save_sports_settings(input_settings) elif feature in ['Custom GIFs', 'Custom Images']: - - + images = request.files names = list(request.files.keys()) @@ -579,7 +664,6 @@ def save(): images[name].save('user_uploads/' +name) - save_image_settings(input_settings) elif feature == 'Custom Messages': @@ -587,6 +671,7 @@ def save(): return index() + # saves files uploaded to the webpage for images and GIFs @app.route("/upload", methods = ['PUT', 'POST', 'GET']) def upload(): @@ -999,13 +1084,40 @@ def combine_dict(current_settings, input_symbols, current_key): def save_trade_settings(input_settings): - - filename = input_settings['feature'].lower() + '_settings.json' - f = open('csv/' + filename, 'r') - current_settings = json.load(f) + commodities_dict = { + "Aluminum": "ALU", "Brent Crude Oil": "BRENTOIL", "Coffee": "COFFEE", "Copper": "XCU", "Corn": "CORN", "Cotton": "COTTON", "Gold": "XAU", + "Palladium": "XPD", "Platinum": "XPT", "Rice": "RICE", "Silver": "XAG", "Soybean": "SOYBEAN", "Sugar": "SUGAR", "Wheat": "WHEAT", + "WTI Crude Oil": "WTIOIL", "Ethanol": "ETHANOL", "Crude Palm Oil": "CPO", "Natural Gas": "NG", "Cocoa": "COCOA", "Robusta": "ROBUSTA", + "Lumber": "LUMBER", "Rubber": "RUBBER", "Live Cattle": "CATTLE", "Lean Hog": "HOG" + } + indices_dict = {'BIST 100 - Istanbul': 'XU100.IS', 'SET - Bangkok': '^SET.BK', 'PSEI - Philippines': 'PSEI.PS', 'JKSE - Jakarta': '^JKSE', + 'TAIEX - Taiwan': '^TWII', 'HSI - Hong Kong': '^HSI', 'SENSEX - India': '^BSESN', 'NIFTY 50 - India': '^NSEI', 'Nikkei 225 - Japan': '^N225', + 'SZSE - Shenzhen': '399001.SZ', 'SSE - Shanghai': '000001.SS', 'STI - Singapore': '^STI', 'ASX 200 - Australia': '^AXJO', + 'NZX 50 - New Zealand': '^NZ50', 'KOSPI - South Korea': '^KS11','Euronext 100 - EU': '^N100', 'STOXX 50 - EU': '^STOXX50E', + 'STOXX 600 - EU': '^STOXX', 'PSI 20 - Lisbon': 'PSI20.LS', 'FTSE MIB - Italy': 'FTSEMIB.MI', 'OMXH25 - Helsinki': '^OMXH25', + 'OMXS30 - Stockholm': '^OMX', 'AEX - Amsterdam': '^AEX', 'ATX - Austria': '^ATX', 'BEL 20 - Brussels': '^BFX', + 'SSMI - Switzerland': '^SSMI', 'CAC 40 - France': '^FCHI', 'IBEX 35 - Spain': '^IBEX', 'FTSE 100 - UK': '^FTSE', 'Dax - Germany': '^GDAXI', + 'Bovespa - Brazil': '^BVSP', 'IPC - Mexico': '^MXX', 'S&P/TSX - Canada': '^GSPTSE', 'VIX - USA': '^VIX', 'Russell 2000 - USA': '^RUT', + 'Nasdaq Composite - USA': '^IXIC', 'Nasdaq 100 - USA': '^NDX', 'S&P 500 - USA': '^GSPC', 'Dow Jones - USA': '^DJI', 'U.S. Dollar (DXY) - USA': 'DX-Y.NYB' + } + + try: + filename = input_settings['feature'].lower() + '_settings.json' + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + if input_settings['feature'].lower() == 'stocks': + current_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": False} + elif input_settings['feature'].lower() == 'crypto': + current_settings = {"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"}}} + elif input_settings['feature'].lower() == 'indices': + current_settings = {"feature": "Stocks", "speed": "fast", "speed2": "slow", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"^HSI": {"name": "HSI", "current": "18083.06", "point_change": "1003.55", "percent_change": "5.88"}, "^GSPC": {"name": "S&P 500", "current": "3790.93", "point_change": "112.50", "percent_change": "3.06"}, "^RUT": {"name": "RUSSELL 2000", "current": "1775.77", "point_change": "66.90", "percent_change": "3.91"}, "^GDAXI": {"name": "DAX", "current": "12648.95", "point_change": "-21.53", "percent_change": "-0.17"}, "^FTSE": {"name": "FTSE 100", "current": "7058.68", "point_change": "-27.82", "percent_change": "-0.39"}, "^FCHI": {"name": "CAC 40", "current": "6031.45", "point_change": "-8.24", "percent_change": "-0.14"}, "399001.SZ": {"name": "SZSE", "current": "10778.61", "point_change": "-140.83", "percent_change": "-1.29"}, "^STOXX50E": {"name": "STOXX 50", "current": "3476.55", "point_change": "-7.93", "percent_change": "-0.23"}, "^AXJO": {"name": "ASX 200", "current": "6815.70", "point_change": "116.40", "percent_change": "1.74"}, "^DJI": {"name": "DOW JONES", "current": "30316.32", "point_change": "825.43", "percent_change": "2.80"}, "^STOXX": {"name": "STOXX 600", "current": "402.33", "point_change": "-0.70", "percent_change": "-0.17"}}} + elif input_settings['feature'].lower() == 'commodities': + current_settings = {"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}} + elif input_settings['feature'].lower() == 'forex': + current_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"EUR,USD": {"current": "1.1334", "24hr_change": "-0.0003", "percent_change": "0.00"}, "USD,JPY": {"current": "114.960", "24hr_change": "0.1600", "percent_change": "0.14"}, "GBP,USD": {"current": "1.3577", "24hr_change": "-0.0031", "percent_change": "-0.23"}, "USD,CHF": {"current": "0.9198", "24hr_change": "0.0029", "percent_change": "0.32"}}} - f.close() - current_settings['speed'] = input_settings['speed'].lower() current_settings['speed2'] = input_settings['speed2'].lower() current_settings['animation'] = input_settings['animation'].lower() @@ -1016,13 +1128,23 @@ def save_trade_settings(input_settings): if input_settings['feature'] == 'Stocks': current_settings['prepost'] = input_settings['prepost'] if input_settings['feature'] == 'Stocks' or input_settings['feature'] == 'Crypto': - current_settings['chart'] = input_settings['chart'] + current_settings['chart'] = input_settings['chart'] + if input_settings['feature'] == 'Commodities': + try: + input_settings['symbols'] = [commodities_dict[symbol] for symbol in input_settings['symbols']] + except: + pass + if input_settings['feature'] == 'Indices': + try: + input_settings['symbols'] = [indices_dict[symbol] for symbol in input_settings['symbols']] + except: + pass current_settings = combine_dict(current_settings, input_settings['symbols'], 'symbols') - f = open('csv/' + filename, 'w') - json.dump(current_settings, f) - f.close() + with open('csv/' + filename, 'w') as f: + json.dump(current_settings,f) + f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() @@ -1031,9 +1153,7 @@ def save_trade_settings(input_settings): last_updates[input_settings['feature'].lower()]['force'] = True if input_settings['feature'] == 'Stocks': last_updates['prepost']['force'] = True - - - + f = open('csv/last_updates.json', 'w') json.dump(last_updates, f) f.close() @@ -1041,57 +1161,53 @@ def save_trade_settings(input_settings): def save_weather_settings(input_settings): - - - filename = 'current_weather.json' if input_settings['feature'] == 'Current Weather' else 'daily_weather.json' - f = open('csv/' + filename, 'r') - current_settings = json.load(f) - f.close() + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + if input_settings['feature'] == 'Current Weather': + current_settings = {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/hour", "colour": "white", "city_colour": "yellow", "title": True, "locations": {"Hong Kong": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 30.4, "min_temp": 28.2, "max_temp": 30.8, "feels_like": 36.0, "humidity": 77, "clouds": 100, "visibility": 10000, "uv": 5.3, "rain_chance": 17, "wind_speed": 11.1, "wind_direction": 193, "is_day": 1}}, "current_weather": True, "speed2": "medium"} + else: + current_settings = {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/hour", "colour": "white", "city_colour": "yellow", "title": True, "locations": {"Hong Kong": [{"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 28.2, "max_temp": 30.8, "temp": 30.4, "rain_chance": 17, "humidity": 77, "wind_speed": 11.1, "uv": 5.3, "clouds": 100, "wind_direction": 193, "visibility": 10000}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 27.9, "max_temp": 32.3}, {"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 27.7, "max_temp": 31.2}, {"main_weather": "Thunderstorm", "description": "Slight or moderate", "min_temp": 28.1, "max_temp": 31.5}, {"main_weather": "Rain", "description": "light intensity shower rain", "min_temp": 28.5, "max_temp": 31.1}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 28.9, "max_temp": 31.5}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 29.0, "max_temp": 31.9}]}, "current_weather": False, "speed2": "medium"} current_settings['speed'] = input_settings['speed'].lower() current_settings['speed2'] = input_settings['speed2'].lower() current_settings['animation'] = input_settings['animation'].lower() current_settings['temp'] = input_settings['temp'].lower() current_settings['wind_speed'] = input_settings['wind_speed'].lower() - current_settings['title'] = input_settings['title'] if input_settings['feature'] == 'Daily Forecast': current_settings['current_weather'] = input_settings['current_weather'] - - ''' - locations = {} - for key in input_settings['locations']: - locations[key] = [] - current_settings['locations'] = locations - ''' - + current_settings = combine_dict(current_settings, input_settings['locations'], 'locations') - f = open('csv/' + filename, 'w+') - json.dump(current_settings, f) - f.close() - #api_caller.sendline('w') + with open('csv/' + filename, 'w+') as f: + json.dump(current_settings,f) + f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() if any([current_settings['locations'][k] == [] for k in input_settings['locations']]): - last_updates['weather']['force'] = True f = open('csv/last_updates.json', 'w') json.dump(last_updates, f) f.close() -def save_news_settings(input_settings): - filename = 'news_settings.json' - f = open('csv/' + filename, 'r') - current_settings = json.load(f) - f.close() - +def save_news_settings(input_settings): + + filename = 'news_settings.json' + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + current_settings = {"feature": "News", "speed": "medium", "speed2": "medium", "animation": "down", "country": "US", "category": "General", "title": True, "headlines": [], "use_category": True, "use_country": False, "num_headlines": "10"} current_settings['speed'] = input_settings['speed'].lower() current_settings['speed2'] = input_settings['speed2'].lower() @@ -1103,13 +1219,9 @@ def save_news_settings(input_settings): current_settings['use_country'] = input_settings['use_country'] current_settings['num_headlines'] = input_settings['num_headlines'] - - - - f = open('csv/' + filename, 'w') - json.dump(current_settings, f) - f.close() - #api_caller.sendline('n') + with open('csv/' + filename, 'w') as f: + json.dump(current_settings,f) + f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() @@ -1123,23 +1235,22 @@ def save_news_settings(input_settings): def save_movie_settings(input_settings): filename = 'movie_settings.json' - f = open('csv/' + filename, 'r') - current_settings = json.load(f) - f.close() - - + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + current_settings = {"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 Clancys 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 Toros 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"}]} 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') + with open('csv/' + filename, 'w') as f: + json.dump(current_settings, f) + f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() @@ -1153,19 +1264,21 @@ def save_movie_settings(input_settings): def save_ipo_settings(input_settings): filename = 'ipo_settings.json' - f = open('csv/' + filename, 'r') - current_settings = json.load(f) - f.close() + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + current_settings = {"feature": "IPO", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "symbols": ["No Data"]} 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'] - - f = open('csv/' + filename, 'w') - json.dump(current_settings, f) - f.close() - #api_caller.sendline('n') + + with open('csv/' + filename, 'w') as f: + json.dump(current_settings,f) + f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() @@ -1177,6 +1290,42 @@ def save_ipo_settings(input_settings): f.close() +def save_economic_settings(input_settings): + filename = 'economic_settings.json' + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + current_settings = {"feature": "Economic Calendar", "speed": "medium", "speed2": "medium", "animation": "up", "importance": "Med - High", "title": True, "timezone": "US/Eastern", "countries": ["United States"], "events": []} + + 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['timezone'] = input_settings['timezone'] + current_settings['countries'] = input_settings['countries'] + current_settings['importance'] = input_settings['importance'] + + try: + f = open('csv/' + filename, 'w') + json.dump(current_settings, f) + f.close() + except: + with open('csv/economic_settings.json', 'w') as f: + json.dump(current_settings, f) + + f = open('csv/last_updates.json', 'r') + last_updates = json.load(f) + f.close() + + last_updates['economic']['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'] @@ -1194,9 +1343,19 @@ def save_sports_settings(input_settings): filename = 'league_tables.json' update_key = 'sports_t' - f = open('csv/' + filename, 'r') - current_settings = json.load(f) - f.close() + try: + f = open('csv/' + filename, 'r') + current_settings = json.load(f) + f.close() + except: + if feature == 'Sports (Upcoming Games)': + current_settings = {"feature": "Sports (Upcoming Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "leagues": {"NFL": [{"date": "2021-11-22", "time": "01:20:00", "round": "11", "home_team": "Los Angeles Chargers", "home_score": "41", "away_team": "Pittsburgh Steelers", "away_score": "37"}]}} + elif feature == 'Sports (Past Games)': + current_settings = {"feature": "Sports (Past Games)", "speed2": "medium", "speed": "medium", "animation": "down", "title": True, "leagues": {}} + elif feature == 'Sports (Live Games)': + current_settings = {"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "leagues": {}} + elif feature == 'Sports (Team Stats)': + current_settings = {"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": True, "top20": 20, "leagues": {}} current_settings['speed'] = input_settings['speed'].lower() current_settings['speed2'] = input_settings['speed2'].lower() @@ -1206,23 +1365,21 @@ def save_sports_settings(input_settings): current_settings = combine_dict(current_settings, input_settings['leagues'], 'leagues') - f = open('csv/' + filename, 'w') - json.dump(current_settings, f) - f.close() - - #api_caller.sendline('S') + with open('csv/' + filename, 'w') as f: + json.dump(current_settings,f) + f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() if any([current_settings['leagues'][k] == [] for k in input_settings['leagues']]): - last_updates[update_key]['force'] = True f = open('csv/last_updates.json', 'w') json.dump(last_updates, f) f.close() + # for images and GIFs def save_image_settings(input_settings): filename = 'image_settings.json' if input_settings['feature'] == 'Custom Images' else 'GIF_settings.json' @@ -1233,34 +1390,33 @@ def save_image_settings(input_settings): current_settings['speed2'] = input_settings['speed2'].lower() current_settings['animation'] = input_settings['animation'].lower() - del current_settings['feature'] - f = open('csv/' + filename, 'w') - json.dump(current_settings, f) - f.close() + + with open('csv/' + filename, 'w') as f: + json.dump(current_settings,f) + remove_old_uploads() def save_message_settings(input_settings): - - f = open('csv/message_settings.json', 'r') - current_settings = json.load(f) - f.close() + try: + f = open('csv/message_settings.json', 'r') + current_settings = json.load(f) + f.close() + except: + current_settings = {"feature": "Custom Messages", "speed": "medium", "speed2": "medium", "animation": "down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic!", "text_colour": "White", "size": "Large", "background_colour": "Black"}, {"name": "get_started", "text": "To get started, connect your device to the \"Fintic Hotspot\" and access \"fintic.local:1024\" on your web browser. You can connect your ticker to Wi-Fi there.", "text_colour": "White", "size": "Small", "background_colour": "Black"}]} + new_settings = copy.deepcopy(input_settings) for i,IS in enumerate(input_settings['messages']): - # check if this is in current_settings for CS in current_settings['messages']: if IS['name'] == CS['name']: new_settings['messages'][i] = CS - break - - f = open('csv/message_settings.json', 'w') - json.dump(new_settings, f) - f.close() - + + with open('csv/message_settings.json', 'w') as f: + json.dump(new_settings,f) @app.route("/shutdown") diff --git a/setup_config_files.sh b/setup_config_files.sh index 1f7ced0..19e3c07 100755 --- a/setup_config_files.sh +++ b/setup_config_files.sh @@ -14,14 +14,14 @@ 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 live_mlb.json live_mls.json live_nba.json live_nfl.json live_nhl.json live_pl.json commodities_settings.json indices_settings.json movie_settings.json ipo_settings.json -touch display_settings.json message_settings.json upcoming_games.json forex_settings.json prepost_settings.json scheduler.json +touch display_settings.json message_settings.json upcoming_games.json forex_settings.json prepost_settings.json scheduler.json economic_settings.json touch GIF_settings.json news_settings.json image_settings.json past_games.json general_settings.json portfolio_settings.json portfolio_crypto_settings.json -filenames="crypto_settings.json last_updates.json league_tables.json current_weather.json stocks_settings.json daily_weather.json live_games.json live_mlb.json live_mls.json live_nba.json live_nfl.json live_nhl.json live_pl.json commodities_settings.json indices_settings.json movie_settings.json ipo_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 portfolio_settings.json portfolio_crypto_settings.json prepost_settings.json scheduler.json" +filenames="crypto_settings.json last_updates.json league_tables.json current_weather.json stocks_settings.json daily_weather.json live_games.json live_mlb.json live_mls.json live_nba.json live_nfl.json live_nhl.json live_pl.json commodities_settings.json indices_settings.json movie_settings.json ipo_settings.json economic_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 portfolio_settings.json portfolio_crypto_settings.json prepost_settings.json scheduler.json" echo '{"update_available": false, "first_boot": true}' >> system_info.json echo [\"Standard\", [[\"Stocks\", \"Crypto\", \"Forex\"]]] >> display_settings.json -echo '{"scheduler":{"force": false}, "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}, "ipo": {"time": "05/10/2022 02:31:40", "force": false}, "prepost": {"time": "05/10/2022 02:31:40", "force": false}}' >> last_updates.json +echo '{"scheduler":{"force": false}, "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}, "ipo": {"time": "05/10/2022 02:31:40", "force": false}, "prepost": {"time": "05/10/2022 02:31:40", "force": false}, "economic": {"time": "05/10/2022 02:31:40", "force": false}}' >> 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 @@ -52,6 +52,7 @@ echo '{"symbols": {}}' >> portfolio_settings.json echo '{"symbols": {}}' >> portfolio_crypto_settings.json echo '{}' >> prepost_settings.json echo '{"shutdown": {"hour": "00", "minute": "00", "enabled": false}, "reboot":{"hour": "00", "minute": "00", "enabled": false}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": false}}' >> scheduler.json +echo '{"feature": "Economic Calendar", "speed": "medium", "speed2": "medium", "animation": "up", "importance": "Med - High", "title": true, "timezone": "US/Eastern", "countries": ["United States"], "events": []}' >> economic_settings.json echo '{"brightness": 10, "country_code": "GB", "hostname": "fintic"}' >> general_settings.json chmod 777 * @@ -102,6 +103,8 @@ touch 'Movies.ppm' touch 'Movies Prof.ppm' touch 'IPO Calendar.ppm' touch 'IPO Calendar Prof.ppm' +touch 'Economic Calendar.ppm' +touch 'Economic Calendar Prof.ppm' chmod 777 * diff --git a/static/app.js b/static/app.js index 219724b..d3e295b 100755 --- a/static/app.js +++ b/static/app.js @@ -48,6 +48,7 @@ var commoditiesFeatures = document.querySelectorAll("#commodities-features li"); var indicesFeatures = document.querySelectorAll("#indices-features li"); var moviesFeatures = document.querySelectorAll("#movies-features li"); var ipoFeatures = document.querySelectorAll("#ipo-features li"); +var economicFeatures = document.querySelectorAll("#economic-list li"); var allFeaturesList = [ stocksFeatures, @@ -67,6 +68,7 @@ var allFeaturesList = [ indicesFeatures, moviesFeatures, ipoFeatures, + economicFeatures, ]; // features remove buttons @@ -93,6 +95,7 @@ var commoditiesRemoveBtn = document.getElementById("commodities-remove-btn"); var indicesRemoveBtn = document.getElementById("indices-remove-btn"); var moviesRemoveBtn = document.getElementById("movies-remove-btn"); var ipoRemoveBtn = document.getElementById("ipo-remove-btn"); +var economicRemoveBtn = document.getElementById("economic-remove-btn"); var allFeaturesRemoveBtns = [ stocksRemoveBtn, @@ -112,6 +115,7 @@ var allFeaturesRemoveBtns = [ indicesRemoveBtn, moviesRemoveBtn, ipoRemoveBtn, + economicRemoveBtn, ]; // features increase buttons var stocksincreaseBtn = document.getElementById("stocks-increase-btn"); @@ -137,6 +141,7 @@ var commoditiesincreaseBtn = document.getElementById("commodities-increase-btn") var indicesincreaseBtn = document.getElementById("indices-increase-btn"); var moviesincreaseBtn = document.getElementById("movies-increase-btn"); var ipoincreaseBtn = document.getElementById("ipo-increase-btn"); +var economicincreaseBtn = document.getElementById("economic-increase-btn"); var allFeaturesIncreaseBtns = [ stocksincreaseBtn, @@ -156,6 +161,7 @@ var allFeaturesIncreaseBtns = [ indicesincreaseBtn, moviesincreaseBtn, ipoincreaseBtn, + economicincreaseBtn, ]; // features decrease buttons @@ -182,6 +188,7 @@ var commoditiesDecreaseBtn = document.getElementById("commodities-decrease-btn") var indicesDecreaseBtn = document.getElementById("indices-decrease-btn"); var moviesDecreaseBtn = document.getElementById("movies-decrease-btn"); var ipoDecreaseBtn = document.getElementById("ipo-decrease-btn"); +var economicDecreaseBtn = document.getElementById("economic-decrease-btn"); var allFeaturesDecreaseBtns = [ stocksDecreaseBtn, @@ -201,6 +208,7 @@ var allFeaturesDecreaseBtns = [ indicesDecreaseBtn, moviesDecreaseBtn, ipoDecreaseBtn, + economicDecreaseBtn, ]; const changeVarValue = () => { @@ -227,6 +235,7 @@ const changeVarValue = () => { indicesFeatures = document.querySelectorAll("#indices-features li"); moviesFeatures = document.querySelectorAll("#movies-features li"); ipoFeatures = document.querySelectorAll("#ipo-features li"); + economicFeatures = document.querySelectorAll("#economic-list li"); allFeaturesList = [ stocksFeatures, @@ -246,6 +255,7 @@ const changeVarValue = () => { indicesFeatures, moviesFeatures, ipoFeatures, + economicFeatures, ]; }; @@ -610,6 +620,7 @@ var commodities = document.getElementById("commodities-features"); var indices = document.getElementById("indices-features"); var movies = document.getElementById("movies-features"); var ipos = document.getElementById("ipo-features"); +var economics = document.getElementById("economic-list"); var allFeatures = [ stocks, @@ -629,6 +640,7 @@ var allFeatures = [ indices, movies, ipos, + economics, ]; // features select box @@ -638,6 +650,7 @@ var pastGamesSelect = document.getElementById("inputTransition83"); var liveGamesSelect = document.getElementById("inputTransition93"); var teamStatsSelect = document.getElementById("inputTransition103"); var moviesSelect = document.getElementById("inputTransition64"); +var economicSelect = document.getElementById("inputTransition2222"); var allFeaturesSelectBox = [ null, null, @@ -656,6 +669,7 @@ var allFeaturesSelectBox = [ null, moviesSelect, null, + economicSelect, ]; // features select add buttons @@ -664,6 +678,8 @@ var upcomingGamesAddBtn = document.getElementById("inputTransitionBtn73"); var pastGamesAddBtn = document.getElementById("inputTransitionBtn83"); var liveGamesAddBtn = document.getElementById("inputTransitionBtn93"); var teamStatsAddBtn = document.getElementById("inputTransitionBtn103"); +var economicAddBtn = document.getElementById("economic-countries-btn"); + var allFeaturesSelectAddBtn = [ null, null, @@ -682,6 +698,7 @@ var allFeaturesSelectAddBtn = [ null, null, null, + economicAddBtn, ]; allFeaturesSelectAddBtn.map((value, index) => { @@ -718,6 +735,7 @@ var allFeaturesFile = [ null, null, null, + null, ]; // features file add button var imagesFileAddBtn = document.getElementById("inputTextBtn11"); @@ -741,17 +759,18 @@ var allFeaturesFileAddBtn = [ null, null, null, + null, ]; // features input text var stocksText = document.getElementById("inputText3"); var cryptoText = document.getElementById("inputText4"); -var forexText = document.getElementById("inputText5"); +var forexText = document.getElementById("base-select").value + ',' + document.getElementById("quote-select").value; var currentWeatherText = document.getElementById("inputText6"); var dailyForecastText = document.getElementById("inputText7"); var messagesText = document.getElementById("inputText13"); -var commoditiesText = document.getElementById("inputText20"); -var indicesText = document.getElementById("inputText21"); +var indicesText = document.getElementById("indices-items"); +var commoditiesText = document.getElementById("commodities-items"); var allFeaturesText = [ stocksText, @@ -771,6 +790,7 @@ var allFeaturesText = [ indicesText, null, null, + null, ]; // features text add button @@ -801,6 +821,7 @@ var allFeaturesTextAddBtn = [ indicesTextAddBtn, null, null, + null, ]; @@ -822,6 +843,7 @@ var allFeaturesLimit = [ 40, null, null, + null, ]; @@ -903,10 +925,13 @@ allFeaturesTextAddBtn.map((value, index) => { } else{ - if (createLi === true) { var tag = document.createElement("li"); - tag.innerHTML = allFeaturesText[index].value; + if (index == 2) { + tag.innerHTML= document.getElementById("base-select").value + ',' + document.getElementById("quote-select").value; + } else{ + tag.innerHTML = allFeaturesText[index].value; + } allFeatures[index].appendChild(tag); changeVarValue(); addEventOnFeaturesList(); @@ -1083,6 +1108,7 @@ function getFeatureSettings() { "Indices", "Movies", "IPO Calendar", + "Economic Calendar", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1145,6 +1171,9 @@ function getFeatureSettings() { case 17: s = getIpoSettings(page); break; + case 18: + s = getEconomicSettings(page); + break; } settings = { ...settings, ...s }; // merge both sets of settings @@ -1336,6 +1365,7 @@ function saveMovieAPIKey(){ "Indices", "Movies", "IPO Calendar", + "Economic Calendar", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1377,6 +1407,7 @@ function saveIpoAPIKey(){ "Indices", "Movies", "IPO Calendar", + "Economic Calendar", ]; let pageNum = features.indexOf(feature) + 1; let pageSelector = "Page" + pageNum.toString(); @@ -1627,6 +1658,25 @@ function getMessageSettings(page) { return { title: title, messages: new_messages }; } +// economic settings +function getEconomicSettings(page) { + + let title = page.querySelectorAll(".title-select")[0].checked; + let countries = getListItems(page.querySelectorAll(".symbol-list")[0]); + let importance = page.querySelectorAll(".economic-importance-select")[0].value; + let timezone = page.querySelectorAll(".economic-tz-select")[0].value; + + settings = { + title: title, + countries: countries, + importance: importance, + timezone: timezone, + }; + console.log(settings); + return settings; +} + + // Join Network let wifiSsidInput = document.getElementById("wifi-ssid-input"); @@ -1758,7 +1808,7 @@ inputAnimationBtn.addEventListener("click", () => { // scroll speed row two let inputScrollSpeedRow = []; -for (let i = 1; i <= 17; i++) { +for (let i = 1; i <= 18; i++) { inputScrollSpeedRow.push( document.getElementById( i === 1 ? "inputScrollSpeedRow" : `inputScrollSpeedRow${i}` @@ -2245,95 +2295,96 @@ var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/; // Forex validation - function forexValidate() { + createLi = true; +} -var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/; +// var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/; - let x = document.getElementById("inputText5").value; - let quoteCurrency = x.split(",")[1]; - let baseCurrency = x.split(",")[0]; +// let x = document.getElementById("inputText5").value; +// let quoteCurrency = x.split(",")[1]; +// let baseCurrency = x.split(",")[0]; - // console.log("base"+baseCurrency); - // console.log("quote"+quoteCurrency); +// // console.log("base"+baseCurrency); +// // console.log("quote"+quoteCurrency); - let text; - if (x.toUpperCase() != x) { - document.getElementById('demo3').style.display = "block"; - text = "Base and quote must be uppercase"; - document.getElementById("inputText5").value = ''; - // createLi = false; - } - else if (x === '') { - document.getElementById('demo3').style.display = "block"; - text = "No blanks" - } +// let text; +// if (x.toUpperCase() != x) { +// document.getElementById('demo3').style.display = "block"; +// text = "Base and quote must be uppercase"; +// document.getElementById("inputText5").value = ''; +// // createLi = false; +// } +// else if (x === '') { +// document.getElementById('demo3').style.display = "block"; +// text = "No blanks" +// } - else if (x.includes(' ')) { - text = "No spaces"; - document.getElementById('demo3').style.display = "block"; - document.getElementById("inputText5").value = ''; - } +// else if (x.includes(' ')) { +// text = "No spaces"; +// document.getElementById('demo3').style.display = "block"; +// document.getElementById("inputText5").value = ''; +// } - else if (/\d/.test(x)) { - document.getElementById('demo3').style.display = "block"; - text = "No numbers allowed"; - document.getElementById("inputText5").value = ''; - } - // CAREFUL TO DELETE THE BACKEND LIST ITEMS, JUST DELETING THE VALUE LIKE THIS ISN"T 100% ACCURATE +// else if (/\d/.test(x)) { +// document.getElementById('demo3').style.display = "block"; +// text = "No numbers allowed"; +// document.getElementById("inputText5").value = ''; +// } +// // CAREFUL TO DELETE THE BACKEND LIST ITEMS, JUST DELETING THE VALUE LIKE THIS ISN"T 100% ACCURATE - else if (specialChars.test(x)) { - document.getElementById('demo3').style.display = "block"; - text = "No special characters allowed"; - document.getElementById("inputText5").value = ''; - } +// else if (specialChars.test(x)) { +// document.getElementById('demo3').style.display = "block"; +// text = "No special characters allowed"; +// document.getElementById("inputText5").value = ''; +// } - else if (!x.includes(',')) { - document.getElementById('demo3').style.display = "block"; - document.getElementById("inputText5").value = ''; - text = "Missing ',' (e.g. EUR,USD)" - } +// else if (!x.includes(',')) { +// document.getElementById('demo3').style.display = "block"; +// document.getElementById("inputText5").value = ''; +// text = "Missing ',' (e.g. EUR,USD)" +// } - else if (x.length > 7) { - document.getElementById('demo3').style.display = "block"; - text = "No more than 7 characters"; - document.getElementById("inputText5").value = ''; - } +// else if (x.length > 7) { +// document.getElementById('demo3').style.display = "block"; +// text = "No more than 7 characters"; +// document.getElementById("inputText5").value = ''; +// } - else if (!["USD","EUR","JPY","GBP","AUD","CAD","CHF","CNY","HKD","NZD","SEK","KRW","SGD","NOK","MXN","INR","RUB","ZAR","TRY","BRL", - "TWD","DKK","PLN","THB","IDR","HUF","ILS","CLP","PHP","AED","CZK","COP","SAR","MYR","RON","CLP","ARS","VND","QAR","KWD"].includes(baseCurrency)) { - document.getElementById('demo3').style.display = "block"; - document.getElementById("inputText5").value = ''; - text = "Invalid base currency" +// else if (!["USD","EUR","JPY","GBP","AUD","CAD","CHF","CNY","HKD","NZD","SEK","KRW","SGD","NOK","MXN","INR","RUB","ZAR","TRY","BRL", +// "TWD","DKK","PLN","THB","IDR","HUF","ILS","CLP","PHP","AED","CZK","COP","SAR","MYR","RON","CLP","ARS","VND","QAR","KWD"].includes(baseCurrency)) { +// document.getElementById('demo3').style.display = "block"; +// document.getElementById("inputText5").value = ''; +// text = "Invalid base currency" - } +// } - else if (!["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BMD","BND","BOB","BRL","BSD", "BTN", "BWP", "BYN", - "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", - "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", - "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY","KES","KGS","KHR","KID","KMF","KRW","KWD", "KYD","KZT","LAK","LBP","LKR","LRD","LSL", "LYD", - "MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN", - "PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STN","SYP","SZL", - "THB","TJS","TMT","TND","TOP","TRY","TTD","TVD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","YER","ZAR"].includes(quoteCurrency)) { - document.getElementById('demo3').style.display = "block"; - document.getElementById("inputText5").value = ''; - text = "Invalid quote currency" +// else if (!["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BMD","BND","BOB","BRL","BSD", "BTN", "BWP", "BYN", +// "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", +// "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", +// "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY","KES","KGS","KHR","KID","KMF","KRW","KWD", "KYD","KZT","LAK","LBP","LKR","LRD","LSL", "LYD", +// "MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN", +// "PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STN","SYP","SZL", +// "THB","TJS","TMT","TND","TOP","TRY","TTD","TVD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VES","VND","VUV","WST","YER","ZAR"].includes(quoteCurrency)) { +// document.getElementById('demo3').style.display = "block"; +// document.getElementById("inputText5").value = ''; +// text = "Invalid quote currency" - } +// } - else { - text = "Input OK"; - document.getElementById('demo3').style.display = "none"; - createLi = true; - // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST - // addingItems(); - setTimeout( - function() { - document.getElementById('inputText5').value=""; - }, 100); - } - document.getElementById("demo3").innerHTML = text; - } +// else { +// text = "Input OK"; +// document.getElementById('demo3').style.display = "none"; +// createLi = true; +// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST +// // addingItems(); +// setTimeout( +// function() { +// document.getElementById('inputText5').value=""; +// }, 100); +// } +// document.getElementById("demo3").innerHTML = text; +// } // Custom messages validation @@ -2461,115 +2512,116 @@ function dailyWeatherValidate() { // Commodities validation function commoditiesValidate() { + createLi = true; +} +// var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/; -var specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/; +// let x = document.getElementById("inputText20").value; - let x = document.getElementById("inputText20").value; +// let text; +// if (x.toUpperCase() != x) { +// document.getElementById('demo8').style.display = "block"; +// text = "Commodity symbol must be uppercase"; +// document.getElementById("inputText20").value = ''; +// // createLi = false; +// } +// else if (x === '') { +// document.getElementById('demo8').style.display = "block"; +// text = "No blanks" +// // createLi = false; +// } - let text; - if (x.toUpperCase() != x) { - document.getElementById('demo8').style.display = "block"; - text = "Commodity symbol must be uppercase"; - document.getElementById("inputText20").value = ''; - // createLi = false; - } - else if (x === '') { - document.getElementById('demo8').style.display = "block"; - text = "No blanks" - // createLi = false; - } +// else if (x.includes(' ')) { +// text = "No spaces"; +// document.getElementById('demo8').style.display = "block"; +// document.getElementById("inputText20").value = ''; +// // createLi = false; +// } - else if (x.includes(' ')) { - text = "No spaces"; - document.getElementById('demo8').style.display = "block"; - document.getElementById("inputText20").value = ''; - // createLi = false; - } +// else if (specialChars.test(x)) { +// document.getElementById('demo8').style.display = "block"; +// text = "No special characters allowed"; +// document.getElementById("inputText20").value = ''; +// // createLi = false; +// } - else if (specialChars.test(x)) { - document.getElementById('demo8').style.display = "block"; - text = "No special characters allowed"; - document.getElementById("inputText20").value = ''; - // createLi = false; - } +// else if (!["ALU","BRENTOIL","LCO","COFFEE","XCU","CORN","COTTON","XAU","IRD","NI","XPD","XPT","XRH","RICE","RUTH","XAG","SOYBEAN", +// "XDR","SUGAR","TIN","WHEAT","WTIOIL","ZNC","ETHANOL","CPO","NG","COCOA","ROBUSTA","LUMBER","RUBBER","HOG","CATTLE"].includes(x)) { +// document.getElementById('demo8').style.display = "block"; +// document.getElementById("inputText20").value = ''; +// text = "Invalid commodity symbol" - else if (!["ALU","BRENTOIL","LCO","COFFEE","XCU","CORN","COTTON","XAU","IRD","NI","XPD","XPT","XRH","RICE","RUTH","XAG","SOYBEAN", - "XDR","SUGAR","TIN","WHEAT","WTIOIL","ZNC","ETHANOL","CPO","NG","COCOA","ROBUSTA","LUMBER","RUBBER","HOG","CATTLE"].includes(x)) { - document.getElementById('demo8').style.display = "block"; - document.getElementById("inputText20").value = ''; - text = "Invalid commodity symbol" +// } - } - - else { - text = "Input OK"; - document.getElementById('demo8').style.display = "none"; - createLi = true; - // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST - setTimeout( - function() { - document.getElementById('inputText20').value=""; - }, 100); - } - document.getElementById("demo8").innerHTML = text; - } +// else { +// text = "Input OK"; +// document.getElementById('demo8').style.display = "none"; +// createLi = true; +// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST +// setTimeout( +// function() { +// document.getElementById('inputText20').value=""; +// }, 100); +// } +// document.getElementById("demo8").innerHTML = text; +// } // Indices validation - function indicesValidate() { + createLi = true +}; +// var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/; -var specialChars = /[`!@#$%&*()_+\-=\[\]{};':"\\|<>\/?~]/; +// let x = document.getElementById("inputText21").value; - let x = document.getElementById("inputText21").value; +// let text; +// if (x.toUpperCase() != x) { +// document.getElementById('demo9').style.display = "block"; +// text = "Index symbol must be uppercase"; +// document.getElementById("inputText21").value = ''; +// // createLi = false; +// } +// else if (x === '') { +// document.getElementById('demo9').style.display = "block"; +// text = "No blanks" +// // createLi = false; +// } - let text; - if (x.toUpperCase() != x) { - document.getElementById('demo9').style.display = "block"; - text = "Index symbol must be uppercase"; - document.getElementById("inputText21").value = ''; - // createLi = false; - } - else if (x === '') { - document.getElementById('demo9').style.display = "block"; - text = "No blanks" - // createLi = false; - } +// else if (x.includes(' ')) { +// text = "No spaces"; +// document.getElementById('demo9').style.display = "block"; +// document.getElementById("inputText21").value = ''; +// // createLi = false; +// } - else if (x.includes(' ')) { - text = "No spaces"; - document.getElementById('demo9').style.display = "block"; - document.getElementById("inputText21").value = ''; - // createLi = false; - } +// else if (specialChars.test(x)) { +// document.getElementById('demo9').style.display = "block"; +// text = "No special characters allowed"; +// document.getElementById("inputText21").value = ''; +// // createLi = false; +// } - else if (specialChars.test(x)) { - document.getElementById('demo9').style.display = "block"; - text = "No special characters allowed"; - document.getElementById("inputText21").value = ''; - // createLi = false; - } +// 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 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"; - createLi = true; - // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST - setTimeout( - function() { - document.getElementById('inputText21').value=""; - }, 100); - } - document.getElementById("demo9").innerHTML = text; - } +// else { +// text = "Input OK"; +// document.getElementById('demo9').style.display = "none"; +// createLi = true; +// // CALL ADDING ITEMS FUNCTION SO THAT ONLY VALIDATED ITEMS CAN GET ADDED TO LIST +// setTimeout( +// function() { +// document.getElementById('inputText21').value=""; +// }, 100); +// } +// document.getElementById("demo9").innerHTML = text; +// } // portoflio stuff diff --git a/stockTicker.py b/stockTicker.py index ddb7a05..c7d924a 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -71,7 +71,7 @@ class StockTicker(): '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, 'Movies': self.getMoviesImage, - 'IPO Calendar':self.getIpoImage, 'IPO Calendar Prof':self.getIpoProfessional, + 'Economic Calendar': self.getEconomicImage, 'IPO Calendar':self.getIpoImage, 'IPO Calendar Prof':self.getIpoProfessional, 'Economic Calendar Prof': self.getEconomicProfessional, '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, @@ -80,12 +80,12 @@ class StockTicker(): 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', 'IPO Calendar': 'csv/ipo_settings.json', + 'Sports (Team Stats)': 'csv/league_tables.json', 'Sports (Past Games)': 'csv/past_games.json', 'IPO Calendar': 'csv/ipo_settings.json', 'Economic Calendar': 'csv/economic_settings.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', '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', 'IPO Calendar Prof': 'csv/ipo_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', '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', 'IPO Calendar Prof': 'csv/ipo_settings.json', 'Economic Calendar Prof': 'csv/economic_settings.json'} def openImage(self, image_file): @@ -5812,6 +5812,268 @@ class StockTicker(): return self.stitchImage(image_list) + def getEconomicImage(self): + + f = open('csv/economic_settings.json', 'r') + econ_settings = json.load(f) + f.close() + + if econ_settings['title']: + title_img = self.openImage('feature_titles/economy.png') + image_list = [title_img] + else: + image_list = [] + + font = ImageFont.load("./fonts/7x14B.pil") + font2 = ImageFont.load("./fonts/6x12.pil") + small_font = ImageFont.load("./fonts/6x10.pil") + + if len(econ_settings['events']) != 0: + try: + for event in econ_settings['events']: + if event['importance'] == -1: + imp_img = Image.open('logos/low_imp.png') + elif event['importance'] == 0: + imp_img = Image.open('logos/med_imp.png') + elif event['importance'] == 1: + imp_img = Image.open('logos/high_imp.png') + x_offset = 15 + if event['period'] != "": + clock_img = Image.open('logos/period.png') + period_img = self.textImage(event['period'].upper(), small_font, r=255, g= 255, b =255) + else: + clock_img = None + period_img = None + flag_img = Image.open('logos/economic_logos/' + event['country'] + '.png') + circle_img = Image.open('logos/indicator.png') + title_img = self.textImage((event['title'].upper()).replace("(", '').replace(")", '').replace("/", " "), font, r = 255, g = 255, b = 255) + country_img = self.textImage(event['country'].upper(), font2, r= 255, g = 255, b = 0) + date_img = self.textImage(event['time'], small_font, r=0, g=150, b=255) + indicator_img = self.textImage(event['indicator'], font2, r=255, g=255, b=255) + after_offset = 0 + if event['forecast'] != None or event['previous'] != None or event['actual'] != None: + tiny_font = ImageFont.load("./fonts/5x7.pil") + try: + if event['forecast'] != None: + fore_img = self.textImage('Forecast', tiny_font, r=255,g=255,b=255) + fore2_img = self.textImage(str(event['forecast']), tiny_font, r=0, g=255, b=0) + after_offset += max(fore_img.size[0], fore2_img.size[0]) + 3 + if event['previous'] != None: + prev_img = self.textImage('Prior', tiny_font, r=255,g=255,b=255) + prev2_img = self.textImage(str(event['previous']), tiny_font, r=0, g=255, b=0) + after_offset += max(prev_img.size[0], prev2_img.size[0]) + 3 + actual_img = self.textImage('Actual', tiny_font, r=255,g=255,b=255) + if event['actual'] == None: + actual2_img = self.textImage('Soon', tiny_font, r=255, g=40, b=40) + else: + actual2_img = self.textImage(str(event['actual']), tiny_font, r=0, g=255, b=0) + after_offset += max(actual_img.size[0], actual2_img.size[0]) + 3 + except: + pass + + try: + img = Image.new('RGB', ( + max(flag_img.size[0] + x_offset + 5 + 3 + title_img.size[0] + country_img.size[0], + max(flag_img.size[0] + x_offset + 5 + 1 + circle_img.size[0] + 2 + indicator_img.size[0] + 2 + imp_img.size[0], + flag_img.size[0] + x_offset + 5 + 1 + date_img.size[0] + 3 + 2 + clock_img.size[0] + period_img.size[0]) + 10 + after_offset + ) + ,32)) + except: + img = Image.new('RGB', ( + max(flag_img.size[0] + x_offset + 5 + 3 + title_img.size[0] + country_img.size[0], + max(flag_img.size[0] + x_offset + 5 + 1 + circle_img.size[0] + 2 + indicator_img.size[0] + 2 + imp_img.size[0], + flag_img.size[0] + x_offset + 5 + 1 + date_img.size[0]) + 10 + after_offset + ) + ,32)) + + img.paste(flag_img,(x_offset, 0)) + x_offset += flag_img.size[0] + 5 + x_offset2 = x_offset + 1 + img.paste(circle_img, (x_offset2, 15)) + img.paste(indicator_img, (x_offset2 + circle_img.size[0] + 2, 11)) + img.paste(imp_img, (x_offset2 + circle_img.size[0] + 2 + indicator_img.size[0] + 2, 15)) + img.paste(title_img, (x_offset , 0)) + x_offset += title_img.size[0] + 3 + img.paste(country_img, (x_offset, 2)) + x_offset += country_img.size[0] + + img.paste(date_img, (x_offset2, 23)) + try: + img.paste(clock_img, (x_offset2 + 3 + date_img.size[0], 24)) + img.paste(period_img, (x_offset2 + 3 + date_img.size[0] + 2 + clock_img.size[0], 23)) + x_offset2 += max(circle_img.size[0] + 2 + indicator_img.size[0] + 2 + imp_img.size[0], + date_img.size[0] + clock_img.size[0] + 3 + 2 + period_img.size[0]) + 10 + except: + x_offset2 += max(circle_img.size[0] + 2 + indicator_img.size[0] + 2 + imp_img.size[0], date_img.size[0]) + 10 + + try: + if event['forecast'] != None: + img.paste(fore_img, (x_offset2, 14)) + img.paste(fore2_img, (x_offset2, 22)) + x_offset2 += max(fore_img.size[0], fore2_img.size[0]) + 3 + except: + pass + try: + if event['previous'] != None: + img.paste(prev_img, (x_offset2, 14)) + img.paste(prev2_img, (x_offset2, 22)) + x_offset2 += max(prev_img.size[0], prev2_img.size[0]) + 3 + img.paste(actual_img, (x_offset2, 14)) + img.paste(actual2_img, (x_offset2, 22)) + x_offset2 += max(actual_img.size[0], actual2_img.size[0]) + 3 + except: + pass + image_list.append(img) + except: + pass + + elif len(econ_settings['events']) == 0: + time.sleep(0.1) + no_econ = self.textImage('No upcoming economic events today.', font, r = 255, g = 255, b = 255) + img = Image.new('RGB', (no_econ.size[0] + 15, 32)) + img.paste(no_econ, (10, 10)) + image_list.append(img) + + return self.stitchImage(image_list) + + + def getEconomicProfessional(self): + + f = open('csv/economic_settings.json', 'r') + econ_settings = json.load(f) + f.close() + + if econ_settings['title']: + title_img = self.openImage('feature_titles/small_feature_titles/economy.png') + image_list = [title_img] + else: + image_list = [] + + font = ImageFont.load("./fonts/5x8.pil") + small_font = ImageFont.load("./fonts/4x6.pil") + + if len(econ_settings['events']) != 0: + try: + for event in econ_settings['events']: + x_offset = 5 + if event['importance'] == -1: + imp_img = Image.open('logos/low_imp.png') + elif event['importance'] == 0: + imp_img = Image.open('logos/med_imp.png') + elif event['importance'] == 1: + imp_img = Image.open('logos/high_imp.png') + if event['period'] != "": + clock_img = Image.open('logos/period.png') + period_img = self.textImage(event['period'].upper(), small_font, r=255, g= 85, b =0) + else: + clock_img = None + period_img = None + flag_img = Image.open('logos/economic_logos/' + event['country'] + '.png') + width, height = flag_img.size + flag_img = flag_img.resize((int(width/2), int(height/2))) + circle_img = Image.open('logos/indicator.png') + title_img = self.textImage((event['title'].upper()).replace("(", '').replace(")", '').replace("/", " "), font, r = 255, g = 255, b = 255) + country_img = self.textImage(event['country'].upper(), small_font, r= 255, g = 255, b = 0) + date_img = self.textImage(event['time'].split(' ')[2], small_font, r=0, g=150, b=255) + indicator_img = self.textImage(event['indicator'], small_font, r=255, g=255, b=255) + + if event['forecast'] != None or event['previous'] != None or event['actual'] != None: + try: + if event['forecast'] != None: + fore_img = self.textImage('Forecast', small_font, r=255,g=255,b=255) + fore2_img = self.textImage(str(event['forecast']), small_font, r=0, g=255, b=0) + if event['previous'] != None: + prev_img = self.textImage('Prior', small_font, r=255,g=255,b=255) + prev2_img = self.textImage(str(event['previous']), small_font, r=0, g=255, b=0) + actual_img = self.textImage('Actual', small_font, r=255,g=255,b=255) + if event['actual'] == None: + actual2_img = self.textImage('Soon', small_font, r=255, g=40, b=40) + else: + actual2_img = self.textImage(str(event['actual']), small_font, r=0, g=255, b=0) + except: + pass + + x_off1 = x_offset + flag_img.size[0] + 2 + title_img.size[0] + 2 + country_img.size[0] + imp_img.size[0] + 2 + x_off2 = x_offset + flag_img.size[0] + 2 + circle_img.size[0] + 2 + indicator_img.size[0] + 2 + date_img.size[0] + 2 + try: + x_off2 += clock_img.size[0] + 2 + period_img.size[0] + 2 + except: + pass + x_off3 = max(x_off1, x_off2) + try: + if event['forecast'] != None: + x_off3 += max(fore_img.size[0], fore2_img.size[0]) + 2 + except: + pass + try: + if event['previous'] != None: + x_off3 += max(prev_img.size[0], prev2_img.size[0]) + 2 + x_off3 += max(actual_img.size[0], actual2_img.size[0]) + 2 + except: + pass + + img = Image.new('RGB', (x_off3 + 5,16)) + + img.paste(flag_img, (x_offset, 0)) + x_offset += flag_img.size[0] + 2 + x_offset2 = x_offset + img.paste(title_img, (x_offset, 0)) + x_offset += title_img.size[0] +2 + img.paste(country_img, (x_offset, 2)) + x_offset += country_img.size[0] + img.paste(imp_img, (x_offset, 1)) + x_offset += imp_img.size[0] + 2 + + img.paste(circle_img, (x_offset2, 9)) + x_offset2 += circle_img.size[0] + 2 + img.paste(indicator_img, (x_offset2, 9)) + x_offset2 += indicator_img.size[0] + 2 + img.paste(date_img, (x_offset2, 9)) + x_offset2 += date_img.size[0] + 2 + try: + img.paste(clock_img, (x_offset2, 8)) + x_offset2 += clock_img.size[0] + 2 + img.paste(period_img, (x_offset2, 9)) + x_offset2 += period_img.size[0] + 2 + except: + pass + + x_offset3 = max(x_offset, x_offset2) + try: + if event['forecast'] != None: + img.paste(fore_img, (x_offset3, 3)) + img.paste(fore2_img, (x_offset3, 9)) + x_offset3 += max(fore_img.size[0], fore2_img.size[0]) + 2 + except: + pass + try: + if event['previous'] != None: + img.paste(prev_img, (x_offset3, 3)) + img.paste(prev2_img, (x_offset3, 9)) + x_offset3 += max(prev_img.size[0], prev2_img.size[0]) + 2 + img.paste(actual_img, (x_offset3, 3)) + img.paste(actual2_img, (x_offset3, 9)) + x_offset3 += max(actual_img.size[0], actual2_img.size[0]) + 2 + except: + pass + + image_list.append(img) + except: + time.sleep(0.1) + no_econ = self.textImage('No upcoming economic events today.', font, r = 255, g = 255, b = 255) + img = Image.new('RGB', (no_econ.size[0] + 15, 16)) + img.paste(no_econ, (10, 1)) + image_list.append(img) + elif len(econ_settings['events']) == 0: + time.sleep(0.1) + no_econ = self.textImage('No upcoming economic events today.', font, r = 255, g = 255, b = 255) + img = Image.new('RGB', (no_econ.size[0] + 15, 16)) + img.paste(no_econ, (10, 1)) + image_list.append(img) + + return self.stitchImage(image_list) + + def ip_viewer(self): font = ImageFont.load("./fonts/6x10.pil") @@ -5887,6 +6149,8 @@ class StockTicker(): x_offset += images.size[0] news.paste(ipo, (x_offset, 16)) x_offset += ipo.size[0] + news.paste(economic, (x_offset, 16)) + x_offset += economic.size[0] self.double_buffer = self.matrix.CreateFrameCanvas() while True: kill = stock_ticker.scrollImage(news, offset_x = 128) @@ -5970,6 +6234,9 @@ class StockTicker(): elif msg == 'IPO': #ipo self.scrollFunctionsAnimated(['ipo', 'ipo'],animation = 'traditional') + elif msg == 'EC': #economic calendar + self.scrollFunctionsAnimated(['economic', 'economic'],animation = 'traditional') + elif msg == 'A': #everything #userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo diff --git a/templates/index.html b/templates/index.html index 7407cf0..9160d20 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,7 +39,7 @@ - + @@ -99,7 +99,7 @@ -

Version 1.3.5

+

Version 1.3.6

Changelog

@@ -1204,49 +1204,29 @@ class="display-features-list text-white"> {%if professional%} - {% for f in not_displaying2 %} -
  • {{f}}
  • - {% endfor%} - - {%else%}
  • Stocks
  • -
  • Crypto
  • -
  • Forex
  • -
  • Commodities
  • -
  • Indices
  • -
  • Current Weather
  • -
  • Daily Forecast
  • -
  • News
  • -
  • Custom Images
  • -
  • Custom Messages
  • -
  • Custom Gifs
  • -
  • Sports (Upcoming Games)
  • -
  • Sports (Live Games)
  • -
  • Sports (Past Games)
  • -
  • Sports (Team Stats)
  • -
  • Movies
  • -
  • IPO Calendar
  • +
  • Economic Calendar
  • {%endif%} @@ -1329,59 +1309,36 @@
    -

    What to Display in Each Feature

    -
    - -
    - -
    @@ -1799,19 +1756,11 @@
    @@ -2536,30 +2485,24 @@
    - - - + placeholder="e.g. BRENTOIL"/> --> +
    - -
    - -
    - @@ -2966,30 +2909,36 @@
    - + +
    - -
    - -
    - @@ -3271,155 +3220,130 @@