{"id":28875916,"url":"https://github.com/extractoro/mood-2-mix","last_synced_at":"2026-02-04T12:02:52.891Z","repository":{"id":299767857,"uuid":"1004129809","full_name":"Extractoro/mood-2-mix","owner":"Extractoro","description":"Emotion-Based Playlist Generator","archived":false,"fork":false,"pushed_at":"2025-06-29T09:52:28.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-08T05:05:00.953Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Extractoro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-18T06:54:22.000Z","updated_at":"2025-06-29T09:52:31.000Z","dependencies_parsed_at":"2025-07-08T04:40:16.200Z","dependency_job_id":"990f63e2-d144-4a96-aba1-562704fa907e","html_url":"https://github.com/Extractoro/mood-2-mix","commit_stats":null,"previous_names":["extractoro/mood-2-mix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Extractoro/mood-2-mix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Extractoro%2Fmood-2-mix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Extractoro%2Fmood-2-mix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Extractoro%2Fmood-2-mix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Extractoro%2Fmood-2-mix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Extractoro","download_url":"https://codeload.github.com/Extractoro/mood-2-mix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Extractoro%2Fmood-2-mix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29084088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-20T16:41:18.487Z","updated_at":"2026-02-04T12:02:52.849Z","avatar_url":"https://github.com/Extractoro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mood2Mix 🎧\n\nFull-stack FastAPI-based service that analyzes the user’s emotional prompt using GPT and recommends music tracks accordingly. It integrates with YouTube Music and Spotify to recommend or create playlists, using OpenAI, ytmusicapi, and Spotify Web API. Async-ready, Dockerized, and structured for scalability.\n\n## Table of Contents\n\n* [✨ Features](#-features)\n* [🛠 Project Structure](#-project-structure)\n* [⚙️ Getting Started](#-getting-started)\n\n  * [1. Clone the Repository](#1-clone-the-repository)\n  * [2. Configure Environment](#2-configure-environment)\n  * [3. Run with Docker](#3-run-with-docker)\n* [🧪 Testing](#-testing)\n* [📊 API Endpoints](#-api-endpoints)\n\n  * [🎭 Mood Analysis](#-mood-analysis)\n  * [🎵 Recommendations](#-recommendations)\n  * [🎧 Spotify Integration](#-spotify-integration)\n* [🔍 Interactive Docs](#-interactive-docs)\n\n## ✨ Features\n\n* 🎭 Analyze free-form emotional text using OpenAI (GPT-4o)\n* 📈 Extract mood, valence, energy, genres, and a music query\n* 🎶 Recommend music from YouTube Music and/or Spotify\n* 🧠 GPT-based intelligent search query generation\n* ✅ Async FastAPI backend with exception handling\n* 🎧 Spotify playlist creation \u0026 track addition support\n* 🛠 Dockerized environment\n* 🔑 OAuth 2.0 authentication for Spotify\n* 🔍 Swagger + ReDoc interactive documentation\n\n## 🛠 Project Structure\n\n```\n🔹 gpt/\n🔹 └── mood_analyzer.py        # GPT prompt logic\n🔹 music_providers/\n🔹 ├── base.py                 # Abstract music provider\n🔹 ├── spotify.py              # Spotify integration\n🔹 └── ytmusic.py              # YouTube Music integration\n🔹 routes/\n🔹 ├── mood.py                 # Mood analysis routes\n🔹 ├── recommend.py            # Song recommendation endpoint\n🔹 └── spotify.py              # Spotify-related endpoints\n🔹 utils/\n🔹 ├── get_spotify_token_from_header.py  # Extract Bearer token\n🔹 └── spotify_list_ids.py               # Map tracks to Spotify URIs\n🔹 schemas/\n🔹 ├── schemas.py              # Pydantic models\n🔹 └── enums.py                # Enum for music providers\n🔹 .env\n🔹 docker-compose.yml\n🔹 Dockerfile\n🔹 README.md\n```\n\n## ⚙️ Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/Extractoro/mood-2-mix.git\ncd mood2mix\n```\n\n### 2. Configure Environment\n\nCreate a `.env` file:\n\n```\nOPENAI_API_KEY=your_openai_key\nSPOTIFY_CLIENT_ID=your_client_id\nSPOTIFY_CLIENT_SECRET=your_client_secret\nSPOTIFY_USER_ID=your_user_id\nREDIRECT_URI=http://127.0.0.1:8000/callback\n```\n\n### 3. Run with Docker\n\n```bash\ndocker-compose up --build\n```\n\n## 🧪 Testing\n\n```bash\npytest/tests\nflake8 .\n```\n\n## 📊 API Endpoints\n\n### 🎭 Mood Analysis\n\n| Method | Endpoint                    | Description                     |\n| ------ | --------------------------- | ------------------------------- |\n| POST   | /mood/analyze               | Analyze emotional text          |\n| POST   | /mood/analyze-and-recommend | Analyze and get recommendations |\n\n### 🎵 Recommendations\n\n| Method | Endpoint         | Description                    |\n| ------ | ---------------- | ------------------------------ |\n| POST   | /recommend/songs | Recommend songs from mood data |\n\n### 🎧 Spotify Integration\n\n| Method | Endpoint                       | Description                           |\n| ------ | ------------------------------ | ------------------------------------- |\n| GET    | /spotify/auth/link             | Get Spotify auth URL                  |\n| GET    | /spotify/callback              | Exchange code for token               |\n| POST   | /spotify/create-playlist       | Create a new playlist                 |\n| POST   | /spotify/{playlist\\_id}/tracks | Add tracks to a playlist              |\n| POST   | /spotify/prompt-to-playlist    | Full flow: prompt → tracks → playlist |\n\n## Moods examples\n### 🎧 Example 1: Neutral, relaxing\n\u003e It was just an ordinary day. I had some coffee, did a bit of work, and enjoyed the quiet. No rush, no noise.\n\n---\n\n### 🎵 Example 2: Happy, uplifting\n\u003e Finally finished the project! It feels like a huge weight has been lifted. I’m so full of energy — I could jump for joy!\n\n---\n\n### 🌧 Example 3: Sad, melancholic\n\u003e Everything feels so empty. It’s been raining all day, and my thoughts keep drifting… I feel kind of lost.\n\n---\n\n### 😠 Example 4: Frustrated, tense\n\u003e I’m so fed up! These constant crashes and deadlines are driving me crazy. I just can’t deal with this mess anymore.\n\n---\n\n### 😌 Example 5: Calm, peaceful\n\u003e I sat by the window with a book while the setting sun filled the room with soft light. Total peace.\n\n\n## 🔍 Interactive Docs\n\n* Swagger → [http://localhost:8000/docs](http://localhost:8000/docs)\n* ReDoc → [http://localhost:8000/redoc](http://localhost:8000/redoc)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextractoro%2Fmood-2-mix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextractoro%2Fmood-2-mix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextractoro%2Fmood-2-mix/lists"}