rm-dev-null commited on
Commit
7cec5a0
·
verified ·
1 Parent(s): a383192

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,7 +4,7 @@ from pydub import AudioSegment
4
  import shazamio
5
  import os
6
  import time
7
-
8
  # Replace with your actual client ID and client secret
9
  client_id = os.environ.get('SOUNDCLOUD_CLIENT_ID')
10
  client_secret = os.environ.get('SOUNDCLOUD_CLIENT_SECRET')
@@ -12,7 +12,8 @@ client_secret = os.environ.get('SOUNDCLOUD_CLIENT_SECRET')
12
  def get_soundcloud_access_token(client_id, client_secret):
13
  auth_string = f'{client_id}:{client_secret}'
14
  auth_headers = {
15
- 'Authorization': 'Basic ' + base64.b64encode(auth_string.encode()).decode()
 
16
  }
17
  data = {
18
  'grant_type': 'client_credentials'
@@ -44,7 +45,7 @@ async def identify_track(shazam, audio_chunk):
44
  return None
45
 
46
  async def process_dj_set(track_url, progress=gr.Progress()):
47
- access_token = get_soundcloud_access_token(client_id, client_secret)
48
  headers = {
49
  'Authorization': 'Bearer ' + access_token
50
  }
 
4
  import shazamio
5
  import os
6
  import time
7
+ token = os.environ.get('TOKEN')
8
  # Replace with your actual client ID and client secret
9
  client_id = os.environ.get('SOUNDCLOUD_CLIENT_ID')
10
  client_secret = os.environ.get('SOUNDCLOUD_CLIENT_SECRET')
 
12
  def get_soundcloud_access_token(client_id, client_secret):
13
  auth_string = f'{client_id}:{client_secret}'
14
  auth_headers = {
15
+ #'Authorization': 'Basic ' + base64.b64encode(auth_string.encode()).decode()
16
+ 'Authorization': 'Basic ' + token
17
  }
18
  data = {
19
  'grant_type': 'client_credentials'
 
45
  return None
46
 
47
  async def process_dj_set(track_url, progress=gr.Progress()):
48
+ access_token = token
49
  headers = {
50
  'Authorization': 'Bearer ' + access_token
51
  }