Switch to Koa, more es6
This commit is contained in:
parent
1090affc9c
commit
b3abff99ae
36 changed files with 25573 additions and 928 deletions
|
@ -1,150 +0,0 @@
|
|||
"use strict";
|
||||
var parse = require("url").parse;
|
||||
var request = require("superagent");
|
||||
require("superagent-bluebird-promise");
|
||||
|
||||
module.exports.id = "beats";
|
||||
|
||||
if (!process.env.BEATS_KEY || !process.env.BEATS_SECRET) {
|
||||
console.warn("BEATS_KEY or BEATS_SECRET environment variables not found, deactivating Beats.");
|
||||
return;
|
||||
}
|
||||
|
||||
var credentials = {
|
||||
key: process.env.BEATS_KEY,
|
||||
secret: process.env.BEATS_SECRET
|
||||
};
|
||||
|
||||
var apiRoot = "https://partner.api.beatsmusic.com/v1/api";
|
||||
|
||||
module.exports.match = require("./url").match;
|
||||
|
||||
module.exports.parseUrl = function(url) {
|
||||
var matches = parse(url).path.match(/\/albums[\/]+([^\/]+)(\/tracks\/)?([^\/]+)?/);
|
||||
if (matches && matches[3]) {
|
||||
return module.exports.lookupId(matches[3], "track");
|
||||
} else if (matches && matches[1]) {
|
||||
return module.exports.lookupId(matches[1], "album");
|
||||
} else {
|
||||
throw new Error("Url does not match");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.lookupId = function(id, type) {
|
||||
if (type === "album") {
|
||||
return request.get(apiRoot + "/albums/" + id + "/images/default?size=large&client_id=" + credentials.key).redirects(0).promise().then(function(res) {
|
||||
var artwork = {large: res.headers.location.replace("http:", "https:")};
|
||||
return request.get(apiRoot + "/albums/" + id + "/images/default?client_id=" + credentials.key).redirects(0).promise().then(function(res) {
|
||||
artwork.small = res.headers.location.replace("http:", "https:");
|
||||
return request.get(apiRoot + "/albums/" + id + "?client_id=" + credentials.key).promise().then(function(res) {
|
||||
if (!res.body.data) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
throw error;
|
||||
}
|
||||
var result = res.body.data;
|
||||
return {
|
||||
service: "beats",
|
||||
type: "album",
|
||||
id: result.id,
|
||||
name: result.title,
|
||||
streamUrl: "https://listen.beatsmusic.com/albums/" + result.id,
|
||||
purchaseUrl: null,
|
||||
artwork: artwork,
|
||||
artist: {
|
||||
name: result.artist_display_name
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (type === "track") {
|
||||
return request.get(apiRoot + "/tracks/" + id + "?client_id=" + credentials.key).promise().then(function(res) {
|
||||
if (!res.body.data) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
throw error;
|
||||
}
|
||||
var result = res.body.data;
|
||||
return request.get(apiRoot + "/albums/" + result.refs.album.id + "/images/default?size=large&client_id=" + credentials.key).redirects(0).promise().then(function(res) {
|
||||
var artwork = {large: res.headers.location.replace("http:", "https:")};
|
||||
return request.get(apiRoot + "/albums/" + result.refs.album.id + "/images/default?client_id=" + credentials.key).redirects(0).promise().then(function(res) {
|
||||
artwork.small = res.headers.location.replace("http:", "https:");
|
||||
return {
|
||||
service: "beats",
|
||||
type: "track",
|
||||
id: result.id,
|
||||
name: result.title,
|
||||
streamUrl: "https://listen.beatsmusic.com/albums/" + result.refs.album.id + "/tracks/" + result.id,
|
||||
purchaseUrl: null,
|
||||
artwork: artwork,
|
||||
artist: {
|
||||
name: result.artist_display_name
|
||||
},
|
||||
album: {
|
||||
name: result.refs.album.display
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.search = function(data) {
|
||||
var cleanParam = function(str) {
|
||||
return str.replace(/[\:\?\&]+/, "");
|
||||
};
|
||||
var query, album;
|
||||
var type = data.type;
|
||||
|
||||
if (type === "album") {
|
||||
query = "'" + cleanParam(data.artist.name) + "' '" + cleanParam(data.name) + "'";
|
||||
album = data.name;
|
||||
} else if (type === "track") {
|
||||
query = "'" + cleanParam(data.artist.name) + "' '" + cleanParam(data.name) + "'";
|
||||
if (data.album) {
|
||||
album = data.album.name;
|
||||
} else {
|
||||
album = "";
|
||||
}
|
||||
}
|
||||
|
||||
var path = "/search?q=" + encodeURIComponent(query) + "&type=" + type + "&client_id=" + credentials.key;
|
||||
|
||||
return request.get(apiRoot + path).promise().then(function(res) {
|
||||
if (!res.body.data[0]) {
|
||||
return {service: "beats"};
|
||||
} else {
|
||||
var found;
|
||||
var choppedAlbum = data.type === "album" ? cleanParam(data.name) : cleanParam(data.album.name);
|
||||
var choppedArtist = cleanParam(data.artist.name);
|
||||
|
||||
res.body.data.forEach(function(item) {
|
||||
var matches = item.detail.match(/^[^\(\[]+/);
|
||||
if(choppedArtist.indexOf(matches[0]) >= 0) {
|
||||
found = item;
|
||||
}
|
||||
});
|
||||
|
||||
if (!found && !choppedAlbum.length) {
|
||||
return module.exports.lookupId(res.body.data[0].id, type);
|
||||
}
|
||||
|
||||
res.body.data.forEach(function(item) {
|
||||
var matches = item.related.display.match(/^[^\(\[]+/);
|
||||
if(choppedAlbum.indexOf(matches[0]) >= 0) {
|
||||
found = item;
|
||||
}
|
||||
});
|
||||
if (!found) {
|
||||
return {service: "beats"};
|
||||
}
|
||||
return module.exports.lookupId(found.id, type);
|
||||
}
|
||||
});
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
"use strict";
|
||||
var parse = require("url").parse;
|
||||
|
||||
module.exports.match = function(url) {
|
||||
var parsed = parse(url);
|
||||
if (!parsed.host.match(/beatsmusic\.com$/)) {
|
||||
return false;
|
||||
}
|
||||
var matches = parsed.path.match(/\/albums[\/]+([^\/]+)(\/tracks\/)?([^\/]+)?/);
|
||||
return matches.length > 1;
|
||||
};
|
|
@ -1,109 +1,110 @@
|
|||
"use strict";
|
||||
var parse = require('url').parse;
|
||||
var Promise = require('bluebird');
|
||||
var request = require('superagent');
|
||||
require('superagent-bluebird-promise');
|
||||
import {parse} from 'url';
|
||||
import request from 'superagent';
|
||||
import 'superagent-bluebird-promise';
|
||||
|
||||
module.exports.id = "deezer";
|
||||
module.exports.id = 'deezer';
|
||||
|
||||
var apiRoot = "https://api.deezer.com";
|
||||
const apiRoot = 'https://api.deezer.com';
|
||||
|
||||
module.exports.match = require('./url').match;
|
||||
|
||||
module.exports.parseUrl = function(url) {
|
||||
var matches = parse(url).path.match(/\/(album|track)[\/]+([^\/]+)/);
|
||||
let matches = parse(url).path.match(/\/(album|track)[\/]+([^\/]+)/);
|
||||
|
||||
if (matches && matches[2]) {
|
||||
return module.exports.lookupId(matches[2], matches[1]);
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.lookupId = function(id, type) {
|
||||
var path = "/" + type + "/" + id;
|
||||
|
||||
return request.get(apiRoot + path).promise().then(function(res) {
|
||||
var result = res.body;
|
||||
if (res.body.error) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
throw error;
|
||||
}
|
||||
var cover = result.cover || result.album.cover;
|
||||
return request.get(cover).redirects(0).promise().then(function(res) {
|
||||
var artwork = {
|
||||
small: res.headers.location.replace("120x120", "200x200"),
|
||||
large: res.headers.location.replace("120x120", "800x800")
|
||||
};
|
||||
if (type == "album") {
|
||||
return {
|
||||
service: "deezer",
|
||||
type: type,
|
||||
id: result.id,
|
||||
name: result.title,
|
||||
streamUrl: result.link,
|
||||
purchaseUrl: null,
|
||||
artwork: artwork,
|
||||
artist: {
|
||||
name: result.artist.name
|
||||
},
|
||||
};
|
||||
} else if (type == "track") {
|
||||
return {
|
||||
service: "deezer",
|
||||
type: type,
|
||||
id: result.id,
|
||||
name: result.title,
|
||||
streamUrl: result.album.link,
|
||||
purchaseUrl: null,
|
||||
artwork: artwork,
|
||||
artist: {
|
||||
name: result.artist.name
|
||||
},
|
||||
album: {
|
||||
name: result.album.title
|
||||
}
|
||||
};
|
||||
} else {
|
||||
throw new Error();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.search = function(data) {
|
||||
var cleanParam = function(str) {
|
||||
return str.replace(/[\:\?\&]+/, "");
|
||||
}
|
||||
var query, album;
|
||||
var type = data.type;
|
||||
module.exports.lookupId = function* (id, type) {
|
||||
let path = '/' + type + '/' + id;
|
||||
|
||||
if (type == "album") {
|
||||
query = cleanParam(data.artist.name) + " " + cleanParam(data.name);
|
||||
let {body} = yield request.get(apiRoot + path).promise();
|
||||
if (!body || body.error) {
|
||||
let error = new Error('Not Found');
|
||||
error.status = 404;
|
||||
return Promise.reject(error);
|
||||
}
|
||||
let item = body;
|
||||
let coverUrl = item.cover || item.album.cover;
|
||||
let cover = 'test';
|
||||
// nasty hacks for superagent-bluebird-promise
|
||||
try {
|
||||
cover = yield request.get(coverUrl).redirects(0);
|
||||
} catch(err) {
|
||||
cover = err.message.response.res;
|
||||
}
|
||||
let artwork = {
|
||||
small: cover.headers.location.replace('120x120', '200x200'),
|
||||
large: cover.headers.location.replace('120x120', '800x800')
|
||||
};
|
||||
if (type === 'album') {
|
||||
return Promise.resolve({
|
||||
service: 'deezer',
|
||||
type: type,
|
||||
id: item.id,
|
||||
name: item.title,
|
||||
streamUrl: item.link,
|
||||
purchaseUrl: null,
|
||||
artwork: artwork,
|
||||
artist: {
|
||||
name: item.artist.name
|
||||
}
|
||||
});
|
||||
} else if (type === 'track') {
|
||||
return Promise.resolve({
|
||||
service: 'deezer',
|
||||
type: type,
|
||||
id: item.id,
|
||||
name: item.title,
|
||||
streamUrl: item.album.link,
|
||||
purchaseUrl: null,
|
||||
artwork: artwork,
|
||||
artist: {
|
||||
name: item.artist.name
|
||||
},
|
||||
album: {
|
||||
name: item.album.title
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return Promise.reject(new Error());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.search = function* (data) {
|
||||
let cleanParam = function(str) {
|
||||
return str.replace(/[\:\?\&]+/, '');
|
||||
};
|
||||
let query, album;
|
||||
let {type} = data;
|
||||
|
||||
if (type === 'album') {
|
||||
query = cleanParam(data.artist.name) + ' ' + cleanParam(data.name);
|
||||
album = data.name;
|
||||
} else if (type == "track") {
|
||||
query = cleanParam(data.artist.name) + " " + cleanParam(data.album.name) + " " + cleanParam(data.name);
|
||||
} else if (type === 'track') {
|
||||
query = cleanParam(data.artist.name) + ' ' + cleanParam(data.album.name) + ' ' + cleanParam(data.name);
|
||||
album = data.album.name;
|
||||
}
|
||||
|
||||
var path = "/search/" + type + "?q=" + encodeURIComponent(query);
|
||||
return request.get(apiRoot + path).promise().then(function(res) {
|
||||
if (!res.body.data[0]) {
|
||||
var matches = album.match(/^[^\(\[]+/);
|
||||
if (matches && matches[0] && matches[0] != album) {
|
||||
var cleanedData = JSON.parse(JSON.stringify(data));
|
||||
if (type == "album") {
|
||||
cleanedData.name = matches[0].trim();
|
||||
} else if (type == "track") {
|
||||
cleanedData.album.name = matches[0].trim();
|
||||
}
|
||||
return module.exports.search(cleanedData);
|
||||
} else {
|
||||
return {service: "deezer"};
|
||||
var path = '/search/' + type + '?q=' + encodeURIComponent(query);
|
||||
let response = yield request.get(apiRoot + path);
|
||||
if (response.body.data[0]) {
|
||||
return yield module.exports.lookupId(response.body.data[0].id, type);
|
||||
} else {
|
||||
var matches = album.match(/^[^\(\[]+/);
|
||||
if (matches && matches[0] && matches[0] !== album) {
|
||||
var cleanedData = JSON.parse(JSON.stringify(data));
|
||||
if (type === 'album') {
|
||||
cleanedData.name = matches[0].trim();
|
||||
} else if (type === 'track') {
|
||||
cleanedData.album.name = matches[0].trim();
|
||||
}
|
||||
return yield module.exports.search(cleanedData);
|
||||
} else {
|
||||
return module.exports.lookupId(res.body.data[0].id, type);
|
||||
return Promise.resolve({service: 'deezer'});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,138 +1,134 @@
|
|||
"use strict";
|
||||
var parse = require("url").parse;
|
||||
var Promise = require('bluebird');
|
||||
var querystring = require('querystring');
|
||||
var request = require('superagent');
|
||||
require('superagent-bluebird-promise');
|
||||
import {parse} from 'url';
|
||||
import querystring from 'querystring';
|
||||
import request from 'superagent';
|
||||
import 'superagent-bluebird-promise';
|
||||
|
||||
module.exports.id = "itunes";
|
||||
module.exports.id = 'itunes';
|
||||
|
||||
var apiRoot = "https://itunes.apple.com";
|
||||
const apiRoot = 'https://itunes.apple.com';
|
||||
|
||||
module.exports.match = require('./url').match;
|
||||
|
||||
module.exports.parseUrl = function(url) {
|
||||
var parsed = parse(url);
|
||||
var matches = parsed.path.match(/[\/]?([\/]?[a-z]{2}?)?[\/]+album[\/]+([^\/]+)[\/]+([^\?]+)/);
|
||||
var query = querystring.parse(parsed.query);
|
||||
module.exports.parseUrl = function* (url) {
|
||||
let parsed = parse(url);
|
||||
let matches = parsed.path.match(/[\/]?([\/]?[a-z]{2}?)?[\/]+album[\/]+([^\/]+)[\/]+([^\?]+)/);
|
||||
let query = querystring.parse(parsed.query);
|
||||
|
||||
if (matches) {
|
||||
var type = "album";
|
||||
var id = matches[3].substr(2);
|
||||
let type = 'album';
|
||||
let id = matches[3].substr(2);
|
||||
if (query.i) {
|
||||
type = "track";
|
||||
type = 'track';
|
||||
id = query.i;
|
||||
}
|
||||
return module.exports.lookupId(id, type, matches[1] || "us");
|
||||
return yield module.exports.lookupId(id, type, matches[1] || 'us');
|
||||
} else {
|
||||
throw new Error();
|
||||
return Promise.reject(new Error());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.lookupId = function(id, type, cc) {
|
||||
module.exports.lookupId = function* (id, type, cc) {
|
||||
if (String(id).match(/^[a-z]{2}/)) {
|
||||
cc = id.substr(0,2);
|
||||
cc = id.substr(0, 2);
|
||||
id = id.substr(2);
|
||||
}
|
||||
|
||||
var path = "/lookup?id=" + id;
|
||||
let path = '/lookup?id=' + id;
|
||||
if (cc) {
|
||||
path = "/" + cc + path;
|
||||
path = '/' + cc + path;
|
||||
}
|
||||
|
||||
return request.get(apiRoot + path).promise().then(function(res) {
|
||||
var data = JSON.parse(res.text);
|
||||
let response = yield request.get(apiRoot + path);
|
||||
let result = JSON.parse(response.text);
|
||||
|
||||
if (!data.results || data.resultCount == 0 || !data.results[0].collectionId) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
throw error;
|
||||
} else {
|
||||
var result = data.results[0];
|
||||
if (!result.results || result.resultCount === 0 || !result.results[0].collectionId) {
|
||||
let error = new Error('Not Found');
|
||||
error.status = 404;
|
||||
return Promise.reject(error);
|
||||
} else {
|
||||
result = result.results[0];
|
||||
|
||||
var item = {
|
||||
service: "itunes",
|
||||
type: type,
|
||||
id: cc + id,
|
||||
name: result.trackName ? result.trackName : result.collectionName,
|
||||
streamUrl: null,
|
||||
purchaseUrl: result.collectionViewUrl,
|
||||
artwork: {
|
||||
small: "https://match.audio/itunes/" + result.artworkUrl100.replace("100x100", "200x200").replace("http://", ""),
|
||||
large: "https://match.audio/itunes/" + result.artworkUrl100.replace("100x100", "600x600").replace("http://", ""),
|
||||
},
|
||||
artist: {
|
||||
name: result.artistName
|
||||
}
|
||||
};
|
||||
|
||||
if (type == "track") {
|
||||
item.album = {
|
||||
name: result.collectionName
|
||||
};
|
||||
let item = {
|
||||
service: 'itunes',
|
||||
type: type,
|
||||
id: cc + id,
|
||||
name: result.trackName ? result.trackName : result.collectionName,
|
||||
streamUrl: null,
|
||||
purchaseUrl: result.collectionViewUrl,
|
||||
artwork: {
|
||||
small: 'https://match.audio/itunes/' + result.artworkUrl100.replace('100x100', '200x200').replace('http://', ''),
|
||||
large: 'https://match.audio/itunes/' + result.artworkUrl100.replace('100x100', '600x600').replace('http://', '')
|
||||
},
|
||||
artist: {
|
||||
name: result.artistName
|
||||
}
|
||||
};
|
||||
|
||||
return item;
|
||||
if (type === 'track') {
|
||||
item.album = {
|
||||
name: result.collectionName
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.resolve(item);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.search = function(data) {
|
||||
var query, album, entity;
|
||||
var type = data.type;
|
||||
module.exports.search = function* (data) {
|
||||
let query, album, entity;
|
||||
let type = data.type;
|
||||
|
||||
if (type == "album") {
|
||||
query = data.artist.name + " " + data.name;
|
||||
if (type === 'album') {
|
||||
query = data.artist.name + ' ' + data.name;
|
||||
album = data.name;
|
||||
entity = "album";
|
||||
} else if (type == "track") {
|
||||
query = data.artist.name + " " + data.album.name + " " + data.name;
|
||||
entity = 'album';
|
||||
} else if (type === 'track') {
|
||||
query = data.artist.name + ' ' + data.album.name + ' ' + data.name;
|
||||
album = data.album.name;
|
||||
entity = "musicTrack";
|
||||
entity = 'musicTrack';
|
||||
}
|
||||
|
||||
var path = "/search?term=" + encodeURIComponent(query) + "&media=music&entity=" + entity;
|
||||
return request.get(apiRoot + path).promise().then(function(res) {
|
||||
var result = JSON.parse(res.text);
|
||||
let path = '/search?term=' + encodeURIComponent(query) + '&media=music&entity=' + entity;
|
||||
let response = yield request.get(apiRoot + path);
|
||||
let result = JSON.parse(response.text);
|
||||
|
||||
if (!result.results[0]) {
|
||||
var matches = album.match(/^[^\(\[]+/);
|
||||
if (matches && matches[0] && matches[0] != album) {
|
||||
var cleanedData = JSON.parse(JSON.stringify(data));
|
||||
if (type == "album") {
|
||||
cleanedData.name = matches[0].trim();
|
||||
} else if (type == "track") {
|
||||
cleanedData.album.name = matches[0].trim();
|
||||
}
|
||||
return module.exports.search(cleanedData);
|
||||
} else {
|
||||
return {service: "itunes"};
|
||||
if (!result.results[0]) {
|
||||
let matches = album.match(/^[^\(\[]+/);
|
||||
if (matches && matches[0] && matches[0] !== album) {
|
||||
let cleanedData = JSON.parse(JSON.stringify(data));
|
||||
if (type === 'album') {
|
||||
cleanedData.name = matches[0].trim();
|
||||
} else if (type === 'track') {
|
||||
cleanedData.album.name = matches[0].trim();
|
||||
}
|
||||
return yield module.exports.search(cleanedData);
|
||||
} else {
|
||||
var result = result.results[0];
|
||||
|
||||
var item = {
|
||||
service: "itunes",
|
||||
type: type,
|
||||
id: "us" + result.collectionId,
|
||||
name: result.trackName ? result.trackName : result.collectionName,
|
||||
streamUrl: null,
|
||||
purchaseUrl: result.collectionViewUrl,
|
||||
artwork: {
|
||||
small: "https://match.audio/itunes/" + result.artworkUrl100.replace("100x100", "200x200").replace("http://", ""),
|
||||
large: "https://match.audio/itunes/" + result.artworkUrl100.replace("100x100", "600x600").replace("http://", ""),
|
||||
},
|
||||
artist: {
|
||||
name: result.artistName
|
||||
}
|
||||
};
|
||||
|
||||
if (type == "track") {
|
||||
item.album = {
|
||||
name: result.collectionName
|
||||
};
|
||||
}
|
||||
return item;
|
||||
return Promise.resolve({service: 'itunes'});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
result = result.results[0];
|
||||
|
||||
let item = {
|
||||
service: 'itunes',
|
||||
type: type,
|
||||
id: 'us' + result.collectionId,
|
||||
name: result.trackName ? result.trackName : result.collectionName,
|
||||
streamUrl: null,
|
||||
purchaseUrl: result.collectionViewUrl,
|
||||
artwork: {
|
||||
small: 'https://match.audio/itunes/' + result.artworkUrl100.replace('100x100', '200x200').replace('http://', ''),
|
||||
large: 'https://match.audio/itunes/' + result.artworkUrl100.replace('100x100', '600x600').replace('http://', '')
|
||||
},
|
||||
artist: {
|
||||
name: result.artistName
|
||||
}
|
||||
};
|
||||
|
||||
if (type === 'track') {
|
||||
item.album = {
|
||||
name: result.collectionName
|
||||
};
|
||||
}
|
||||
return Promise.resolve(item);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,8 +6,7 @@ module.exports.id = "rdio";
|
|||
|
||||
if (!process.env.RDIO_API_KEY || !process.env.RDIO_API_SHARED) {
|
||||
console.warn("RDIO_API_KEY or RDIO_API_SHARED environment variables not found, deactivating Rdio.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
var rdio = require('rdio')({
|
||||
rdio_api_key: process.env.RDIO_API_KEY,
|
||||
|
@ -178,3 +177,5 @@ module.exports.search = function(data) {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
}
|
|
@ -8,8 +8,7 @@ module.exports.id = "xbox";
|
|||
|
||||
if (!process.env.XBOX_CLIENT_ID || !process.env.XBOX_CLIENT_SECRET) {
|
||||
console.warn("XBOX_CLIENT_ID and XBOX_CLIENT_SECRET environment variables not found, deactivating Xbox Music.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
var credentials = {
|
||||
clientId: process.env.XBOX_CLIENT_ID,
|
||||
|
@ -104,3 +103,5 @@ module.exports.search = function(data) {
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@ module.exports.id = "youtube";
|
|||
|
||||
if (!process.env.YOUTUBE_KEY) {
|
||||
console.warn("YOUTUBE_KEY environment variable not found, deactivating Youtube.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
var credentials = {
|
||||
key: process.env.YOUTUBE_KEY,
|
||||
|
@ -136,3 +135,5 @@ module.exports.search = function(data) {
|
|||
return {service: "youtube"};
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue