From 543ec91e9b0c20c8a5b77ca7c474f7b4211c3631 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 30 Jun 2013 15:56:41 -0400 Subject: [PATCH 1/3] Implement #189 --- www/assets/js/player.js | 13 +++++++++---- www/assets/js/ui.js | 8 ++++++++ www/channel.html | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/www/assets/js/player.js b/www/assets/js/player.js index fc456788..4ac399d3 100644 --- a/www/assets/js/player.js +++ b/www/assets/js/player.js @@ -58,6 +58,7 @@ var Player = function(data) { this.nullPlayer(); break; } + this.load(data); } Player.prototype.nullPlayer = function() { @@ -114,19 +115,23 @@ Player.prototype.initYouTube = function() { } this.pause = function() { - this.player.pauseVideo(); + if(this.player.pauseVideo) + this.player.pauseVideo(); } this.play = function() { - this.player.playVideo(); + if(this.player.playVideo) + this.player.playVideo(); } this.getTime = function(callback) { - callback(this.player.getCurrentTime()); + if(this.player.getCurrentTime) + callback(this.player.getCurrentTime()); } this.seek = function(time) { - this.player.seekTo(time, true); + if(this.player.seekTo) + this.player.seekTo(time, true); } } diff --git a/www/assets/js/ui.js b/www/assets/js/ui.js index e021ce0f..78468de5 100644 --- a/www/assets/js/ui.js +++ b/www/assets/js/ui.js @@ -190,6 +190,8 @@ $("#userpl_save").click(function() { var caret = btn.find(".caret").detach(); btn.text($(select).text()); caret.appendTo(btn); + if(PLAYER.type == "yt" && PLAYER.player.setPlaybackQuality) + PLAYER.player.setPlaybackQuality(VIDEOQUALITY); }); } qualHandler("#quality_240p", "small"); @@ -199,6 +201,12 @@ $("#userpl_save").click(function() { qualHandler("#quality_1080p", "hd1080"); })(); +$("#mediarefresh").click(function() { + PLAYER.type = ""; + PLAYER.id = ""; + socket.emit("playerReady"); +}); + /* playlist controls */ $("#queue").sortable({ diff --git a/www/channel.html b/www/channel.html index 0850022e..dc69c0f2 100644 --- a/www/channel.html +++ b/www/channel.html @@ -156,6 +156,7 @@
  • 1080p
  • +
    From f84073ad387aa8affb4500bf80f525c071320df8 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 30 Jun 2013 16:01:19 -0400 Subject: [PATCH 2/3] Implement a button for #188 --- www/acp.html | 1 + www/assets/js/acp.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/www/acp.html b/www/acp.html index 7236fe0f..119db195 100644 --- a/www/acp.html +++ b/www/acp.html @@ -77,6 +77,7 @@ +
    
                 
    diff --git a/www/assets/js/acp.js b/www/assets/js/acp.js
    index 759d6821..1062f900 100644
    --- a/www/assets/js/acp.js
    +++ b/www/assets/js/acp.js
    @@ -123,6 +123,12 @@ $("#actionlog_time").click(function() {
         tableResort($("#actionlog table"), "time");
     });
     
    +function reverseLog() {
    +    $("#log").text($("#log").text().split("\n").reverse().join("\n"));
    +}
    +
    +$("#log_reverse").click(reverseLog);
    +
     function getSyslog() {
         $.ajax(WEB_URL+"/api/plain/readlog?type=sys&"+AUTH).done(function(data) {
             $("#log").text(data);
    
    From 46b823c60df606de714f6be06f65f36916c1212d Mon Sep 17 00:00:00 2001
    From: calzoneman 
    Date: Sun, 30 Jun 2013 16:01:31 -0400
    Subject: [PATCH 3/3] Fix a bug with the youtube error parser
    
    ---
     get-info.js | 14 ++++++++++++--
     1 file changed, 12 insertions(+), 2 deletions(-)
    
    diff --git a/get-info.js b/get-info.js
    index 159298c8..9afb5b74 100644
    --- a/get-info.js
    +++ b/get-info.js
    @@ -30,7 +30,12 @@ function getJSON(options, callback) {
                 catch(e) {
                     Logger.errlog.log("JSON fail: " + options.path);
                     var m = buffer.match(/([^<]+)<\/internalReason>/);
    -                callback(m[1] || true, res.statusCode, null);
    +                if(m) {
    +                    callback(m[1], res.statusCode, null);
    +                }
    +                else {
    +                    callback(true, res.statusCode, null);
    +                }
                     return;
                 }
                 callback(false, res.statusCode, data);
    @@ -55,7 +60,12 @@ function getJSONHTTPS(options, callback) {
                 catch(e) {
                     Logger.errlog.log("JSON fail: " + options.path);
                     var m = buffer.match(/([^<]+)<\/internalReason>/);
    -                callback(m[1] || true, res.statusCode, null);
    +                if(m) {
    +                    callback(m[1], res.statusCode, null);
    +                }
    +                else {
    +                    callback(true, res.statusCode, null);
    +                }
                     return;
                 }
                 callback(false, res.statusCode, data);