[Android] Decode artworkMrl path at item creation

Geoffrey Métais git at videolan.org
Fri Feb 24 16:32:06 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 24 16:28:39 2017 +0100| [9fb81380bc478a5be8d5061bd66a8d14afa3951c] | committer: Geoffrey Métais

Decode artworkMrl path at item creation

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

 medialibrary/src/org/videolan/medialibrary/media/Album.java        | 3 ++-
 medialibrary/src/org/videolan/medialibrary/media/Artist.java       | 3 ++-
 medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/media/Album.java b/medialibrary/src/org/videolan/medialibrary/media/Album.java
index 7d2a6ac..f6ea5f3 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/Album.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/Album.java
@@ -3,6 +3,7 @@ package org.videolan.medialibrary.media;
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.medialibrary.Medialibrary;
 
 public class Album extends MediaLibraryItem {
@@ -16,7 +17,7 @@ public class Album extends MediaLibraryItem {
     public Album(long id, String title, int releaseYear, String artworkMrl, String albumArtist, long albumArtistId, int nbTracks, int duration) {
         super(id, title);
         this.releaseYear = releaseYear;
-        this.artworkMrl = artworkMrl;
+        this.artworkMrl = artworkMrl != null ? VLCUtil.UriFromMrl(artworkMrl).getPath() : null;
         this.albumArtist = albumArtist != null ? albumArtist.trim(): null;
         this.albumArtistId = albumArtistId;
         this.nbTracks = nbTracks;
diff --git a/medialibrary/src/org/videolan/medialibrary/media/Artist.java b/medialibrary/src/org/videolan/medialibrary/media/Artist.java
index b9cf0ae..3f4458a 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/Artist.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/Artist.java
@@ -3,6 +3,7 @@ package org.videolan.medialibrary.media;
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.medialibrary.Medialibrary;
 
 public class Artist extends MediaLibraryItem {
@@ -14,7 +15,7 @@ public class Artist extends MediaLibraryItem {
     public Artist(long id, String name, String shortBio, String artworkMrl, String musicBrainzId) {
         super(id, name);
         this.shortBio = shortBio;
-        this.artworkMrl = artworkMrl;
+        this.artworkMrl = artworkMrl != null ? VLCUtil.UriFromMrl(artworkMrl).getPath() : null;
         this.musicBrainzId = musicBrainzId;
     }
 
diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
index 10bc99c..07331b3 100644
--- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
+++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapper.java
@@ -32,6 +32,7 @@ import org.videolan.libvlc.Media.Meta;
 import org.videolan.libvlc.Media.VideoTrack;
 import org.videolan.libvlc.MediaPlayer;
 import org.videolan.libvlc.util.Extensions;
+import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.medialibrary.Medialibrary;
 import org.videolan.medialibrary.Tools;
 
@@ -129,7 +130,7 @@ public class MediaWrapper extends MediaLibraryItem implements Parcelable {
             mrl = "file://"+mrl;
         mUri = Uri.parse(mrl);
         mId = id;
-        init(time, length, type, null, title, artist, genre, album, albumArtist, width, height, artworkURL, audio, spu, trackNumber, discNumber, lastModified, null);
+        init(time, length, type, null, title, artist, genre, album, albumArtist, width, height, artworkURL != null ? VLCUtil.UriFromMrl(artworkURL).getPath() : null, audio, spu, trackNumber, discNumber, lastModified, null);
         sb.setLength(0);
         if (type == TYPE_AUDIO) {
             String artistMeta = getReferenceArtist();



More information about the Android mailing list