https://github.com/dammyaa7/song-recommendations

https://github.com/dammyaa7/song-recommendations

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.0%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: DammyAA7
  • Language: JavaScript
  • Default Branch: heroku
  • Size: 599 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed 11 months ago
Metadata Files
Readme

README.md

SPOTIFY FRIEND SONG RECOMMENDATION TOOL

Discover Music, Share Joy, Connect Instantly

last-commit repo-top-language repo-language-count

A Flask-based API that leverages the Spotify Web API for user authentication and song recommendations. The application uses a PostgreSQL(Supabase) database to store user data, recommendations, and OAuth tokens.


Features

  • Spotify OAuth 2.0 Integration: Securely authenticate users via their Spotify accounts.
  • Persistent Sessions: Keeps users logged in across sessions.
  • Token Management: Automatically handles refreshing of expired access tokens.
  • User Profile: Fetches and stores user profile information from Spotify.
  • Chrome Extension: A companion browser extension to interact with the API from the browser.
  • Song Recommendations:
    • Recommend songs to other users.
    • Get recommendations from other users.
    • Get recommendations based on an artist's genre.

Technologies

Built with the tools and technologies:

Flask HTML5 CSS3 JavaScript Supabase Heroku Python

Prerequisites

  • Python 3.8 or higher
  • pip for package management
  • A PostgreSQL database instance (the free tier from Supabase is a good option)
  • A Spotify Developer account and an application to get API credentials.

Installation & Setup

Backend

  1. Clone the repository

    bash git clone https://github.com/DammyAA7/song-recommendations.git cd song-recommendations

  2. Create and activate a virtual environment

    bash python3 -m venv .venv source .venv/bin/activate # On macOS/Linux .venv\Scripts\activate.bat # On Windows

  3. Install dependencies

    bash pip install -r requirements.txt

  4. Set up Environment Variables

    Create a file named .env in the root of the project and add the following variables. These are essential for connecting to the database and the Spotify API.

    ```ini

    PostgreSQL Database URL

    DATABASEURL="postgresql://USER:PASSWORD@HOST:PORT/DATABASENAME"

    Spotify API Credentials

    SPOTIFYCLIENTID="yourspotifyclientid" SPOTIFYCLIENTSECRET="yourspotifyclientsecret" SPOTIFYREDIRECTURI="http://127.0.0.1:5000/callback"

    Flask Session Secret Key

    SESSIONSECRETKEY="astrongandrandomsecret_key" ```

    Note: For the SPOTIFY_REDIRECT_URI, make sure to add this exact URI to your Spotify application settings on the developer dashboard.

  5. Database Setup

    The schema.sql file contains the necessary SQL commands to create the database tables. Connect to your PostgreSQL instance and run the script.

    bash psql -d YOUR_DATABASE_NAME -a -f schema.sql

  6. Run the application

    bash flask run

    The server will run at http://127.0.0.1:5000/.

Chrome Extension

  1. Open Chrome and navigate to chrome://extensions.
  2. Enable Developer mode by toggling the switch in the top-right corner.
  3. Click on the "Load unpacked" button.
  4. Select the Extension folder from this project's directory.

API Endpoints

Authentication

  • GET /login

    Initiates the Spotify authentication process. Returns a JSON object with the Spotify authorization URL.

  • GET /callback

    The redirect URI after the user authorizes the application on Spotify. It exchanges the authorization code for an access token and refresh token, stores them, and fetches the user's profile.

  • GET /check_auth

    Checks if the current user is authenticated. Requires a valid session cookie.

  • POST /logout

    Logs the user out by clearing the session.

Recommendations

  • PUT /recommend

    Recommends a song to another user. Requires a JSON body with user_id, friend_id, and song_id.

  • GET /recommend/user/<user_id>

    Gets a list of songs recommended to a specific user.

  • GET /recommend/artist/<song_id>

    Gets song recommendations based on the genre of the artist of the given song_id.


License

This project is released under the MIT License. Feel free to copy, modify, and share.

Owner

  • Name: Oluwadamilola Adebayo
  • Login: DammyAA7
  • Kind: user

GitHub Events

Total
  • Push event: 28
Last Year
  • Push event: 28