If file size and name are the same, just assume that the metadata is the same as well

This commit is contained in:
ByteHamster 2022-10-21 22:01:47 +02:00
parent 9624d8ce9e
commit c7e41c31b6

View File

@ -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;
} }