[Android] Add isPodcast method to MediaWrapper

Geoffrey Métais git at videolan.org
Mon May 29 15:33:03 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 29 15:30:16 2017 +0200| [e72b1c1c1a7f9719d02afd4996027652197fa026] | committer: Geoffrey Métais

Add isPodcast method to MediaWrapper

> https://code.videolan.org/videolan/vlc-android/commit/e72b1c1c1a7f9719d02afd4996027652197fa026
---

 .../src/org/videolan/medialibrary/media/MediaWrapper.java         | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
index 0459beea8..2c6968c98 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
@@ -82,6 +82,9 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
 
     private static final StringBuilder sb = new StringBuilder();
 
+    // threshold lentgh between song and podcast ep, set to 15 minutes
+    private static final long PODCAST_THRESHOLD = 900000L;
+
     protected String mDisplayTitle;
     private String mArtist;
     private String mGenre;
@@ -391,6 +394,11 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
         return mType;
     }
 
+    public boolean isPodcast() {
+        return mType == TYPE_AUDIO && (TextUtils.isEmpty(mAlbum) && mLength > PODCAST_THRESHOLD)
+                || ("podcast".equalsIgnoreCase(mGenre));
+    }
+
     public void setType(int type){
         mType = type;
     }



More information about the Android mailing list