Fix missing tracks too.
This commit is contained in:
parent
a919d80f64
commit
82bac11f5a
1 changed files with 13 additions and 13 deletions
|
@ -24,11 +24,11 @@ const query = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
function* search(data, done) {
|
function* search(data) {
|
||||||
const share = data.share;
|
const share = data.share;
|
||||||
const service = services.find(item => data.service.id === item.id);
|
const service = services.find(item => data.service.id === item.id);
|
||||||
|
|
||||||
debug(`Matching ${share.name} on ${data.service.id}`)
|
debug(`Matching ${share.name} on ${data.service.id}`);
|
||||||
|
|
||||||
const match = yield service.search(share);
|
const match = yield service.search(share);
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ function* search(data, done) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
co(function* () {
|
function* find(model) {
|
||||||
const albums = yield models.album.findAll(query);
|
const items = yield models[model].findAll(query);
|
||||||
for (const item of albums) {
|
for (const item of items) {
|
||||||
const unmatched = serviceIds;
|
let unmatched = serviceIds;
|
||||||
for (const match of item.matches) {
|
for (const match of item.matches) {
|
||||||
unmatched = unmatched.filter(id => match.service !== id);
|
unmatched = unmatched.filter(id => match.service !== id);
|
||||||
}
|
}
|
||||||
|
@ -74,14 +74,14 @@ co(function* () {
|
||||||
yield search({ share: item, service: { id: toMatch } });
|
yield search({ share: item, service: { id: toMatch } });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug(`No broken matches for ${item.name}`)
|
debug(`No broken matches for ${item.name}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(function (err) {
|
}
|
||||||
|
|
||||||
|
co(function* main() {
|
||||||
|
yield find('album');
|
||||||
|
yield find('track');
|
||||||
|
}).catch((err) => {
|
||||||
debug(err.stack);
|
debug(err.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue