mirror of https://github.com/calzoneman/sync.git
Deprecate jwplayer and googleplus videos
This commit is contained in:
parent
25c663c110
commit
8d40c87dda
|
@ -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.35.0",
|
"version": "3.35.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,12 +26,6 @@ MediaRefresherModule.prototype.onPreMediaChange = function (data, cb) {
|
||||||
pl._refreshing = true;
|
pl._refreshing = true;
|
||||||
return this.initGoogleDocs(data, function () {
|
return this.initGoogleDocs(data, function () {
|
||||||
|
|
||||||
pl._refreshing = false;
|
|
||||||
cb(null, ChannelModule.PASSTHROUGH);
|
|
||||||
});
|
|
||||||
case "gp":
|
|
||||||
pl._refreshing = true;
|
|
||||||
return this.initGooglePlus(data, function () {
|
|
||||||
pl._refreshing = false;
|
pl._refreshing = false;
|
||||||
cb(null, ChannelModule.PASSTHROUGH);
|
cb(null, ChannelModule.PASSTHROUGH);
|
||||||
});
|
});
|
||||||
|
@ -169,65 +163,6 @@ MediaRefresherModule.prototype.refreshGoogleDocs = function (media, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
MediaRefresherModule.prototype.initGooglePlus = function (media, cb) {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if (self.dead || self.channel.dead) {
|
|
||||||
self.unload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.channel.refCounter.ref("MediaRefresherModule::initGooglePlus");
|
|
||||||
InfoGetter.getMedia(media.id, "gp", function (err, data) {
|
|
||||||
if (self.dead || self.channel.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof err === "string") {
|
|
||||||
err = err.replace(/Forbidden/, "Access Denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (err) {
|
|
||||||
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.refCounter.unref("MediaRefresherModule::initGooglePlus");
|
|
||||||
if (cb) cb();
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
if (err) {
|
|
||||||
self.channel.logger.log("[mediarefresher] Google+ refresh failed: " +
|
|
||||||
err);
|
|
||||||
LOGGER.error("Google+ refresh failed for ID " + media.id +
|
|
||||||
": " + err);
|
|
||||||
self.channel.refCounter.unref("MediaRefresherModule::initGooglePlus");
|
|
||||||
if (cb) cb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (media !== self._media) {
|
|
||||||
self.channel.refCounter.unref("MediaRefresherModule::initGooglePlus");
|
|
||||||
if (cb) cb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.channel.logger.log("[mediarefresher] Refreshed Google+ video with ID " +
|
|
||||||
media.id);
|
|
||||||
media.meta = data.meta;
|
|
||||||
self.channel.refCounter.unref("MediaRefresherModule::initGooglePlus");
|
|
||||||
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);
|
||||||
|
|
|
@ -126,7 +126,7 @@ PlaylistModule.prototype.load = function (data) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (item.media.type === "gd" || item.media.type === "gp") {
|
} else if (item.media.type === "gd") {
|
||||||
delete item.media.meta.gpdirect;
|
delete item.media.meta.gpdirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,11 +394,6 @@ PlaylistModule.prototype.handleQueue = function (user, data) {
|
||||||
var queueby = user.getName();
|
var queueby = user.getName();
|
||||||
|
|
||||||
var duration = undefined;
|
var duration = undefined;
|
||||||
/**
|
|
||||||
* Duration can optionally be specified for a livestream.
|
|
||||||
* The UI for it only shows up for jw: queues, but it is
|
|
||||||
* accepted for any live media
|
|
||||||
*/
|
|
||||||
if (util.isLive(type) && typeof data.duration === "number") {
|
if (util.isLive(type) && typeof data.duration === "number") {
|
||||||
duration = !isNaN(data.duration) ? data.duration : undefined;
|
duration = !isNaN(data.duration) ? data.duration : undefined;
|
||||||
}
|
}
|
||||||
|
@ -821,7 +816,7 @@ PlaylistModule.prototype.handleUpdate = function (user, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var media = this.current.media;
|
var media = this.current.media;
|
||||||
if (util.isLive(media.type) && media.type !== "jw") {
|
if (util.isLive(media.type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,31 +16,6 @@ import { LoggerFactory } from '@calzoneman/jsli';
|
||||||
|
|
||||||
const LOGGER = LoggerFactory.getLogger('get-info');
|
const LOGGER = LoggerFactory.getLogger('get-info');
|
||||||
|
|
||||||
/*
|
|
||||||
* Preference map of quality => youtube formats.
|
|
||||||
* see https://en.wikipedia.org/wiki/Youtube#Quality_and_codecs
|
|
||||||
*
|
|
||||||
* Prefer WebM over MP4, ignore other codecs (e.g. FLV)
|
|
||||||
*/
|
|
||||||
const GOOGLE_PREFERENCE = {
|
|
||||||
"hd1080": [37, 46],
|
|
||||||
"hd720": [22, 45],
|
|
||||||
"large": [59, 44],
|
|
||||||
"medium": [18, 43, 34] // 34 is 360p FLV as a last-ditch
|
|
||||||
};
|
|
||||||
|
|
||||||
const CONTENT_TYPES = {
|
|
||||||
43: "webm",
|
|
||||||
44: "webm",
|
|
||||||
45: "webm",
|
|
||||||
46: "webm",
|
|
||||||
18: "mp4",
|
|
||||||
22: "mp4",
|
|
||||||
37: "mp4",
|
|
||||||
59: "mp4",
|
|
||||||
34: "flv"
|
|
||||||
};
|
|
||||||
|
|
||||||
var urlRetrieve = function (transport, options, callback) {
|
var urlRetrieve = function (transport, options, callback) {
|
||||||
var req = transport.request(options, function (res) {
|
var req = transport.request(options, function (res) {
|
||||||
res.on("error", function (err) {
|
res.on("error", function (err) {
|
||||||
|
@ -466,13 +441,6 @@ var Getters = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/* JWPlayer */
|
|
||||||
jw: function (id, callback) {
|
|
||||||
var title = "JWPlayer - " + id;
|
|
||||||
var media = new Media(id, title, "--:--", "jw");
|
|
||||||
callback(false, media);
|
|
||||||
},
|
|
||||||
|
|
||||||
/* rtmp stream */
|
/* rtmp stream */
|
||||||
rt: function (id, callback) {
|
rt: function (id, callback) {
|
||||||
var title = "Livestream";
|
var title = "Livestream";
|
||||||
|
@ -536,21 +504,6 @@ var Getters = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Google+ videos */
|
|
||||||
gp: function (id, callback) {
|
|
||||||
var data = {
|
|
||||||
type: "google+",
|
|
||||||
kind: "single",
|
|
||||||
id: id
|
|
||||||
};
|
|
||||||
|
|
||||||
mediaquery.lookup(data).then(function (video) {
|
|
||||||
callback(null, convertMedia(video));
|
|
||||||
}).catch(function (err) {
|
|
||||||
callback(err.message || err);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/* ffmpeg for raw files */
|
/* ffmpeg for raw files */
|
||||||
fi: function (id, cb) {
|
fi: function (id, cb) {
|
||||||
ffmpeg.query(id, function (err, data) {
|
ffmpeg.query(id, function (err, data) {
|
||||||
|
|
|
@ -230,8 +230,6 @@
|
||||||
return "http://twitch.tv/" + id;
|
return "http://twitch.tv/" + id;
|
||||||
case "rt":
|
case "rt":
|
||||||
return id;
|
return id;
|
||||||
case "jw":
|
|
||||||
return id;
|
|
||||||
case "im":
|
case "im":
|
||||||
return "http://imgur.com/a/" + id;
|
return "http://imgur.com/a/" + id;
|
||||||
case "us":
|
case "us":
|
||||||
|
@ -259,7 +257,6 @@
|
||||||
case "rt":
|
case "rt":
|
||||||
case "cu":
|
case "cu":
|
||||||
case "im":
|
case "im":
|
||||||
case "jw":
|
|
||||||
case "hb":
|
case "hb":
|
||||||
case "hl":
|
case "hl":
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -40,8 +40,6 @@ function formatURL(data) {
|
||||||
return "http://twitch.tv/" + data.id;
|
return "http://twitch.tv/" + data.id;
|
||||||
case "rt":
|
case "rt":
|
||||||
return data.id;
|
return data.id;
|
||||||
case "jw":
|
|
||||||
return data.id;
|
|
||||||
case "im":
|
case "im":
|
||||||
return "http://imgur.com/a/" + data.id;
|
return "http://imgur.com/a/" + data.id;
|
||||||
case "us":
|
case "us":
|
||||||
|
@ -1257,13 +1255,6 @@ function parseMediaLink(url) {
|
||||||
url = url.trim();
|
url = url.trim();
|
||||||
url = url.replace("feature=player_embedded&", "");
|
url = url.replace("feature=player_embedded&", "");
|
||||||
|
|
||||||
if(url.indexOf("jw:") == 0) {
|
|
||||||
return {
|
|
||||||
id: url.substring(3),
|
|
||||||
type: "fi"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if(url.indexOf("rtmp://") == 0) {
|
if(url.indexOf("rtmp://") == 0) {
|
||||||
return {
|
return {
|
||||||
id: url,
|
id: url,
|
||||||
|
@ -1376,13 +1367,6 @@ function parseMediaLink(url) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m = url.match(/plus\.google\.com\/(?:u\/\d+\/)?photos\/(\d+)\/albums\/(\d+)\/(\d+)/))) {
|
|
||||||
return {
|
|
||||||
id: m[1] + "_" + m[2] + "_" + m[3],
|
|
||||||
type: "gp"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if((m = url.match(/vid\.me\/([\w-]+)/))) {
|
if((m = url.match(/vid\.me\/([\w-]+)/))) {
|
||||||
return {
|
return {
|
||||||
id: m[1],
|
id: m[1],
|
||||||
|
@ -1405,13 +1389,6 @@ function parseMediaLink(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shorthand URIs */
|
/* Shorthand URIs */
|
||||||
// To catch Google Plus by ID alone
|
|
||||||
if ((m = url.match(/^(?:gp:)?(\d{21}_\d{19}_\d{19})/))) {
|
|
||||||
return {
|
|
||||||
id: m[1],
|
|
||||||
type: "gp"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// So we still trim DailyMotion URLs
|
// So we still trim DailyMotion URLs
|
||||||
if((m = url.match(/^dm:([^\?&#_]+)/))) {
|
if((m = url.match(/^dm:([^\?&#_]+)/))) {
|
||||||
return {
|
return {
|
||||||
|
@ -2975,43 +2952,6 @@ function vimeoSimulator2014(data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function googlePlusSimulator2014(data) {
|
|
||||||
/* Google+ Simulator uses the raw file player */
|
|
||||||
data.type = "fi";
|
|
||||||
|
|
||||||
if (!data.meta.gpdirect) {
|
|
||||||
data.url = "";
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert youtube-style quality key to vimeo workaround quality */
|
|
||||||
var q = USEROPTS.default_quality || "auto";
|
|
||||||
if (q === "highres") {
|
|
||||||
q = "hd1080";
|
|
||||||
}
|
|
||||||
|
|
||||||
var fallbacks = ["hd1080", "hd720", "large", "medium", "small"];
|
|
||||||
var i = fallbacks.indexOf(q);
|
|
||||||
if (i < 0) {
|
|
||||||
i = fallbacks.indexOf("medium");
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!(q in data.meta.gpdirect) && i < fallbacks.length) {
|
|
||||||
q = fallbacks[i++];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i === fallbacks.length) {
|
|
||||||
var hasCodecs = Object.keys(data.meta.gpdirect);
|
|
||||||
if (hasCodecs.length > 0) {
|
|
||||||
q = hasCodecs[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data.url = data.meta.gpdirect[q].url;
|
|
||||||
data.contentType = data.meta.gpdirect[q].contentType;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function EmoteList(selector, emoteClickCallback) {
|
function EmoteList(selector, emoteClickCallback) {
|
||||||
this.elem = $(selector);
|
this.elem = $(selector);
|
||||||
this.initSearch();
|
this.initSearch();
|
||||||
|
|
Loading…
Reference in New Issue