diff options
author | ByteHamster <info@bytehamster.com> | 2022-10-21 22:01:47 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-10-21 22:01:47 +0200 |
commit | c7e41c31b61e830eabf4df6eeb06d86d36939d97 (patch) | |
tree | bdf7db131ed2857cf61e65dd6045f4c072453d54 /core | |
parent | 9624d8ce9e5e5dc4df6330197e3294a079e3eb94 (diff) | |
download | AntennaPod-c7e41c31b61e830eabf4df6eeb06d86d36939d97.zip |
If file size and name are the same, just assume that the metadata is the same as well
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java index 742df3f14..8ee924243 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java @@ -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; } |