# musicplayer

> API for the Music Player

Latest version **1.0.6** (published 2015-07-09) · GPLv3 license · 0 weekly downloads

## Install

```sh
npm install musicplayer
pnpm add musicplayer
yarn add musicplayer
bun add musicplayer
```

Provides the command `musicplayer`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2015-07-09 |
| First published | 2015-07-08 |
| Weekly downloads | 0 |
| License | GPLv3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Ilias Ismanalijev |
| Maintainers | illyism |
| Keywords | api, music, player, reddit |

## Links

- npm: https://www.npmjs.com/package/musicplayer
- Repository: https://github.com/musicplayer-io/musicplayer-api
- Homepage: http://www.musicplayer.io
- Issues: https://github.com/musicplayer-io/musicplayer-api/issues
- npm.io page: https://npm.io/package/musicplayer

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.58.0
- [musicplayer-cli](https://npm.io/package/musicplayer-cli.md) *

## Recent versions

- 1.0.6 (latest) — 2015-07-09
- 1.0.5 — 2015-07-08
- 1.0.4 — 2015-07-08
- 1.0.3 — 2015-07-08
- 1.0.2 — 2015-07-08
- 1.0.1 — 2015-07-08
- 1.0.0 — 2015-07-08

## README

<h1 align="center">
  <br>
  <img width="650" src="https://cloud.githubusercontent.com/assets/304283/8581435/f5fcf59a-25c0-11e5-80fd-0ac130f628a5.jpg" alt="music player api">
  <br>
  <br>
</h1>


> 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](http://reddit.musicplayer.io/remote).

# 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](https://github.com/musicplayer-io/musicplayer-cli). Just in case someone installs the wrong module.

---
_Source: https://npm.io/package/musicplayer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
