added save_place_settings
This commit is contained in:
parent
5305946453
commit
a458d77444
30
server.py
30
server.py
@ -373,7 +373,7 @@ def index():
|
|||||||
place_settings = json.load(f)
|
place_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
place_settings = {"feature": "r/place", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "width": 128, "pause": "0", "places": ["r/place 2017", "r/place 2022"]}
|
place_settings = {"feature": "r/place", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "width": "128", "pause": "0", "places": ["r/place 2017", "r/place 2022"]}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open('csv/market_settings.json', 'r')
|
f = open('csv/market_settings.json', 'r')
|
||||||
@ -716,6 +716,8 @@ def save():
|
|||||||
save_market_settings(input_settings)
|
save_market_settings(input_settings)
|
||||||
elif feature == 'Sector Performance':
|
elif feature == 'Sector Performance':
|
||||||
save_sector_settings(input_settings)
|
save_sector_settings(input_settings)
|
||||||
|
elif feature == 'r/place (Reddit)':
|
||||||
|
save_place_settings(input_settings)
|
||||||
elif feature in ['Custom GIFs', 'Custom Images']:
|
elif feature in ['Custom GIFs', 'Custom Images']:
|
||||||
|
|
||||||
images = request.files
|
images = request.files
|
||||||
@ -1497,6 +1499,32 @@ def save_sector_settings(input_settings):
|
|||||||
# f.close()
|
# f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def save_place_settings(input_settings):
|
||||||
|
filename = 'place_settings.json'
|
||||||
|
try:
|
||||||
|
f = open('csv/' + filename, 'r')
|
||||||
|
current_settings = json.load(f)
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
current_settings = {"feature": "r/place", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "width": "128", "pause": "0", "places": ["r/place 2017", "r/place 2022"]}
|
||||||
|
|
||||||
|
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['width'] = input_settings['width']
|
||||||
|
current_settings['pause'] = input_settings['pause']
|
||||||
|
current_settings['places'] = input_settings['places']
|
||||||
|
try:
|
||||||
|
f = open('csv/' + filename, 'w')
|
||||||
|
json.dump(current_settings, f)
|
||||||
|
f.close()
|
||||||
|
except:
|
||||||
|
with open('csv/place_settings.json', 'w') as f:
|
||||||
|
json.dump(current_settings, f)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def save_sports_settings(input_settings):
|
def save_sports_settings(input_settings):
|
||||||
|
|
||||||
feature = input_settings['feature']
|
feature = input_settings['feature']
|
||||||
|
Loading…
Reference in New Issue
Block a user