This repository has been archived by the owner on Dec 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f665ef
commit edee315
Showing
1 changed file
with
6 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
import json | ||
|
||
prefs_file = '/home/pi/.config/chromium/Default/Preferences' | ||
master_prefs_file = '/usr/lib/chromium-browser/master_preferences' | ||
global_prefs_file = '/usr/lib/chromium-browser/master_preferences' | ||
prefs = {} | ||
|
||
try: | ||
with open(prefs_file, 'r') as f: | ||
location = "local" | ||
prefs = json.load(f) | ||
except FileNotFoundError: | ||
#print("Chromium settings not found - please launch Chromium once before running this script") | ||
print("User Chromium settings not found - Modifying master settings") | ||
with open(master_prefs_file, 'r') as f: | ||
prefs_file = global_prefs_file | ||
with open(prefs_file, 'r') as f: | ||
prefs = json.load(f) | ||
location = "master" | ||
|
||
if prefs: | ||
prefs['session'] = { | ||
'restore_on_startup': 4, | ||
'startup_urls': ['http://rpf.io/ap-msl-guide'] | ||
} | ||
if location == "master": | ||
with open(master_prefs_file, 'w') as f: | ||
json.dump(prefs,f) | ||
elif location == "local": | ||
with open(prefs_file, 'w') as f: | ||
json.dump(prefs,f) | ||
|
||
with open(prefs_file, 'w') as f: | ||
json.dump(prefs, f) |