Skip to content

Commit

Permalink
.env
Browse files Browse the repository at this point in the history
  • Loading branch information
Romano-Garmez committed Oct 15, 2024
1 parent 549862d commit 3d06f3f
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
import sys
import re

debug = False

if debug:
# Load environment variables from .env file
from dotenv import load_dotenv

load_dotenv() # take environment variables from .env.

app = Flask(__name__)
app.config["SECRET_KEY"] = os.urandom(64)
app.config["SESSION_TYPE"] = "filesystem"
Expand Down Expand Up @@ -97,6 +105,7 @@ def currently_playing():
)
return render_template("not_playing.html")


# debugging
@app.route("/debug")
def debug():
Expand Down Expand Up @@ -126,11 +135,11 @@ def current_track_xhr():
duration = track["item"]["duration_ms"]
progress = track["progress_ms"]

try:
try:
liked = spotify.current_user_saved_tracks_contains(tracks=[song_id])[0]
except spotipy.exceptions.SpotifyException:
liked = False

else:
spotapi_currently_playing = False
currently_playing = request.args.get("currently_playing") == "True"
Expand All @@ -141,15 +150,22 @@ def current_track_xhr():
duration = 0
progress = 0
liked = False

# getting more info to pass through to page

currently_playing = spotapi_currently_playing

return_array = {"progress": progress, "duration": duration, "same_track": same_track, "currently_playing": currently_playing, "liked": liked}
return_array = {
"progress": progress,
"duration": duration,
"same_track": same_track,
"currently_playing": currently_playing,
"liked": liked,
}

return return_array


# end of html pages, now just assorted methods


Expand Down

0 comments on commit 3d06f3f

Please sign in to comment.