Disable vid.me (RIP)

This commit is contained in:
Calvin Montgomery 2017-12-24 11:19:30 -08:00
parent 0c330a82ce
commit b7bc93f194
7 changed files with 40 additions and 78 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.51.13",
"version": "3.51.14",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View File

@ -27,12 +27,6 @@ MediaRefresherModule.prototype.onPreMediaChange = function (data, cb) {
pl._refreshing = false;
cb(null, ChannelModule.PASSTHROUGH);
});
case "vm":
pl._refreshing = true;
return this.initVidme(data, function () {
pl._refreshing = false;
cb(null, ChannelModule.PASSTHROUGH);
});
default:
return cb(null, ChannelModule.PASSTHROUGH);
}
@ -76,58 +70,4 @@ MediaRefresherModule.prototype.initVimeo = function (data, cb) {
});
};
MediaRefresherModule.prototype.initVidme = function (data, cb) {
var self = this;
self.refreshVidme(data, cb);
/*
* Refresh every 55 minutes.
* The expiration is 1 hour, but refresh 5 minutes early to be safe
*/
self._interval = setInterval(function () {
self.refreshVidme(data);
}, 55 * 60 * 1000);
};
MediaRefresherModule.prototype.refreshVidme = function (media, cb) {
var self = this;
if (self.dead || self.channel.dead) {
self.unload();
return;
}
self.channel.refCounter.ref("MediaRefresherModule::refreshVidme");
InfoGetter.getMedia(media.id, "vm", function (err, data) {
if (self.dead || self.channel.dead) {
return;
}
if (err) {
self.channel.logger.log("[mediarefresher] Vidme refresh failed: " + err);
self.channel.refCounter.unref("MediaRefresherModule::refreshVidme");
if (cb) {
process.nextTick(cb);
}
return;
}
if (media !== self._media) {
self.channel.refCounter.unref("MediaRefresherModule::refreshVidme");
if (cb) {
process.nextTick(cb);
}
return;
}
self.channel.logger.log("[mediarefresher] Refreshed Vidme video with ID " +
media.id);
media.meta = data.meta;
self.channel.refCounter.unref("MediaRefresherModule::refreshVidme");
if (cb) {
process.nextTick(cb);
}
});
}
module.exports = MediaRefresherModule;

View File

@ -130,7 +130,11 @@ PlaylistModule.prototype.load = function (data) {
var self = this;
let { playlist, playlistPosition } = data;
if (typeof playlist !== "object" || !playlist.hasOwnProperty("pl")) {
if (typeof playlist !== "object") {
return;
}
if (!playlist.hasOwnProperty("pl")) {
LOGGER.warn(
"Bad playlist for channel %s",
self.channel.uniqueName
@ -156,6 +160,14 @@ PlaylistModule.prototype.load = function (data) {
}
} else if (item.media.type === "gd") {
delete item.media.meta.gpdirect;
} else if (["vm", "jw"].includes(item.media.type)) {
// JW has been deprecated for a long time
// VM shut down in December 2017
LOGGER.warn(
"Dropping playlist item with deprecated type %s",
item.media.type
);
return;
}
var m = new Media(item.media.id, item.media.title, item.media.seconds,
@ -175,6 +187,13 @@ PlaylistModule.prototype.load = function (data) {
i++;
});
// Sanity check, in case the current item happened to be deleted by
// one of the checks above
if (!self.current && self.meta.count > 0) {
self.current = self.items.first;
playlistPosition.time = -3;
}
self.meta.time = util.formatTime(self.meta.rawTime);
self.startPlayback(playlistPosition.time);
self.dirty = false;

View File

@ -512,18 +512,10 @@ var Getters = {
/* vid.me */
vm: function (id, callback) {
if (!/^[\w-]+$/.test(id)) {
process.nextTick(callback, "Invalid vid.me ID");
return;
}
Vidme.lookup(id).then(video => {
const media = new Media(video.id, video.title, video.duration,
"vm", video.meta);
process.nextTick(callback, false, media);
}).catch(function (err) {
callback(err.message || err, null);
});
process.nextTick(
callback,
"As of December 2017, vid.me is no longer in service."
);
},
/* streamable */

View File

@ -224,8 +224,6 @@
return "https://vimeo.com/" + id;
case "dm":
return "https://dailymotion.com/video/" + id;
case "vm":
return "https://vid.me/" + id;
case "sc":
return id;
case "li":

View File

@ -367,6 +367,21 @@ function queue(pos, src) {
var title = undefined;
if (data.type === "fi") {
title = $("#addfromurl-title-val").val();
} else if (data.type === "vm") {
/*
* As of December 2017, vid.me is no longer in service.
* Leaving this temporarily to hopefully avoid confusion
* for people pasting old vid.me links.
*
* TODO: remove at some point in the future
*/
Callbacks.queueFail({
link: link,
msg: "As of December 2017, vid.me is no longer in service."
});
return;
}
if (data.id == null || data.type == null) {

View File

@ -30,8 +30,6 @@ function formatURL(data) {
return "https://vimeo.com/" + data.id;
case "dm":
return "https://dailymotion.com/video/" + data.id;
case "vm":
return "https://vid.me/" + data.id;
case "sc":
return data.id;
case "li":