From 8d40c87dda8b12a49d0512483a8a092682202fbb Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Tue, 11 Apr 2017 21:55:31 -0700 Subject: [PATCH] Deprecate jwplayer and googleplus videos --- package.json | 2 +- src/channel/mediarefresher.js | 65 ----------------------------------- src/channel/playlist.js | 9 ++--- src/get-info.js | 47 ------------------------- src/utilities.js | 3 -- www/js/util.js | 60 -------------------------------- 6 files changed, 3 insertions(+), 183 deletions(-) diff --git a/package.json b/package.json index 5972dae2..80539e1f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.35.0", + "version": "3.35.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/channel/mediarefresher.js b/src/channel/mediarefresher.js index 3d63611a..b6d12387 100644 --- a/src/channel/mediarefresher.js +++ b/src/channel/mediarefresher.js @@ -26,12 +26,6 @@ MediaRefresherModule.prototype.onPreMediaChange = function (data, cb) { pl._refreshing = true; 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; 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) { var self = this; self.refreshVidme(data, cb); diff --git a/src/channel/playlist.js b/src/channel/playlist.js index 585ed3ad..95b37f8a 100644 --- a/src/channel/playlist.js +++ b/src/channel/playlist.js @@ -126,7 +126,7 @@ PlaylistModule.prototype.load = function (data) { } catch (e) { return; } - } else if (item.media.type === "gd" || item.media.type === "gp") { + } else if (item.media.type === "gd") { delete item.media.meta.gpdirect; } @@ -394,11 +394,6 @@ PlaylistModule.prototype.handleQueue = function (user, data) { var queueby = user.getName(); 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") { duration = !isNaN(data.duration) ? data.duration : undefined; } @@ -821,7 +816,7 @@ PlaylistModule.prototype.handleUpdate = function (user, data) { } var media = this.current.media; - if (util.isLive(media.type) && media.type !== "jw") { + if (util.isLive(media.type)) { return; } diff --git a/src/get-info.js b/src/get-info.js index a4d8c1d7..77b7a771 100644 --- a/src/get-info.js +++ b/src/get-info.js @@ -16,31 +16,6 @@ import { LoggerFactory } from '@calzoneman/jsli'; 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 req = transport.request(options, function (res) { 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 */ rt: function (id, callback) { 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 */ fi: function (id, cb) { ffmpeg.query(id, function (err, data) { diff --git a/src/utilities.js b/src/utilities.js index 5ca45a1c..831d4597 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -230,8 +230,6 @@ return "http://twitch.tv/" + id; case "rt": return id; - case "jw": - return id; case "im": return "http://imgur.com/a/" + id; case "us": @@ -259,7 +257,6 @@ case "rt": case "cu": case "im": - case "jw": case "hb": case "hl": return true; diff --git a/www/js/util.js b/www/js/util.js index f1a66784..5545964e 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -40,8 +40,6 @@ function formatURL(data) { return "http://twitch.tv/" + data.id; case "rt": return data.id; - case "jw": - return data.id; case "im": return "http://imgur.com/a/" + data.id; case "us": @@ -1257,13 +1255,6 @@ function parseMediaLink(url) { url = url.trim(); url = url.replace("feature=player_embedded&", ""); - if(url.indexOf("jw:") == 0) { - return { - id: url.substring(3), - type: "fi" - }; - } - if(url.indexOf("rtmp://") == 0) { return { 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-]+)/))) { return { id: m[1], @@ -1405,13 +1389,6 @@ function parseMediaLink(url) { } /* 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 if((m = url.match(/^dm:([^\?&#_]+)/))) { return { @@ -2975,43 +2952,6 @@ function vimeoSimulator2014(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) { this.elem = $(selector); this.initSearch();