diff --git a/server.py b/server.py index fb2edcb..7f20235 100755 --- a/server.py +++ b/server.py @@ -373,7 +373,7 @@ def index(): place_settings = json.load(f) f.close() 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: f = open('csv/market_settings.json', 'r') @@ -716,6 +716,8 @@ def save(): save_market_settings(input_settings) elif feature == 'Sector Performance': save_sector_settings(input_settings) + elif feature == 'r/place (Reddit)': + save_place_settings(input_settings) elif feature in ['Custom GIFs', 'Custom Images']: images = request.files @@ -1497,6 +1499,32 @@ def save_sector_settings(input_settings): # 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): feature = input_settings['feature']