]> git.wh0rd.org - chrome-ext/music-player-client.git/blobdiff - js/mpc.js
images: update screenshot
[chrome-ext/music-player-client.git] / js / mpc.js
index f27901d266dfb2558b38a86d84f65f2a4b2d03fb..1e3390b27b7d21100dfe22d95837c9c508323efe 100644 (file)
--- a/js/mpc.js
+++ b/js/mpc.js
@@ -28,6 +28,12 @@ Mpc.prototype.send = function(msg) {
        this._queue.push(msg);
        this._socket.send(msg, function(x) {
                _this.log(0x1, 'send: ' + msg + ':', x);
        this._queue.push(msg);
        this._socket.send(msg, function(x) {
                _this.log(0x1, 'send: ' + msg + ':', x);
+               if (x.bytesWritten < 0) {
+                       _this.log(0x1, 'reconnecting...');
+                       _this._socket.reconnect();
+                       _this.queue = [msg];
+                       _this._socket.send(msg);
+               }
        });
 }
 
        });
 }
 
@@ -244,7 +250,7 @@ Mpc.prototype.seek                = Mpc.__make_send_arg2('seek');
 // seekid {SONGID} {TIME}
 Mpc.prototype.seekid              = Mpc.__make_send_arg2('seekid');
 // seekcur {TIME}
 // seekid {SONGID} {TIME}
 Mpc.prototype.seekid              = Mpc.__make_send_arg2('seekid');
 // seekcur {TIME}
-Mpc.prototype.seekcur             = Mpc.__make_send_arg1('seek');
+Mpc.prototype.seekcur             = Mpc.__make_send_arg1('seekcur');
 // stop
 Mpc.prototype.stop                = Mpc.__make_send_void('stop');
 
 // stop
 Mpc.prototype.stop                = Mpc.__make_send_void('stop');