From 3a2e21901f6b72b0f03729b92e83a77a923efe27 Mon Sep 17 00:00:00 2001 From: MySixSenses <66916362+MySixSenses@users.noreply.github.com> Date: Sat, 5 Sep 2020 10:09:04 -0700 Subject: [PATCH 1/4] Create options.ini --- options.ini | 1 + 1 file changed, 1 insertion(+) create mode 100644 options.ini diff --git a/options.ini b/options.ini new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/options.ini @@ -0,0 +1 @@ + From fb7e5f644361b1af2236a4b756dd022d780a5c63 Mon Sep 17 00:00:00 2001 From: MySixSenses <66916362+MySixSenses@users.noreply.github.com> Date: Sat, 5 Sep 2020 10:14:51 -0700 Subject: [PATCH 2/4] Update and rename options.ini to options.json --- options.ini | 1 - options.json | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 options.ini create mode 100644 options.json diff --git a/options.ini b/options.ini deleted file mode 100644 index 8b13789..0000000 --- a/options.ini +++ /dev/null @@ -1 +0,0 @@ - diff --git a/options.json b/options.json new file mode 100644 index 0000000..e5ecffe --- /dev/null +++ b/options.json @@ -0,0 +1,5 @@ +{spotifyUsername: "#EnterUsernameHere" +spotifyClientID: "#EnterClientIDHere" +spotifyClientSecret: "#EnterClientSecretHere" +spotifyAccessScope: "user-read-currently-playing user-modify-playback-state" +spotifyRedirectURI: "http://google.com/"} From a18f18efc5908e9050f49d4bbc6777eded3964d3 Mon Sep 17 00:00:00 2001 From: MySixSenses Date: Sat, 5 Sep 2020 10:23:16 -0700 Subject: [PATCH 3/4] Put all the options in options.json update ByeAds.py to allow --- ByeAds.py | 18 ++++++++++-------- options.json | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ByeAds.py b/ByeAds.py index c041d47..97b40a3 100644 --- a/ByeAds.py +++ b/ByeAds.py @@ -6,7 +6,7 @@ import spotipy import spotipy.util as util from pynput.keyboard import Key, Controller - +import json keyboard = Controller() @@ -37,13 +37,15 @@ def restartSpotify(): closeSpotify() openSpotify() playSpotify() - - -spotifyUsername = "#EnterUsernameHere" -spotifyClientID = "#EnterClientIDHere" -spotifyClientSecret = "#EnterClientSecretHere" -spotifyAccessScope = "user-read-currently-playing user-modify-playback-state" -spotifyRedirectURI = "http://google.com/" +#load options.json +with open('options.json', 'r') as f: + options = json.load(f) +#Set variables equal to options.json equivalent +spotifyUsername = options["spotifyUsername"] +spotifyClientID = options["#spotifyClientID"] +spotifyClientSecret = options["spotifyClientSecret"] +spotifyAccessScope = options["spotifyAccessScope"] +spotifyRedirectURI = options["spotifyRedirectURI"] def setupSpotifyObject(username, scope, clientID, clientSecret, redirectURI): token = util.prompt_for_user_token(username, scope, clientID, clientSecret, redirectURI) diff --git a/options.json b/options.json index e5ecffe..f8d6413 100644 --- a/options.json +++ b/options.json @@ -1,5 +1,5 @@ -{spotifyUsername: "#EnterUsernameHere" -spotifyClientID: "#EnterClientIDHere" -spotifyClientSecret: "#EnterClientSecretHere" -spotifyAccessScope: "user-read-currently-playing user-modify-playback-state" -spotifyRedirectURI: "http://google.com/"} +{"spotifyUsername": "#EnterUsernameHere", +"spotifyClientID": "#EnterClientIDHere", +"spotifyClientSecret": "#EnterClientSecretHere", +"spotifyAccessScope": "user-read-currently-playing user-modify-playback-state", +"spotifyRedirectURI": "http://google.com/"} From 215e93fd4a0cd27b51cfeda4b8e985d4ecc77de5 Mon Sep 17 00:00:00 2001 From: MySixSenses <66916362+MySixSenses@users.noreply.github.com> Date: Tue, 8 Sep 2020 09:04:19 -0700 Subject: [PATCH 4/4] Update ByeAds.py Fixed JSON error --- ByeAds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ByeAds.py b/ByeAds.py index 97b40a3..7679df9 100644 --- a/ByeAds.py +++ b/ByeAds.py @@ -42,7 +42,7 @@ def restartSpotify(): options = json.load(f) #Set variables equal to options.json equivalent spotifyUsername = options["spotifyUsername"] -spotifyClientID = options["#spotifyClientID"] +spotifyClientID = options["spotifyClientID"] spotifyClientSecret = options["spotifyClientSecret"] spotifyAccessScope = options["spotifyAccessScope"] spotifyRedirectURI = options["spotifyRedirectURI"]