From f968521936dc8dfd58175fc6879ae70e3bb7746f Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sun, 28 May 2017 18:35:13 -0700 Subject: [PATCH] Remove google drive refresh logic No longer relevant since the video links are retrieved by the userscript. --- package.json | 2 +- src/channel/mediarefresher.js | 86 ----------------------------------- 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/package.json b/package.json index 1134f89d..840d59a0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.36.3", + "version": "3.36.4", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/channel/mediarefresher.js b/src/channel/mediarefresher.js index b6d12387..24ce11ee 100644 --- a/src/channel/mediarefresher.js +++ b/src/channel/mediarefresher.js @@ -22,13 +22,6 @@ MediaRefresherModule.prototype.onPreMediaChange = function (data, cb) { var pl = this._playlist; switch (data.type) { - case "gd": - pl._refreshing = true; - return this.initGoogleDocs(data, function () { - - pl._refreshing = false; - cb(null, ChannelModule.PASSTHROUGH); - }); case "vi": pl._refreshing = true; return this.initVimeo(data, function () { @@ -55,19 +48,6 @@ MediaRefresherModule.prototype.unload = function () { } }; -MediaRefresherModule.prototype.initGoogleDocs = function (data, cb) { - var self = this; - self.refreshGoogleDocs(data, cb); - - /* - * Refresh every 55 minutes. - * The expiration is 1 hour, but refresh 5 minutes early to be safe - */ - self._interval = setInterval(function () { - self.refreshGoogleDocs(data); - }, 55 * 60 * 1000); -}; - MediaRefresherModule.prototype.initVimeo = function (data, cb) { if (!Config.get("vimeo-workaround")) { if (cb) cb(); @@ -97,72 +77,6 @@ MediaRefresherModule.prototype.initVimeo = function (data, cb) { }); }; -MediaRefresherModule.prototype.refreshGoogleDocs = function (media, cb) { - var self = this; - - if (self.dead || self.channel.dead) { - self.unload(); - return; - } - - self.channel.refCounter.ref("MediaRefresherModule::refreshGoogleDocs"); - InfoGetter.getMedia(media.id, "gd", function (err, data) { - if (self.dead || self.channel.dead) { - return; - } - - if (typeof err === "string") { - err = err.replace(/Google Drive lookup failed for [\w-]+: /, ""); - err = err.replace(/Forbidden/, "Access Denied"); - err = err.replace(/You don't have permission to access this video\./, - "Access Denied"); - } - - switch (err) { - 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.refCounter.unref("MediaRefresherModule::refreshGoogleDocs"); - 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.refCounter.unref("MediaRefresherModule::refreshGoogleDocs"); - if (cb) cb(); - return; - default: - if (err) { - self.channel.logger.log("[mediarefresher] Google Docs refresh failed: " + - err); - LOGGER.error("Google Docs refresh failed for ID " + media.id + - ": " + err); - self.channel.refCounter.unref("MediaRefresherModule::refreshGoogleDocs"); - if (cb) cb(); - return; - } - } - - if (media !== self._media) { - self.channel.refCounter.unref("MediaRefresherModule::refreshGoogleDocs"); - if (cb) cb(); - return; - } - - self.channel.logger.log("[mediarefresher] Refreshed Google Docs video with ID " + - media.id); - media.meta = data.meta; - self.channel.refCounter.unref("MediaRefresherModule::refreshGoogleDocs"); - if (cb) cb(); - }); -}; - MediaRefresherModule.prototype.initVidme = function (data, cb) { var self = this; self.refreshVidme(data, cb);