Fix some year est issues & add ability for oputil fb scan --update to pick up years

This commit is contained in:
Bryan Ashby 2017-11-18 14:09:17 -07:00
parent 1b414b9b8c
commit f0b9cd102d
2 changed files with 17 additions and 8 deletions

View file

@ -172,8 +172,8 @@ function scanFileAreaForChanges(areaInfo, options, cb) {
//
// We'll update the entry if the following conditions are met:
// * We have a single duplicate, and:
// * --update was passed or the existing entry's desc or
// longDesc are blank/empty
// * --update was passed or the existing entry's desc,
// longDesc, or yearEst are blank/empty
//
if(argv.update && 1 === dupeEntries.length) {
const FileEntry = require('../../core/file_entry.js');
@ -193,15 +193,19 @@ function scanFileAreaForChanges(areaInfo, options, cb) {
if( tagsEq &&
fileEntry.desc === existingEntry.desc &&
fileEntry.descLong == existingEntry.descLong)
fileEntry.descLong == existingEntry.descLong &&
fileEntry.meta.est_release_year == existingEntry.meta.est_release_year)
{
console.info('Dupe');
return nextFile(null);
}
console.info('Dupe (updating)');
existingEntry.desc = fileEntry.desc;
existingEntry.descLong = fileEntry.descLong;
// don't allow overwrite of values if new version is blank
existingEntry.desc = fileEntry.desc || existingEntry.desc;
existingEntry.descLong = fileEntry.descLong || existingEntry.descLong;
existingEntry.meta.est_release_year = fileEntry.meta.est_release_year || existingEntry.meta.est_release_year;
updateTags(existingEntry);
finalizeEntryAndPersist(true, existingEntry, descHandler, err => {