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
1 changed files with 11 additions and 1 deletions

View File

@ -181,12 +181,22 @@ public class LocalFeedUpdater {
file.getUri().toString(), file.getUri().toString(), false, null, 0, 0);
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 {
loadMetadata(item, file, context);
} catch (Exception e) {
item.setDescriptionIfLonger(e.getMessage());
}
return item;
}