Closed h0lybyte closed 4 months ago
[DEBUG] Processing Music Action
Atlas Music Response:
{
"id": "chatcmpl-692ee75c-cb57-4b81-94c4-cf199252e216",
"object": "chat.completion",
"created": 1719067920,
"model": "mixtral-8x7b-32768",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Sure, here is a Python script that meets your requirements:\n\n```python\nimport re\n\ngenres = ['dnb', 'chillstep', 'lofihiphop', 'nujazz', 'electroswing', 'edm', 'rock', 'jrock', 'studybeats', 'anime']\n\ntitle = input(\"Enter the song title with the band/artist: \")\ngenre = input(\"Enter the genre (select from the specified set): \").lower()\nwhile genre not in genres:\n print(\"Invalid genre. Please select from:\", genres)\n genre = input(\"Enter the genre (select from the specified set): \").lower()\n\nyoutube_link = input(\"Enter the YouTube link: \")\nmatch = re.search(r\"v=([-\\w]+)\", youtube_link)\nif match:\n youtube_id = match.group(1)\nelse:\n print(\"Invalid YouTube link.\")\n youtube_link = input(\"Enter the YouTube link: \")\n match = re.search(r\"v=([-\\w]+)\", youtube_link)\n if match:\n youtube_id = match.group(1)\n else:\n print(\"Could not extract YouTube ID.\")\n youtube_id = None\n\nif youtube_id:\n print(\"\\nOutput:\\n\")\n result = {\n \"title\": title,\n \"genre\": genre,\n \"youtube_id\": youtube_id\n }\n print(result)\n```\n\nThis script prompts the user to input a song title, genre, and YouTube link, and extracts the YouTube ID from the link. It also checks if the genre is one of the specified genres, and if the YouTube link is valid. If everything is correct, it outputs the JSON as specified.\n\nHere's an example of the script's output:\n```vbnet\nEnter the song title with the band/artist: Porter Robinson & Madeon - Shelter\nEnter the genre (select from the specified set): edm\nEnter the YouTube link: https://www.youtube.com/watch?v=HQnC1UHBvWA\n\nOutput:\n\n{'title': 'Porter Robinson & Madeon - Shelter', 'genre': 'edm', 'youtube_id': 'HQnC1UHBvWA'}\n```"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 340,
"prompt_time": 0.072327767,
"completion_tokens": 552,
"completion_time": 0.855881091,
"total_tokens": 892,
"total_time": 0.928208858
},
"system_fingerprint": "fp_c5f20b5bb1",
"x_groq": {
"id": "req_01j106xgqkeh3t20z2s0z28jjb"
}
}
Dear Lord Commander:
Sure, here is a Python script that meets your requirements:
```python
import re
genres = ['dnb', 'chillstep', 'lofihiphop', 'nujazz', 'electroswing', 'edm', 'rock', 'jrock', 'studybeats', 'anime']
title = input("Enter the song title with the band/artist: ")
genre = input("Enter the genre (select from the specified set): ").lower()
while genre not in genres:
print("Invalid genre. Please select from:", genres)
genre = input("Enter the genre (select from the specified set): ").lower()
youtube_link = input("Enter the YouTube link: ")
match = re.search(r"v=([-\w]+)", youtube_link)
if match:
youtube_id = match.group(1)
else:
print("Invalid YouTube link.")
youtube_link = input("Enter the YouTube link: ")
match = re.search(r"v=([-\w]+)", youtube_link)
if match:
youtube_id = match.group(1)
else:
print("Could not extract YouTube ID.")
youtube_id = None
if youtube_id:
print("\nOutput:\n")
result = {
"title": title,
"genre": genre,
"youtube_id": youtube_id
}
print(result)
This script prompts the user to input a song title, genre, and YouTube link, and extracts the YouTube ID from the link. It also checks if the genre is one of the specified genres, and if the YouTube link is valid. If everything is correct, it outputs the JSON as specified.
Here's an example of the script's output:
Enter the song title with the band/artist: Porter Robinson & Madeon - Shelter
Enter the genre (select from the specified set): edm
Enter the YouTube link: https://www.youtube.com/watch?v=HQnC1UHBvWA
Output:
{'title': 'Porter Robinson & Madeon - Shelter', 'genre': 'edm', 'youtube_id': 'HQnC1UHBvWA'}
Extracted Song Information:
Unable to extract song information from the response.
Music Suggestion Form
YouTube Link: https://www.youtube.com/watch?v=HQnC1UHBvWA Title: Porter Robinson & Madeon - Shelter Genre: edm
Hint: Only genres that are acceptable are: dnb, chillstep, lofihiphop, nujazz, electroswing, edm, rock, jrock, studybeats, anime