From 23674e04e7cbdb7424ecf6cc23732f790a8ff9bd Mon Sep 17 00:00:00 2001 From: Jan Holub Date: Fri, 25 Aug 2017 14:24:37 +0200 Subject: [PATCH] Fixed prev() and next() and incremted to 1.3.1 The mode was not propagated to mpv and it is not called 'strong' but 'force' --- CHANGELOG.md | 3 +++ lib/mpv/_playlist.js | 16 ++++++++-------- package.json | 2 +- readme.md | 30 +++++++++++++++--------------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44b6f73..598423b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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()`` diff --git a/lib/mpv/_playlist.js b/lib/mpv/_playlist.js index e6c1687..96bd003 100644 --- a/lib/mpv/_playlist.js +++ b/lib/mpv/_playlist.js @@ -6,7 +6,7 @@ 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 @@ -14,22 +14,22 @@ var playlist = { // 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() { diff --git a/package.json b/package.json index 11691fc..572f82e 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/readme.md b/readme.md index b058715..3de14c9 100644 --- a/readme.md +++ b/readme.md @@ -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 @@ -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** () @@ -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) { @@ -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 @@ -530,18 +530,18 @@ The **Node-MPV** module provides various *events* to notify about changes of the * **getrequest** \ - *deprecated* Delivers the reply to a function call to the **getProperty** method - + * **seek** 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: , end: } ``` - + 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** \