Disable vid.me (RIP)
This commit is contained in:
parent
0c330a82ce
commit
b7bc93f194
7 changed files with 40 additions and 78 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue