frontend loading settings started

This commit is contained in:
Neythen 2021-09-20 20:46:15 +01:00
parent ec619563b1
commit 7117947b23
10 changed files with 83 additions and 169 deletions

View File

@ -1 +1 @@
{"speed": "medium", "animation": "continuous", "title": true, "pause": "", "images": ["asdf.gif", "image.gif", "hafgrt.gif", "asdf.gif", "image.gif", "hafgrt.gif", "asdf.gif", "image.gif", "hafgrt.gif", "asdf.gif", "image.gif", "hafgrt.gif"]}
{"speed": "medium", "animation": "continuous", "title": true, "pause": "", "images": ["image.gif"]}

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": -1, "BTC,USD": -1, "ETH,BTC": -1}}
{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": -1, "BTC,USD": -1, "ETH,BTC": -1, "ADA,GBP": -1}}

View File

@ -1 +1 @@
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "cities": {"London": {"main_weather": "Rain", "description": "light rain", "temp": 29.71, "min_temp": 27.67, "max_temp": 29.71, "feels_like": 36.71, "humidity": 83, "clouds": 38, "wind_speed": 3.9, "wind_direction": 126, "visibility": 10000, "uv": 0, "rain_chance": 0.51}, "Hong Kong": -1, "Boston": -1}}
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "cities": {"London": {"main_weather": "Rain", "description": "light rain", "temp": 29.71, "min_temp": 27.67, "max_temp": 29.71, "feels_like": 36.71, "humidity": 83, "clouds": 38, "wind_speed": 3.9, "wind_direction": 126, "visibility": 10000, "uv": 0, "rain_chance": 0.51}, "Hong Kong": -1}}

View File

@ -1 +1 @@
["Stocks", "Crypto", "Forex"]
["Stocks", "Crypto", "Forex", "Current Weather"]

View File

@ -1 +1 @@
{"speed": "medium", "animation": "continuous", "title": true, "pause": "", "images": ["asdf.png", "image.png", "hafgrt.jpg", "asdf.png", "image.png", "hafgrt.jpg", "asdf.png", "image.png", "hafgrt.jpg", "asdf.png", "image.png", "hafgrt.jpg"]}
{"speed": "medium", "animation": "continuous", "title": true, "pause": "", "images": ["image.png"]}

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"APL": 0.0, "GOOG": 0.0, "FB": -1, "ROKU": -1, "TGT": -1, "TSLA": -1, "SNAP": -1, "T": -1, "DIS": -1, "NFLX": -1, "MSFT": -1, "HOG": -1, "M": -1, "A": -1}}
{"feature": "Stocks", "speed": "medium", "animation": "continuous", "percent": false, "point": true, "no_logos": true, "chart": false, "title": true, "symbols": {"APL": 0.0, "GOOG": 0.0, "FB": -1, "ROKU": -1, "TGT": -1, "TSLA": -1, "SNAP": -1, "NFLX": -1, "MSFT": -1}}

View File

@ -1 +1 @@
{"feature": "Sports (Upcoming Games)", "speed": "medium", "animation": "continuous", "title": true, "leagues": {"NFL": -1, "NBA": -1, "NHA": -1, "Premier League": -1}}
{"feature": "Sports (Upcoming Games)", "speed": "medium", "animation": "continuous", "title": true, "leagues": {"NFL": -1, "NBA": -1, "NHA": -1}}

View File

@ -54,21 +54,46 @@ app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
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']
currently_displaying = json.load(open('csv/display_settings.json', 'r'))
not_displaying = [f for f in all_features if f not in currently_displaying]
now = datetime.datetime.now()
timeString = now.strftime("%Y-%m-%d %H:%M")
logos_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos')
LogoList = os.listdir(logos_path)
stocks_settings = json.load(open('csv/stocks_settings.json', 'r'))
crypto_settings = json.load(open('csv/crypto_settings.json', 'r'))
forex_settings = json.load(open('csv/forex_settings.json', 'r'))
current_weather= json.load(open('csv/current_weather.json', 'r'))
daily_weather = json.load(open('csv/daily_weather.json', 'r'))
news_settings = json.load(open('csv/news_settings.json', 'r'))
upcoming_games = json.load(open('csv/upcoming_games.json', 'r'))
live_games = json.load(open('csv/live_games.json', 'r'))
past_games = json.load(open('csv/past_games.json', 'r'))
team_stats = json.load(open('csv/team_stats.json', 'r'))
image_settings = json.load(open('csv/image_settings.json', 'r'))
GIF_settings = json.load(open('csv/GIF_settings.json', 'r'))
templateData = {
'title' : 'Stock Ticker Control Panel',
'time': timeString,
'runtime': command,
'tickers': tickerList,
'logofiles':LogoList,
'lastcommand':LastCommand,
'delay':DelayTime,
'speedtime':speedTime
'currently_displaying': currently_displaying,
'not_displaying': not_displaying,
'stocks_settings': stocks_settings,
'crypto_settings': crypto_settings,
'forex_settings': forex_settings,
'current_weather': current_weather,
'daily_weather': daily_weather,
'news_settings': news_settings,
'upcoming_games': upcoming_games,
'past_games': past_games,
'live_games': live_games,
'team_stats': team_stats,
'image_settings':image_settings,
'GIF_settings':GIF_settings
}
return render_template('index.html', **templateData)

View File

@ -621,7 +621,7 @@ function getListItems(list_el) {
return items;
}
// start the display
// toggle professional
dispFormatButton.addEventListener("click", () => {
opt = getSelected(displayFormats);

View File

@ -168,16 +168,9 @@
id="available-features"
class="display-features-list text-dark"
>
<li>Current Weather</li>
<li>Daily Forecast</li>
<li>News</li>
<li>Sports (Upcoming Games)</li>
<li>Sports (Past Games)</li>
<li>Sports (Live Games)</li>
<li>Sports (Team Stats)</li>
<li>Custom Images</li>
<li>Custom GIFs</li>
<li>Custom Messages</li>
{% for f in not_displaying %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
@ -202,9 +195,9 @@
<h6>Display Format:</h6>
<div class="features-div">
<ul id="display-format" class="display-features-list text-dark">
<li>Stocks</li>
<li>Crypto</li>
<li>Forex</li>
{% for f in currently_displaying %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -406,25 +399,9 @@
id="stocks-features"
class="display-features-list text-dark symbol-list"
>
<li>APL</li>
<li>FB</li>
<li>ROKU</li>
<li>TGT</li>
<li>TSLA</li>
<li>GOOG</li>
<li>SNAP</li>
<li>T</li>
<li>DIS</li>
<li>NFLX</li>
<li>MSFT</li>
<li>HOG</li>
<li>M</li>
<li>A</li>
<li>UAL</li>
{% for f in stocks_settings.symbols %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -612,21 +589,9 @@
id="crypto-features"
class="display-features-list text-dark symbol-list"
>
<li>NEO,USD</li>
<li>BTC,USD</li>
<li>ETH,BTC</li>
<li>NEO,USD</li>
<li>BTC,USD</li>
<li>ETH,BTC</li>
<li>NEO,USD</li>
<li>BTC,USD</li>
<li>ETH,BTC</li>
<li>NEO,USD</li>
<li>BTC,USD</li>
<li>ETH,BTC</li>
{% for f in crypto_settings.symbols %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -814,21 +779,9 @@
id="forex-features"
class="display-features-list text-dark symbol-list"
>
<li>NZD,USD</li>
<li>CAD,USD</li>
<li>GBP,BTC</li>
<li>NZD,USD</li>
<li>CAD,USD</li>
<li>GBP,BTC</li>
<li>NZD,USD</li>
<li>CAD,USD</li>
<li>GBP,BTC</li>
<li>NZD,USD</li>
<li>CAD,USD</li>
<li>GBP,BTC</li>
{% for f in forex_settings.symbols %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1010,21 +963,9 @@
id="current-weather-features"
class="display-features-list text-dark city-list"
>
<li>Hong Kong</li>
<li>Boston</li>
<li>London</li>
<li>Hong Kong</li>
<li>Boston</li>
<li>London</li>
<li>Hong Kong</li>
<li>Boston</li>
<li>London</li>
<li>Hong Kong</li>
<li>Boston</li>
<li>London</li>
{% for f in current_weather.cities.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1224,21 +1165,9 @@
id="daily-forecast-features"
class="display-features-list text-dark city-list"
>
<li>Moscow</li>
<li>Tokyo</li>
<li>Beijing</li>
<li>Moscow</li>
<li>Tokyo</li>
<li>Beijing</li>
<li>Moscow</li>
<li>Tokyo</li>
<li>Beijing</li>
<li>Moscow</li>
<li>Tokyo</li>
<li>Beijing</li>
{% for f in daily_weather.cities.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1405,17 +1334,9 @@
id="news-features"
class="display-features-list text-dark sources-list"
>
<li>Bloomberg</li>
<li>ABC News</li>
<li>Yahoo</li>
<li>Bloomberg</li>
<li>ABC News</li>
<li>Yahoo</li>
<li>Bloomberg</li>
<li>ABC News</li>
<li>Yahoo</li>
{% for f in news_settings.sources.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1538,11 +1459,9 @@
id="upcoming-games-features"
class="display-features-list text-dark league-list"
>
<li>NFL</li>
<li>NBA</li>
<li>NHA</li>
<li>Premier League</li>
{% for f in upcoming_games.leagues.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1665,11 +1584,9 @@
id="past-games-features"
class="display-features-list text-dark league-list"
>
<li>NFL</li>
<li>NBA</li>
<li>NHA</li>
<li>Premier League</li>
{% for f in past_games.leagues.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1792,11 +1709,9 @@
id="live-games-features"
class="display-features-list text-dark league-list"
>
<li>NFL</li>
<li>NBA</li>
<li>NHA</li>
<li>Premier League</li>
{% for f in live_games.leagues.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -1918,11 +1833,9 @@
id="team-stats-features"
class="display-features-list text-dark league-list"
>
<li>NFL</li>
<li>NBA</li>
<li>NHA</li>
<li>Premier League</li>
{% for f in team_stats.leagues.keys() %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -2069,21 +1982,9 @@
id="images-features"
class="display-features-list text-dark image-list"
>
<li>asdf.png</li>
<li>image.png</li>
<li>hafgrt.jpg</li>
<li>asdf.png</li>
<li>image.png</li>
<li>hafgrt.jpg</li>
<li>asdf.png</li>
<li>image.png</li>
<li>hafgrt.jpg</li>
<li>asdf.png</li>
<li>image.png</li>
<li>hafgrt.jpg</li>
{% for f in image_settings.images %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>
@ -2232,21 +2133,9 @@
id="gifs-features"
class="display-features-list text-dark image-list"
>
<li>asdf.gif</li>
<li>image.gif</li>
<li>hafgrt.gif</li>
<li>asdf.gif</li>
<li>image.gif</li>
<li>hafgrt.gif</li>
<li>asdf.gif</li>
<li>image.gif</li>
<li>hafgrt.gif</li>
<li>asdf.gif</li>
<li>image.gif</li>
<li>hafgrt.gif</li>
{% for f in GIF_settings.images %}
<li>{{f}}</li>
{% endfor%}
</ul>
</div>
</div>