If file size and name are the same, just assume that the metadata is the same as well
This commit is contained in:
parent
9624d8ce9e
commit
c7e41c31b6
@ -181,12 +181,22 @@ public class LocalFeedUpdater {
|
|||||||
file.getUri().toString(), file.getUri().toString(), false, null, 0, 0);
|
file.getUri().toString(), file.getUri().toString(), false, null, 0, 0);
|
||||||
item.setMedia(media);
|
item.setMedia(media);
|
||||||
|
|
||||||
|
for (FeedItem existingItem : feed.getItems()) {
|
||||||
|
if (existingItem.getMedia() != null
|
||||||
|
&& existingItem.getMedia().getDownload_url().equals(file.getUri().toString())
|
||||||
|
&& file.getLength() == existingItem.getMedia().getSize()) {
|
||||||
|
// We found an old file that we already scanned. Re-use metadata.
|
||||||
|
item.updateFromOther(existingItem);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Did not find existing item. Scan metadata.
|
||||||
try {
|
try {
|
||||||
loadMetadata(item, file, context);
|
loadMetadata(item, file, context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
item.setDescriptionIfLonger(e.getMessage());
|
item.setDescriptionIfLonger(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user