for (String id : allDidlIds) {
touchedDidlMap.addDidl(id, null);
}
for (final ScanFolderDomain sfd : system.getScanFolder()) {
if (idScanContextMap.containsKey(sfd.getId())) {
final ScanContext sc = idScanContextMap.get(sfd.getId());
logger.info("scanner [filter] "+sc.getScanFolder());
for (final ScanFile f : sc.getFiles()) {
final FileDomain fd = new FileDomain(f.getId(), null, f.getFile());
if (this.didl.createDidl(fd, f, touchedDidlMap, sfd)) {
sc.getMediaFiles().add(fd);
}
}
logger.info("scanner [found new files] " + sc.getMediaFiles().size() + " " +sc.getScanFolder());
}
}
}
// update folders
for (final ScanFolderDomain sfd : system.getScanFolder()) {
if (idScanContextMap.containsKey(sfd.getId())) {
final ScanContext sc = idScanContextMap.get(sfd.getId());
boolean changedFiles = false;
for (final FileDomain fd : sc.getMediaFiles()) {
changedFiles |= sfd.addFile(fd);
logger.info("scanner [add file] " + fd.getName() + "\t\t(" + fd.getPath() + ")");
}
if (changedFiles || !sc.getDeletedMediaFiles().isEmpty()) {
changedFiles |= updateDidl(sfd.getDidlRoot(), sfd, touchedDidlMap,sc.getDeletedMediaFiles(), itemsToPurge);
}
// remove scanfolder mark
sfd.setScanState(ScanFolderState.IDLE);
sfd.setLastScan(new Date());