Permalink
Browse files

possible fix for issue 38 - podcast size drops?

  • Loading branch information...
1 parent 54d99dd commit 27f63e0f576e09b8a9b61b0ff7ba1e054848676c @thasmin committed Apr 18, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/com/axelby/podax/PodcastProvider.java
@@ -334,10 +334,20 @@ public Uri insert(Uri uri, ContentValues values) {
podcastId = mediaUrlCursor.getLong(0);
mediaUrlCursor.close();
- if (podcastId != null)
+ if (podcastId != null) {
+ if (values.containsKey(COLUMN_MEDIA_URL) && values.containsKey(COLUMN_FILE_SIZE)) {
+ String file = PodcastCursor.getStoragePath() +
+ String.valueOf(podcastId) + "." +
+ PodcastCursor.getExtension(values.getAsString(COLUMN_MEDIA_URL));
+ // possible bug: file size shrinks for some reason -- don't use new one
+ if (new File(file).length() > values.getAsInteger(COLUMN_FILE_SIZE)) {
+ PodaxLog.log(getContext(), "file size is less than existing file");
+ values.remove(COLUMN_FILE_SIZE);
+ }
+ }
db.update("podcasts", values, COLUMN_ID + " = ?",
new String[] { String.valueOf(podcastId) });
- else {
+ } else {
podcastId = db.insert("podcasts", null, values);
// if the new podcast is less than 5 days old, add it to the queue
if (values.containsKey(COLUMN_PUB_DATE)) {

0 comments on commit 27f63e0

Please sign in to comment.