Code Monkey home page Code Monkey logo

chatgptify's Introduction

ChatGPTify = ๐Ÿค– ChatGPT x Spotify ๐ŸŽง

Maybe you have already tried asking for song recommendations to ChatGPT, but wouldn't it be nice if you could listen the playlists recommended based on your music taste directly on your Spotify account?

ChatGPT Playlist reasoning: The playlist "Electronic Odyssey" consists of electronic dance music tracks that share several common themes, musical elements, and features. These tracks are characterized by their pulsing beats, hypnotic rhythms, and driving basslines that create an intense and immersive listening experience. One common theme in this playlist is the use of repetition, which is a hallmark of electronic music. The tracks often feature looping melodies, hypnotic arpeggios, and other repetitive elements that create a sense of momentum and progression. This repetition is often used to build tension and energy, leading to cathartic drops and climactic moments. Another common feature of these tracks is their use of synthesizers and other electronic instruments to create a wide range of sounds and textures. The tracks often feature lush pads, soaring leads, and intricate percussion that are layered and manipulated to create complex and evolving soundscapes.

This repository is built with Python and uses spotipy and chatgpt-wrapper for creating playlists based on user prompts via ChatGPT model.

Installation

Step 1: Create an OpenAI account

Step 2: Generate Spotify Client ID & Secret Key

Step 3: Install dependencies

pip install spotipy
pip install git+https://github.com/mmabrouk/chatgpt-wrapper
playwright install firefox
chatgpt install

This will then open up a browser window. Log in to ChatGPT in the browser window, walk through all the intro screens and then exit.

1> /exit

Note: If you encounter any issues regarding ChatGPT wrapper installation, please refer to chatgpt-wrapper.

Step 4: Setup credentials

This can be done via executing the following commands on Terminal.

export SPOTIFY_CLIENT_ID="Spotify Client ID"
export SPOTIFY_CLIENT_SECRET="Spotify Client Secret"
export SPOTIFY_REDIRECT_URI="Redirect URI, e.g. http://localhost:8080"

OR, can be modified inside the Python script, spotify_playlist.py:

os.environ['SPOTIFY_CLIENT_ID']     = "Spotify Client ID"
os.environ['SPOTIFY_CLIENT_SECRET'] = "Spotify Client Secret"
os.environ['SPOTIFY_REDIRECT_URI']  = "Redirect URI"

Important: Make sure to set the same Redirect URI on your Spotify Developer account as well. This can be done under Dashboard > App > Edit Settings > Redirect URIs.

Usage

For a sample usage of the script, run

python3 run.py

Examples

play = SpotifyPlaylist()

Ask for a playlist recommendation by setting prompt_type="playlist". Prompts will then automatically start with the phrase: "Provide a playlist containing songs "

You can complete the prompt as you wish, see examples:

  • "similar to the style of Quantic and Thievery Corporation without including these artists"
  • "falling under the genre downtempo and trip-hop"
play.ask_chatgpt(prompt="similar to the ones created by Daniel Avery", prompt_type="playlist")

You can then create and save the playlist:

play.create_playlist()
play.save_playlist()

Additionally you can ask for a playlist name and save the playlist under your account with this name, provide prompt_type="name":

play.ask_chatgpt(prompt="", prompt_type="name")
play.save_playlist(name=play.name)

You can also ask the reasoning behind this playlist by asking the common elements in these songs, no prompt_type required:

play.ask_chatgpt(prompt="What is the common theme, musical elements or features in this playlist? Explain in detail.")

Enjoy your new playlists!

chatgptify's People

Contributors

idilsulo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.