Liphos commited on
Commit
5a09b7f
·
verified ·
1 Parent(s): ec6f741

Restore music problem

Browse files
Files changed (1) hide show
  1. app.py +7 -17
app.py CHANGED
@@ -57,22 +57,12 @@ def play_audio_from_url(url):
57
  pygame.time.Clock().tick(10)
58
 
59
  @tool
60
- def play_preview_deezer(track: str, artist:str):
61
- name = "play_music"
62
- description = (
63
- "Play the preview of the music given the name of the track and the artist. Use this to play music."
64
- )
65
- inputs = {
66
- "track": {
67
- "type": "string",
68
- "description": "The name of the track.",
69
- },
70
- "artist": {
71
- "type": "string",
72
- "description": "The name of the artist.",
73
- }
74
- }
75
- output_type = "audio"
76
 
77
  # Define the API endpoint
78
  url = "https://api.deezer.com/search"
@@ -98,7 +88,7 @@ def play_preview_deezer(track: str, artist:str):
98
  print(f"link: {first_track['link']}")
99
  # Play the track
100
  print("Playing preview: ", first_track['preview'])
101
- return first_track['preview']
102
  else:
103
  print("No tracks found.")
104
  else:
 
57
  pygame.time.Clock().tick(10)
58
 
59
  @tool
60
+ def play_preview_deezer(track: str, artist:str) -> None:
61
+ """Play a preview of a track from Deezer.
62
+ Args:
63
+ track: The track to play.
64
+ artist: The artist of the track.
65
+ """
 
 
 
 
 
 
 
 
 
 
66
 
67
  # Define the API endpoint
68
  url = "https://api.deezer.com/search"
 
88
  print(f"link: {first_track['link']}")
89
  # Play the track
90
  print("Playing preview: ", first_track['preview'])
91
+ play_audio_from_url(first_track['preview'])
92
  else:
93
  print("No tracks found.")
94
  else: