Coder Social home page Coder Social logo

hahagu / ultrasonics-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xdgfx/ultrasonics-api

0.0 0.0 0.0 91 KB

API proxy for ultrasonics

License: GNU General Public License v3.0

Shell 0.47% Python 79.29% Makefile 0.78% HTML 18.22% Dockerfile 0.98% Procfile 0.25%

ultrasonics-api's Introduction


The api proxy for ultrasonics.

This is the source code for the ultrasonics-api proxy server. It's purpose is to store private api keys for services such as Spotify, Deezer, and Last.fm, while providing an endpoint for ultrasonics to access those apis.


Option 0: Use the official hosted ultrasonics-api.

There is an official hosted version at https://ultrasonics-api.herokuapp.com/api/. Feel free to use that instead of hosting your own version. Therefore, no setup is required, and you can get started on curating your perfect playlists. Or you can run it yourself, it's up to you ๐Ÿ˜Š.


Option 1: Host your own Heroku instance.

Just click the button below! Make sure you refer to environment variables.

Deploy

Or do it manually ๐Ÿ˜‰: Follow the official instructions after cloning this repo. You will need to use the environment variable USE_REDIS=True and also set up a Heroku Redis instance.

๐ŸŒค๏ธ This is actually a lot easier than those tutorials appear on first glance, you just need to create them both and get the correct URLs.

You can set up environment variables according to the official documentation. See environment variables.


Option 2: Use the official docker image.

Either make the image using the Dockerfile, or pull from the official repo: XDGFX/ultrasonics-api.

Recommended usage: docker-compose

version: "3.7"
services:
  ultrasonics-api:
    image: xdgfx/ultrasonics-api
    container_name: ultrasonics-api
    restart: unless-stopped

    ports:
      - 8003:8003

    environment:
      - PUID=${PUID}
      - PGID=${PGID}

      - SPOTIFY_CLIENT_ID=abc
      - SPOTIFY_CLIENT_SECRET=xyz

      - LASTFM_API_KEY=xyz

      - DEEZER_APP_ID=abc
      - DEEZER_APP_SECRET=xyz

Option 3: Host ultrasonics-api on your own hardware (or a virtual machine).

Disclaimer: I have only tested this on Linux ๐Ÿง. It should work fine on macOS or Windows, but some steps might be different.

  1. Clone the repo to your computer.
  2. I would recommend creating a virtual environment (python3 -m venv .venv to create an environment in the folder .venv, then activate it with source .venv/bin/activate).
  3. Install the Python dependencies with pip3 install -r requirements.txt.
  4. Create a .env file, and fill it with the required environment variables. See environment variables.
  5. You can run your own Redis instance and connect to it, but if you're not threaded you might as well disable it with USE_REDIS = False for a cleaner install.
  6. Run it by executing app.sh. You may prefer to run it as a service instead.

Environment Variables

These environment variables can be applied to your Heroku instance, or saved in a .env file in this directory.

If you don't use a service, you can remove it's environment variables.

Most services require you to get an api key / secret by creating an account and setting up an application. Documentation for each service can be found below.


Finding API Keys

App Link Notes
Spotify https://developer.spotify.com Refer to "Set Up Your Account" and "Register Your Application".
Last.fm https://www.last.fm/api
Deezer https://developers.deezer.com/myapps/

.env file

FLASK_APP=ultrasonics_api

USE_REDIS=False
REDIS_URL=[Only if USE_REDIS=True]

SPOTIFY_CLIENT_ID=abc
SPOTIFY_CLIENT_SECRET=xyz

LASTFM_API_KEY=abc

DEEZER_APP_ID=abc
DEEZER_APP_SECRET=xyz

ultrasonics-api's People

Contributors

xdgfx avatar hahagu 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.