Socket
Socket
Sign inDemoInstall

musicplayer

Package Overview
Dependencies
51
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    musicplayer

API for the Music Player


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
3.91 MB
Created
Weekly downloads
 

Readme

Source


music player api

Music Player for Reddit API

Node.js wrapper around the API for the Music Player for Reddit.

An authentication token is required which you can get after logging in and clicking generate token.

Installation

npm install musicplayer

Usage

var MusicPlayerAPI = require('musicplayer')("YOUR_TOKEN");

MusicPlayerAPI.user.get(function(result) {
  if (result.status == false) return console.error(result.message);

  var user = result.data;
  console.log("I am logged in as " + user.name);
})

Play

  • get : Get the state of the player, true for playing
MusicPlayerAPI.play.get(function(result) {
  if (result.status == false) return console.error(result.message);
  console.log(result.data);
})
  • post : Toggles the state of the player
MusicPlayerAPI.play.post(function(result) {
  if (result.status == false) return console.error(result.message);
  console.log(result.success);
})

Forward

  • post : Skips to the next playable song
MusicPlayerAPI.forward.post();

Backward

  • post : Rewinds back to the previous playable song
MusicPlayerAPI.backward.post();

User

  • get : Gets the information from the logged in user
MusicPlayerAPI.user.get(function(result) {
  if (result.status == false) return console.error(result.message);

  var user = result.data;
  console.log("I am logged in as " + user.name);
})

Subreddits

  • get : Gets a list of subreddits
MusicPlayerAPI.subreddits.get(function(result) {
    if (result.status == false) return console.error(result.message);
    console.log(result.data);
})
  • post : Posts a list of subreddits
  • Arguments: {subreddits: "sub1+sub2"}
MusicPlayerAPI.subreddits.post({
    subreddits: "listentothis+music"
  }, function(result) {
    if (result.status == false) return console.error(result.message);
    console.log(result.subreddits);
})

Song

  • get : Gets information about the current song
MusicPlayerAPI.song.get(function(result) {
  if (result.status == false) return console.error(result.message);

  var song = result.data;
  console.log("Current song title is " + song.title);
})

CLI

This module also contains a link to musicplayer-cli. Just in case someone installs the wrong module.

Keywords

FAQs

Last updated on 09 Jul 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc