Giter Site home page Giter Site logo

audio-file-server's Introduction

Audio-File-Server

Setup codebase

  1. Clone code: git clone https://github.com/fahad39039/Audio-File-Server.git
  2. Navigate to the cloned directory.
  3. Install virtual environment if not installed -> pip install virtualenv
  4. Create virtual environment -> virtualenv <env_name>
  5. Install all project requirements -> pip install -r requirements.txt

Create database

  1. In mysql create database "audiofileproject"
  2. Database connection string -> mysql://<username>:<password>@<host>/<db_name>
    In my case this is mysql://root:root@localhost/audiofileproject

Run flask app

  1. Run flask app using these commands:
    1. set FLASK_APP=main.py
    2. flask run

How to test APIs by postman

  1. create_file api
url = /create 
method = Post
content-type=application/json

Body for song

 {
  "audioFileType":"song",
  "audioFileMetadata":{
      "duration_in_sec":30,
      "name":"Test song"
      }
  }

Body for podcast

{
      "audioFileType":"podcast",
      "audioFileMetadata":{
              "duration_in_sec":100,
              "name":"Test song 2",
              "host":"Test Host",
              "participants":["P1", "P2"]
              }
      }

Body for audiobook

{
      "audioFileType":"audiobook",
      "audioFileMetadata":{
              "duration_in_sec":200,
              "title":"Test Title",
              "author":"Test Author",
              "narrator":"Test Nar"
      }
  }
  1. delete_file_by_id api
url = /delete/<audio_file_type>/<audio_file_id> 
method = Delete
content-type=application/json

Example ->
1. /delete/song/1
2. /delete/podcast/1
2. /delete/audiobook/1

  1. update_file_by_id api
url = /update/<audio_file_type>/<audio_file_id> 
method = Delete
content-type=application/json

Body for song

 {
  "audioFileType":"song",
  "audioFileMetadata":{
      "duration_in_sec":32,
      "name":"Test song 34"
      }
  }

Body for podcast

{
      "audioFileType":"podcast",
      "audioFileMetadata":{
              "duration_in_sec":109,
              "name":"Test song 24",
              "host":"Test Host 1",
              "participants":["P1", "P2"]
              }
      }

Body for audiobook

{
      "audioFileType":"audiobook",
      "audioFileMetadata":{
              "duration_in_sec":201,
              "title":"Test Title 1",
              "author":"Test Author 3",
              "narrator":"Test Nar 1"
      }
  }
  1. get_files api
url = /get/<audio_file_type>/<audio_file_id> **OR** /get/<audio_file_type>
method = GET
content-type=application/json

Example->
/get/song - returns all song stored in database
/get/song/1 - get a song whose id is 1

audio-file-server's People

Contributors

fahad39039 avatar

Watchers

 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.