diff --git a/csv/system_info.json b/csv/system_info.json index c82636f..02cf3e9 100755 --- a/csv/system_info.json +++ b/csv/system_info.json @@ -1 +1 @@ -{"update_available": false, "first_boot": false} \ No newline at end of file +{"update_available": false, "first_boot": true} diff --git a/database_caller.py b/database_caller.py index 4fb3a48..dd7a84e 100755 --- a/database_caller.py +++ b/database_caller.py @@ -345,7 +345,7 @@ def updateWeather(api_key): all_current_settings['locations'] = current_weathers all_daily_settings['locations'] = daily_weathers - + print(all_current_settings, all_daily_settings) json.dump( all_current_settings, open( "csv/current_weather.json", 'w+' )) json.dump( all_daily_settings, open( "csv/daily_weather.json", 'w+' )) @@ -611,7 +611,7 @@ if __name__ == '__main__': last_updates = {"stocks": "27/06/2021 07:05:39", "crypto": "27/06/2021 07:05:39", "news": "27/06/2021 07:05:39", "weather": "27/06/2021 07:05:39", "forex": "27/06/2021 07:05:39", "sports": "27/06/2021 07:05:39"} t = time.time() - + try: while True: diff --git a/server.py b/server.py index d6e8299..88aaa38 100755 --- a/server.py +++ b/server.py @@ -242,6 +242,12 @@ def restart(): os.system("sudo reboot now") return index() +@app.route("/reset") +def reset(): + print('reset') + os.system("sudo ./setup_config_files.sh") + return index() + @app.route("/save", methods = ['PUT', 'POST', 'GET']) def save(): print('save') diff --git a/setup_config_files.sh b/setup_config_files.sh index cddb7ee..c05128a 100755 --- a/setup_config_files.sh +++ b/setup_config_files.sh @@ -22,17 +22,17 @@ echo '{"update_available": false, "first_boot": true}' >> system_info.json echo [\"Standard\", [[\"Stocks\", \"Crypto\", \"Forex\"]]] >> display_settings.json echo hello world!,255,255,0 >> scroll_text.csv -echo '{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "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 +echo '{"feature": "Stocks", "speed": "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 echo -e "speed,brightness\nf,3" >> settings.csv echo '{"feature": "Sports (Team Stats)", "speed": "medium", "animation": "down", "title": true, "leagues": {}}' >> league_tables.json echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/sec\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> current_weather.json -echo '{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "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"}}}' >> stocks_settings.json +echo '{"feature": "Stocks", "speed": "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"}}}' >> stocks_settings.json echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/sec\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> daily_weather.json echo '{"feature": "Sports (Live Games)", "speed": "medium", "animation": "down", "title": true, "leagues": {}}' >> live_games.json echo '{"feature": "Custom Messages", "speed": "Medium", "animation": "down", "title": true, "messages": [{"name": "1", "text": "123", "text_colour": "White", "size": "Medium", "background_colour": "Black"}, {"name": "13", "text": "123", "text_colour": "Red", "size": "Medium", "background_colour": "Purple"}]}' >> message_settings.json echo '{"feature": "Sports (Upcoming Games)", "speed": "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"}, {"date": "2021-11-23", "time": "01:15:00", "round": "11", "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}, {"date": "2021-11-25", "time": "17:30:00", "round": "12", "home_team": "Detroit Lions", "home_score": null, "away_team": "Chicago Bears", "away_score": null}, {"date": "2021-11-25", "time": "21:30:00", "round": "12", "home_team": "Dallas Cowboys", "home_score": null, "away_team": "Las Vegas Raiders", "away_score": null}, {"date": "2021-11-26", "time": "01:20:00", "round": "12", "home_team": "New Orleans Saints", "home_score": null, "away_team": "Buffalo Bills", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Cincinnati Bengals", "home_score": null, "away_team": "Pittsburgh Steelers", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Houston Texans", "home_score": null, "away_team": "New York Jets", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Indianapolis Colts", "home_score": null, "away_team": "Tampa Bay Buccaneers", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Jacksonville Jaguars", "home_score": null, "away_team": "Atlanta Falcons", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Miami Dolphins", "home_score": null, "away_team": "Carolina Panthers", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "New England Patriots", "home_score": null, "away_team": "Tennessee Titans", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "New York Giants", "home_score": null, "away_team": "Philadelphia Eagles", "away_score": null}, {"date": "2021-11-28", "time": "21:05:00", "round": "12", "home_team": "Denver Broncos", "home_score": null, "away_team": "Los Angeles Chargers", "away_score": null}, {"date": "2021-11-28", "time": "21:25:00", "round": "12", "home_team": "Green Bay Packers", "home_score": null, "away_team": "Los Angeles Rams", "away_score": null}, {"date": "2021-11-28", "time": "21:25:00", "round": "12", "home_team": "San Francisco 49ers", "home_score": null, "away_team": "Minnesota Vikings", "away_score": null}], "NBA": [{"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"}, {"date": "2021-11-23", "time": "01:15:00", "round": "11", "home_team": "Tampa Bay Buccaneers", "home_score": "0", "away_team": "New York Giants", "away_score": "0"}, {"date": "2021-11-25", "time": "17:30:00", "round": "12", "home_team": "Detroit Lions", "home_score": null, "away_team": "Chicago Bears", "away_score": null}, {"date": "2021-11-25", "time": "21:30:00", "round": "12", "home_team": "Dallas Cowboys", "home_score": null, "away_team": "Las Vegas Raiders", "away_score": null}, {"date": "2021-11-26", "time": "01:20:00", "round": "12", "home_team": "New Orleans Saints", "home_score": null, "away_team": "Buffalo Bills", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Cincinnati Bengals", "home_score": null, "away_team": "Pittsburgh Steelers", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Houston Texans", "home_score": null, "away_team": "New York Jets", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Indianapolis Colts", "home_score": null, "away_team": "Tampa Bay Buccaneers", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Jacksonville Jaguars", "home_score": null, "away_team": "Atlanta Falcons", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "Miami Dolphins", "home_score": null, "away_team": "Carolina Panthers", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "New England Patriots", "home_score": null, "away_team": "Tennessee Titans", "away_score": null}, {"date": "2021-11-28", "time": "18:00:00", "round": "12", "home_team": "New York Giants", "home_score": null, "away_team": "Philadelphia Eagles", "away_score": null}, {"date": "2021-11-28", "time": "21:05:00", "round": "12", "home_team": "Denver Broncos", "home_score": null, "away_team": "Los Angeles Chargers", "away_score": null}, {"date": "2021-11-28", "time": "21:25:00", "round": "12", "home_team": "Green Bay Packers", "home_score": null, "away_team": "Los Angeles Rams", "away_score": null}, {"date": "2021-11-28", "time": "21:25:00", "round": "12", "home_team": "San Francisco 49ers", "home_score": null, "away_team": "Minnesota Vikings", "away_score": null}]}}' >> upcoming_games.json -echo '{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "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_settings.json +echo '{"feature": "Stocks", "speed": "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_settings.json echo '{"speed": "medium", "animation": "down", "title": true, "pause": "2", "images": []}'>> GIF_settings.json echo '{"feature": "News", "speed": "medium", "animation": "down", "country": "US", "category": "General", "title": true, "headlines": [], "use_category": true, "use_country": false, "num_headlines": "10"}' >> news_settings.json echo '{"speed": "slow", "animation": "down", "title": true, "pause": "/", "images": []}' >> image_settings.json diff --git a/static/app.js b/static/app.js index a576a69..12011e9 100755 --- a/static/app.js +++ b/static/app.js @@ -345,11 +345,11 @@ const addEventOnFeaturesList = () => { availableFeature.setAttribute("class", ""); } else { availableFeature.setAttribute("class", "active"); - // let getCustomImages = JSON.parse( - // localStorage.getItem("customImages") - // ); - // let getCustomGifs = JSON.parse(localStorage.getItem("customGifs")); - // let getCustomMsg = JSON.parse(localStorage.getItem("customMsg")); + let getCustomImages = JSON.parse( + localStorage.getItem("customImages") + ); + let getCustomGifs = JSON.parse(localStorage.getItem("customGifs")); + let getCustomMsg = JSON.parse(localStorage.getItem("customMsg")); getCustomImages.map((value) => { let scrollSpeed1 = document.getElementById("inputScrollSpeed11"); @@ -487,28 +487,28 @@ allFeaturesRemoveBtns.map((value, index) => { console.log(item); if (item.getAttribute("class") == "active") { if (item.parentElement.getAttribute("id") == "images-features") { - // let getImages = JSON.parse(localStorage.getItem("customImages")); + let getImages = JSON.parse(localStorage.getItem("customImages")); let filter = getImages.filter( (value) => value.fileName !== item.innerText ); - // localStorage.setItem("customImages", JSON.stringify(filter)); + localStorage.setItem("customImages", JSON.stringify(filter)); } else if (item.parentElement.getAttribute("id") == "gifs-features") { - // let getGifs = JSON.parse(localStorage.getItem("customGifs")); + let getGifs = JSON.parse(localStorage.getItem("customGifs")); let filter = getGifs.filter( (value) => value.fileName !== item.innerText ); - // localStorage.setItem("customGifs", JSON.stringify(filter)); + localStorage.setItem("customGifs", JSON.stringify(filter)); } else if ( item.parentElement.getAttribute("id") == "messages-features" ) { - // let getMsgs = JSON.parse(localStorage.getItem("customMsg")); + let getMsgs = JSON.parse(localStorage.getItem("customMsg")); let filter = getMsgs.filter( - (value) => value.messageName !== item.innerText + (value) => value.messageName !== item.innerText ); - // localStorage.setItem("customMsg", JSON.stringify(filter)); + localStorage.setItem("customMsg", JSON.stringify(filter)); } else { item.remove(); @@ -789,7 +789,7 @@ allFeaturesTextAddBtn.map((value, index) => { displayCheck, }; - // let getCustomMsg = localStorage.getItem("customMsg"); + let getCustomMsg = localStorage.getItem("customMsg"); let newValues = getCustomMsg && JSON.parse(getCustomMsg); getCustomMsg && newValues.push(values); @@ -867,6 +867,14 @@ restartButton.addEventListener("click", () => { }); }); +var resetButton = document.getElementById("reset-btn"); + +resetButton.addEventListener("click", () => { + fetch("/reset", { + method: "GET", + }); +}); + var stopButton = document.getElementById("stop-btn"); stopButton.addEventListener("click", () => { @@ -877,8 +885,8 @@ stopButton.addEventListener("click", () => { -var stopButton = document.getElementById("screensaver-btn"); -stopButton.addEventListener("click", () => { +var screensaverButton = document.getElementById("screensaver-btn"); +screensaverButton.addEventListener("click", () => { let anim = localStorage.getItem("inputAnimation"); @@ -1211,7 +1219,7 @@ allFeaturesFileAddBtn.map((value, index) => { var tag = document.createElement("li"); tag.innerHTML = allFeaturesFile[index].files[0].name; if (index == 10) { - // let getCustomImg = localStorage.getItem("customImages"); + let getCustomImg = localStorage.getItem("customImages"); let fileName = imagesFile.files[0].name; let scrollSpeed = document.getElementById("inputScrollSpeed11").value; let scrollSpeed2 = document.getElementById( @@ -1249,7 +1257,7 @@ allFeaturesFileAddBtn.map((value, index) => { allFeatures[index].appendChild(tag); } } else if (index == 11) { - // let getCustomGifs = localStorage.getItem("customGifs"); + let getCustomGifs = localStorage.getItem("customGifs"); let fileName = allFeaturesFile[index].files[0].name; let scrollSpeed = document.getElementById("inputScrollSpeed12").value; let scrollSpeed2 = document.getElementById( diff --git a/templates/index.html b/templates/index.html index e99570a..ad84b59 100644 --- a/templates/index.html +++ b/templates/index.html @@ -84,6 +84,11 @@
+