qobuz_importer.user.js: Fix single performer, fix quotes in title.

Fix parsing error when performers is missing, use performer for trackobj.
Fix import error bad request 400 with quoted track titles.
This commit is contained in:
Jaakko Perttilä 2018-11-20 19:05:55 +02:00
parent 667090ca7d
commit 5dd6eda4d1

View file

@ -83,13 +83,13 @@ function parseRelease(data) {
tracks = []; tracks = [];
} }
var track = {}; var track = {};
track.title = trackobj.title; track.title = trackobj.title.replace('"','\"');
track.duration = trackobj.duration * 1000; track.duration = trackobj.duration * 1000;
var performers = trackobj.performers.split('\r - ').map(function(v) { var performers = (typeof trackobj.performers !== 'undefined') && trackobj.performers.split('\r - ').map(function(v) {
var list = v.split(', '); var list = v.split(', ');
var name = list.shift(); var name = list.shift();
return [name, list]; return [name, list];
}); }) || [trackobj.performer.name, ['Primary']];
var artists = []; var artists = [];
var featured_artists = []; var featured_artists = [];
$.each(performers, function(index, performer) { $.each(performers, function(index, performer) {