save sector settings added
This commit is contained in:
parent
840a5813de
commit
62a3208d91
52
server.py
52
server.py
@ -146,7 +146,7 @@ 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', 'Economic Calendar', 'Jokes', 'Gainers, Losers, Active']
|
||||
'IPO Calendar', 'Economic Calendar', 'Jokes', 'Gainers, Losers, Active', 'Sector Performance']
|
||||
|
||||
global professional
|
||||
|
||||
@ -374,7 +374,14 @@ def index():
|
||||
f.close()
|
||||
except:
|
||||
market_settings = {"feature": "Gainers, Losers, Active", "speed": "medium", "speed2": "medium", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "lohivol": False, "categories": ["Top Gainers", "Top Losers", "Most Active"], "gainers": {}, "losers": {}, "mostactive": {}}
|
||||
|
||||
|
||||
try:
|
||||
f = open('csv/sector_settings.json', 'r')
|
||||
sector_settings = json.load(f)
|
||||
f.close()
|
||||
except:
|
||||
sector_settings = {"feature": "Sector Performance", "speed": "medium", "speed2": "medium", "animation": "up", "logos": True, "title": True, "sectors": ["Energy", "Financials", "Real Estate", "Technology"], "data": {}}
|
||||
|
||||
try:
|
||||
f = open('csv/scheduler.json','r')
|
||||
scheduler_settings = json.load(f)
|
||||
@ -437,6 +444,7 @@ def index():
|
||||
'economic_settings':economic_settings,
|
||||
'jokes_settings':jokes_settings,
|
||||
'market_settings':market_settings,
|
||||
'sector_settings':sector_settings,
|
||||
'networks_list': networks_list
|
||||
}
|
||||
|
||||
@ -543,11 +551,11 @@ 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', 'Economic Calendar', 'Jokes', 'Gainers, Losers, Active']
|
||||
'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages', 'Movies', 'IPO Calendar', 'Economic Calendar', 'Jokes', 'Gainers, Losers, Active', 'Sector Performance']
|
||||
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', 'Economic Calendar', 'Jokes', 'Gainers, Losers, Active']
|
||||
'Sports (Past Games)', 'Sports (Team Stats)', 'Sports (Live Games)', 'Custom Messages', 'Custom Images', 'Movies', 'IPO Calendar', 'Economic Calendar', 'Jokes', 'Gainers, Losers, Active', 'Sector Performance']
|
||||
|
||||
positions = []
|
||||
display_settings = []
|
||||
@ -698,6 +706,8 @@ def save():
|
||||
save_sports_settings(input_settings)
|
||||
elif feature == 'Gainers, Losers, Active':
|
||||
save_market_settings(input_settings)
|
||||
elif feature == 'Sector Performance':
|
||||
save_sector_settings(input_settings)
|
||||
elif feature in ['Custom GIFs', 'Custom Images']:
|
||||
|
||||
images = request.files
|
||||
@ -1445,6 +1455,40 @@ def save_market_settings(input_settings):
|
||||
f.close()
|
||||
|
||||
|
||||
def save_sector_settings(input_settings):
|
||||
filename = 'sector_settings.json'
|
||||
try:
|
||||
f = open('csv/' + filename, 'r')
|
||||
current_settings = json.load(f)
|
||||
f.close()
|
||||
except:
|
||||
current_settings = {"feature": "Sector Performance", "speed": "medium", "speed2": "medium", "animation": "up", "logos": True, "title": True, "sectors": ["Energy", "Financials", "Real Estate", "Technology"], "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']
|
||||
current_settings['logos'] = input_settings['logos']
|
||||
current_settings['sectors'] = input_settings['categories']
|
||||
try:
|
||||
f = open('csv/' + filename, 'w')
|
||||
json.dump(current_settings, f)
|
||||
f.close()
|
||||
except:
|
||||
with open('csv/sector_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['sector']['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']
|
||||
|
Loading…
Reference in New Issue
Block a user