omer8882 / radio-plays-tracker

Radio Plays Tracker is an application designed to fetch and track music plays from various radio stations using Spotify playlists and store them in an Elasticsearch database.
https://MaHushma.com
1 stars 2 forks source link

Radio Plays Tracker (MaHushma.com)

Overview

This repository contains the complete source code for MaHushma.com, a passion project made for archiving and displaying everything played on selected radio stations. The project actively recognizes songs, logs them into a database, and presents the data through a user-friendly WebUI where users can view and analyze radio play statistics.

Key Features

Project Structure

Recognizer

A Python process that actively listens to selected radio stations and recognizes which songs are playing at any given moment (using shazamio), extracts more details about the song (using spotify api) and stores the data in an Elasticsearch database.

backend/recognize/

Server

A Python process handling WebAPI requests using Uvicorn and Swagger to poll existing data from the Elasticsearch database (To be used by the WebUI)

backend/data_poll/

Frontend

A React WebUI showing a variery of ways to view what played on the radio and interact with that data.

Installation Instructions

Backend Setup

  1. Clone the repository:

    git clone https://github.com/omer8882/radio-plays-tracker.git
    cd radio-plays-tracker/backend
  2. Install dependencies:

    pip install -r data_poll/requirements.txt
  3. Configure:

    • Update the recognize/config.json file with the necessary settings for your environment, including the radio stations to monitor and Elasticsearch configurations.
      {
      "spotify": {
          "access_token": "***secret***",
          "client_id": "***secret***",
          "client_secret": "***secret***"
      },
      "elastic": {
          "url": "http://localhost:9200",
          "user": "elastic",
          "password": "password"
      },
      "stations": [
      {
          "name": "glglz",
          "stream_url": "https://glzwizzlv.bynetcdn.com/glglz_mp3",
          "last_song_recorded": /* Used by Recognizer */
      },
      {
          "name": "radius100",
          "stream_url": "https://cdn.cybercdn.live/Radios_100FM/Audio/icecast.audio",
          "last_song_recorded": /* Used by Recognizer */,
          "live_intro": 5 //(Seconds) if the stream url has a station intro for every time it opens
      }
      // Add more stations as needed
      ]
      }
  4. Run the Backend Services:

    • Start the recognition service:
      python recognize/recognizer.py
    • Start the data polling service (See all avalable API endpoints in http://localhost:5000/docs#/):
      python data_poll/run.py

Frontend Setup

  1. Navigate to the frontend directory: cd radio-plays-tracker/frontend/radio-plays-tracker
  2. Install dependencies: npm install
  3. Run the frontend server: npm start
  4. Access in your web browser at http://localhost:3000.

Contributing

Contributions are welcome! If you'd like to help improve this project, please fork the repository and submit a pull request. Make sure to follow the code style and write clear commit messages.

License

This project is licensed under the MIT License. See the LICENSE file for details.