From b2687f49a81bce721cc26104afa6c81a595083ba Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Wed, 8 Jul 2015 13:27:43 -0700 Subject: [PATCH] Update error messages caught by mediarefresher --- lib/channel/mediarefresher.js | 41 +++++++++++++++++++++++++---------- package.json | 2 +- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lib/channel/mediarefresher.js b/lib/channel/mediarefresher.js index 6d4d7428..196e387f 100644 --- a/lib/channel/mediarefresher.js +++ b/lib/channel/mediarefresher.js @@ -96,12 +96,25 @@ MediaRefresherModule.prototype.refreshGoogleDocs = function (media, cb) { return; } + err = err.replace(/Google Drive lookup failed: /, ""); + err = err.replace(/Forbidden/, "Access Denied"); + err = err.replace(/You don't have permission to access this video\./, + "Access Denied"); + switch (err) { - case "HTTP 302": - case "Video not found": - case "Private video": - case "Google Docs error: Video has exceeded quota": - case "There is currently a bug with Google Drive which prevents playback of videos 1 hour long or longer.": + case "Moved Temporarily": + self.channel.logger.log("[mediarefresher] Google Docs refresh failed " + + "(likely redirect to login page-- make sure it is shared " + + "correctly)"); + self.channel.activeLock.release(); + if (cb) cb(); + return; + case "Access Denied": + case "Not Found": + case "Internal Server Error": + case "Service Unavailable": + case "Google Drive does not permit videos longer than 1 hour to be played": + case "Google Drive videos must be shared publicly": self.channel.logger.log("[mediarefresher] Google Docs refresh failed: " + err); self.channel.activeLock.release(); @@ -146,14 +159,18 @@ MediaRefresherModule.prototype.initGooglePlus = function (media, cb) { return; } + err = err.replace(/Forbidden/, "Access Denied"); + switch (err) { - case "HTTP 302": - case "Video not found": - case "Private video": - case "The video is still being processed.": - case "A processing error has occured and the video should be deleted.": - case "The video has been processed but still needs a thumbnail.": - case "Unable to retreive duration from Google+. This might be because the video is still processing.": + case "Access Denied": + case "Not Found": + case "Internal Server Error": + case "Service Unavailable": + case "The video is still being processed": + case "A processing error has occured": + case "The video has been processed but is not yet accessible": + case ("Unable to retreive video information. Check that the video exists " + + "and is shared publicly"): self.channel.logger.log("[mediarefresher] Google+ refresh failed: " + err); self.channel.activeLock.release(); diff --git a/package.json b/package.json index 38b99939..f515fcef 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.8.1", + "version": "3.8.2", "repository": { "url": "http://github.com/calzoneman/sync" },