![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A Node.js module to generate song playlists using OpenAI's GPT and Spotify's API.
songpt is a Node.js package that generates tracks for music playlists fitting input prompts.
Input prompts may either be string prompts ("keywords") or a list of already present songs. songpt attempts to extract a common category among the given songs. Additionally, the package has functions to query the returned song title names against Spotify and to create playlists based on the generated suggestions.
CAUTION: songpt uses the experimental fetch introduced in Node.js v17. Usage of v18 LTS or above is required.
You can find a web platform using songpt here: songpt.ai. The platform allows you to generate playlists based on text input. It requires access to an OpenAI API key to work. The sources can be found in this repository: songpt-ai.
To try out the package locally, clone this repository. songpt comes preloaded with a script to try out the functionality. You can find it at test/tryout.js
.
To run the script, fill in the parameters in package.json
:
"scripts": {
"tryout": "node test/tryout.js <openai-api-key> <spotify-credentials> <spotify-refresh-token> <spotify-account-id>"
},
Legend:
<openai-api-key>
- Your key to use the OpenAI API. Can be found here. Required for generation of song suggestions.<spotify-credentials>
- The Base64 encoded credentials to your Spotify application. To use Spotify features, you will need to create a Spotify application and retrieve a client ID and secret. Can be found on the Spotify Developer Dashboard.<spotify-refresh-token>
- The refresh token to use to access the account that playlists should be created for. To generate this, log in to the Spotify application you created, and capture the refresh token. Make sure that the scopes given include playlist-modify-private and playlist-modify-public.<spotify-account-id>
- The account ID of your Spotify account. Make sure it is the same account as the one you used to generate a refresh token, as playlist will be generated using this account.To try out the module, fill in the values above and run the following:
npm tryout
If the input you provided was valid, it will return the following (including your inputs):
> node test/tryout.js <openai-api-key> <spotify-credentials> <spotify-refresh-token> <spotify-account-id>
Created a Spotify playlist:
https://open.spotify.com/playlist/3XHZbb4kigkRugbatTukPP
Created a Spotify playlist:
https://open.spotify.com/playlist/3zKef1uHMd1BPCJLIddYJw
The playlist links generated are playlists in the account given generated based on the tryout.js
script.
To use songpt in your Node.js application, run the following in your root project directory:
npm install songpt
The package exports multiple different functions to interact with OpenAI and Spotify to generate and store playlists.
These function represent the whole flow from start to finish to generate and store playlists based on certain inputs. Use these if you only want to generate Spotify playlists without worrying about the underlying logic.
generatePlaylistBasedOnKeywords("openAiApiKey", "spotifyCredentials", "spotifyRefreshToken", "spotifyAccountId", "A good playlist name", "A good playlist description", "Jazz music, but fast")
generatePlaylistBasedOnSongs("openAiApiKey", "spotifyCredentials", "spotifyRefreshToken", "spotifyAccountId", "A good playlist name", "A good playlist description", ["Circles Post Malone", "Humble Kendrick Lamar", "Congratulation Post Malone"]) => {
These functions return the names of songs and artists based on given inputs. This is the part of songpt that interacts with OpenAI and is used only for generating suggestions, without translating them to Spotify playlists or tracks.
generateSuggestionsBasedOnKeywords("openAiApiKey", "Jazz music, but fast", "Jazz", 10, "gpt-4o-mini",)
generateSuggestionsBasedOnSongs("openAiApiKey", ["Circles Post Malone", "Humble Kendrick Lamar", "Congratulation Post Malone"], "Rap", 10, "gpt-4o-mini",)
The following functions interact with Spotify, to query for generated tracks or to create playlists. The first two functions generate access tokens that are required for the usage of the latter functions.
getSpotifyAccessToken("spotifyCredentials")
getSpotifyAccountAccessToken("spotifyCredentials", "spotifyRefreshToken")
searchSpotifyTracks("Circles Post Malone", "accessToken")
getSpotifyTrackForTitle("Circles Post Malone", "accessToken")
createSpotifyPlaylist("A good playlist name", "A good playlist description", ["1bM6X2PZUVCJvUGlSXaaqE", "3FtQes77xlbS9QTVts7p2u"], false, "spotifyAccountId", "spotifyAccountAccessToken")
FAQs
A Node.js module to generate song playlists using OpenAI's GPT and Spotify's API.
We found that songpt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.