Cloud Music Player for Distributed Systems Coursework
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md

README.md

Cloud Music Player (335)

Cloud Music Player for Distributed Systems Coursework. Just a README for now.

Usage

Web Interface

The web interface can be used by visiting http://shell1.doc.ic.ac.uk:53231/CourseWork/

API

Get Playlists

Returns all the available playlists

Method GET
Endpoint MusicManagementService?action=get-playlists
Example Call
curl -X GET \
    "http://shell1.doc.ic.ac.uk:53231/CourseWork/MusicManagementService?action=get-playlists"
Response
{"playlists":["ph-test"]}

Create Playlist

Creates a playlist with the given name

Method POST
Endpoint MusicManagementService?action=create-playlist
URL Params
playlist-name
The name of the playlist to create
Example Call
curl -X POST \
    "http://shell1.doc.ic.ac.uk:53231/CourseWork/MusicManagementService?action=create-playlist
        &playlist-name=ph-npl"
Response
{"result":"Playlist Created"}

Or, if an error occurred (duplicates etc), returns HTTP response code
400 Bad Request
and response content:
{"result":"Playlist Couldn't be Created"}

Delete Playlist

Deletes a playlist and all it's music

Method DELETE
Endpoint MusicManagementService?action=delete-playlist
URL Params
playlist-name
The name of the playlist to delete
Example Call
curl -X DELETE \
    "http://shell1.doc.ic.ac.uk:53231/CourseWork/MusicManagementService?action=delete-playlist
        &playlist-name=ph-npl"
Response
{"result":"Playlist Deleted"}

Or, if the playlist doesn't exist, a
400 Bad Request
and response:
{"result":"Playlist Couldn't be Found"}

Get Tracks

Creates a playlist with the given name

Method GET
Endpoint MusicManagementService?action=get-tracks
URL Params
playlist-name
The name of the playlist to get tracks from
Example Call
curl -X GET \
    "http://shell1.doc.ic.ac.uk:53231/CourseWork/MusicManagementService?action=get-tracks
        &playlist-name=ph-test"
Response
{"tracks":["sample.mp3"]}

Or, if the playlist doesn't exist, a
400 Bad Request
and response:
{"result":"Playlist Couldn't be Found"}

Delete Track in Playlist

Deletes a track in a specified playlist

Method DELETE
Endpoint MusicManagementService?action=delete-track
URL Params
playlist-name
The name of the playlist the track belongs to
file-name
The name of the track file
Example Call
curl -X DELETE \
    "http://shell1.doc.ic.ac.uk:53231/CourseWork/MusicManagementService?action=delete-track
        &playlist-name=ph-test
        &file-name=sample.mp3"
Response
{"result":"Deleted Music File"}

Or, if the playlist doesn't exist, a
400 Bad Request
and response:
{"result":"Playlist Couldn't be Found"}

Stream Track

Streams a track to the browser

Method GET
Endpoint MusicStreamServer
URL Params
playlist-name
The name of the playlist the track belongs to
file-name
The name of the track file
Example Call
curl -X GET \
    "http://shell1.doc.ic.ac.uk:53231/CourseWork/MusicStreamServer
        ?playlist-name=ph-test
        &file-name=sample.mp3"
Response The music stream

Deployment

Original CSG Guide

On a lab machine: mktomcat6 TOMCAT_TARGET_DIR Change the port by editing conf/server.xml, changing the value in the Connector tag but not in the Server tag.

  1. cp WAR_FILE TOMCAT_TARGET_DIR/webapps
  2. cd TOMCAT_TARGET_DIR
  3. tomcat6 start