Don't be so dumb

This commit is contained in:
Jonathan Cremin 2014-12-05 22:20:17 +00:00
parent 49cf87d5c9
commit e9a5f6713d
6 changed files with 6 additions and 6 deletions

View file

@ -91,7 +91,7 @@ module.exports.search = function(data) {
request.get(apiRoot + path, function(res) {
if (!res.body.data[0]) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0]) {
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();

View file

@ -79,7 +79,7 @@ module.exports.search = function(data, next) {
request.get(apiRoot + path, function(res) {
if (!res.body.data[0]) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0]) {
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();

View file

@ -84,7 +84,7 @@ module.exports.search = function(data) {
pm.search(query, 5, function(result) {
if (!result.entries) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0]) {
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();

View file

@ -72,7 +72,7 @@ module.exports.search = function(data) {
if (!result.results[0]) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0]) {
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();

View file

@ -122,7 +122,7 @@ module.exports.search = function(data) {
if (!result) {
var matches = albumClean.match(/^[^\(\[]+/);
if (matches[0]) {
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();

View file

@ -77,7 +77,7 @@ module.exports.search = function(data) {
if (!data[type + "s"].items[0]) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0]) {
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();