mirror of https://github.com/calzoneman/sync.git
Remove google drive refresh logic
No longer relevant since the video links are retrieved by the userscript.
This commit is contained in:
parent
e9c519c6e2
commit
f968521936
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.36.3",
|
"version": "3.36.4",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,13 +22,6 @@ MediaRefresherModule.prototype.onPreMediaChange = function (data, cb) {
|
||||||
var pl = this._playlist;
|
var pl = this._playlist;
|
||||||
|
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case "gd":
|
|
||||||
pl._refreshing = true;
|
|
||||||
return this.initGoogleDocs(data, function () {
|
|
||||||
|
|
||||||
pl._refreshing = false;
|
|
||||||
cb(null, ChannelModule.PASSTHROUGH);
|
|
||||||
});
|
|
||||||
case "vi":
|
case "vi":
|
||||||
pl._refreshing = true;
|
pl._refreshing = true;
|
||||||
return this.initVimeo(data, function () {
|
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) {
|
MediaRefresherModule.prototype.initVimeo = function (data, cb) {
|
||||||
if (!Config.get("vimeo-workaround")) {
|
if (!Config.get("vimeo-workaround")) {
|
||||||
if (cb) cb();
|
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) {
|
MediaRefresherModule.prototype.initVidme = function (data, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.refreshVidme(data, cb);
|
self.refreshVidme(data, cb);
|
||||||
|
|
Loading…
Reference in New Issue