Skip to content

Commit

Permalink
Fixed prev() and next() and incremted to 1.3.1
Browse files Browse the repository at this point in the history
The mode was not propagated to mpv and it is not called 'strong' but 'force'
  • Loading branch information
j-holub committed Aug 25, 2017
1 parent 95f016a commit 23674e0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Node-MPV Changelog

* **1.3.1**
* Fixes `next()` and `prev()`. The mode was not propagated to **mpv** and instead of **strong** it is actually **force*

* **1.3.0**
* Added **seek** event
* Deprecated `loadFile()` and `loadStream()` which are replaced by `load()``
Expand Down
16 changes: 8 additions & 8 deletions lib/mpv/_playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ var playlist = {
// replace replace current playlist
// append append to current playist
loadPlaylist: function(playlist, mode){
mode = mode || "replace";
mode = mode || "replace";
this.socket.command("loadlist", [playlist, mode]);
},
// appends a video/song to the playlist
// mode
// append append the song
// append-play append and play if the playlist was empty
append: function(file, mode){
mode = mode || "append";
mode = mode || "append";
this.socket.command("loadfile", [file, mode]);
},
// next song in the playlist
// mode weak last song in the playlist will not be skipped
// mode strong last song in the playlist will be skipped
// mode weak last song in the playlist will not be skipped
// mode force last song in the playlist will be skipped
next: function(mode) {
mode = mode || "weak";
this.socket.command("playlist-next");
this.socket.command("playlist-next", [mode]);
},
// previous song in the playlist
// mode weak first song in the playlist will not be skipped
// mode strong first song in the playlist will be skipped
// mode weak first song in the playlist will not be skipped
// mode force first song in the playlist will be skipped
prev: function(mode) {
mode = mode || "weak";
this.socket.command("playlist-prev");
this.socket.command("playlist-prev", [mode]);
},
// clear the playlist
clearPlaylist: function() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-mpv",
"version": "1.3.0",
"version": "1.3.1",
"description": "A Node module for MPV",
"main": "index.js",
"scripts": {
Expand Down
30 changes: 15 additions & 15 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,22 @@ mpvPlayer.on('stopped', function() {
* **quit** ()

Quits **mpv**. The player instance cannot be used anymore afterwards. A new one has to be created.

```JavaScript
let player = new mpv();
mpv.quit()
// restarting
player = new mpv();
```
This behaviour will be improved with **Version 2** of this module
This behaviour will be improved with **Version 2** of this module


## Playlists

* **loadPlaylist** (playlist, mode="replace")

Loads a playlist file. `mode` can be one of the two folllowing

* `replace` *(default)* Replaces the old playist with the new one
* `append` Appends the new playlist to the active one

Expand All @@ -241,14 +241,14 @@ mpvPlayer.on('stopped', function() {
Skips the current title. `mode` can be one of the following two

* `weak` *(default*) If the current title is the last one in the playlist it is not skipped
* `strong` The title is skipped and playback is stopped
* `force` The title is skipped and if it was the last one in the playlist, playback is stopped

* **prev** (mode="weak")

Skips the current title. `mode` can be one of the following two
Jumps to the previous title. `mode` can be one of the following two

* `weak` *(default*) If the title is the first one in the playlist it is not stopped
* `strong` The title is skipped and playback is stopped
* `weak` *(default*) If the title is the first one in the playlist nothing happens
* `force` If the was the first one in the playlist, playback is stopped

* **clearPlaylist** ()

Expand Down Expand Up @@ -436,9 +436,9 @@ The most common commands are already covered by this modules **API**. This part
* **getProperty** (property)

Gets information about the specified `property`.

This function returns a [promise](https://www.promisejs.org) and is used as in the example below

```Javascript
mpvPlayer.getProperty('duration')
.then(function(duration) {
Expand All @@ -451,7 +451,7 @@ The most common commands are already covered by this modules **API**. This part
Gets information about the specified `property`.

The answer comes via a *getrequest* event containing the`id` and the `property`.

* **addProperty** (property, value)

Increase the `property` by the specified `value`. Needless to say this can only be used on numerical properties. Negative values are possible
Expand Down Expand Up @@ -530,18 +530,18 @@ The **Node-MPV** module provides various *events* to notify about changes of the
* **getrequest** \<id, data\> - *deprecated*

Delivers the reply to a function call to the **getProperty** method

* **seek** <timeposition object>

Whenever a `seek()` or `goToPosition()` is called, or some external source searches, this event is emitted providing a **timeposition** object with the following information

```JavaScript
{
start: <timeposition before seeking>,
end: <timeposition after seeking>
}
```

In case the seek can not be finished, for example because the file is changed while seeking, this event is not emitted. It is only emitted when the seeking has successfully finished.

* **statuschange** \<status object\>
Expand Down

0 comments on commit 23674e0

Please sign in to comment.