Skip to content
Snippets Groups Projects
Commit cb6fc999 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Fix incorrect artist display on albums

'Various Artists' was displayed as 'Unknown Artist'

(cherry picked from commit c142ffe8)
parent 989c4ea3
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,10 @@ import org.videolan.medialibrary.Medialibrary;
import org.videolan.medialibrary.R;
public class Album extends MediaLibraryItem {
private static String UNKNOWN_ALBUM;
public static final String TAG = "VLC/Album";
static class SpecialRes {
static String UNKNOWN_ALBUM = Medialibrary.getContext().getString(R.string.unknown_album);
}
private int releaseYear;
private String artworkMrl;
......@@ -26,15 +29,11 @@ public class Album extends MediaLibraryItem {
this.albumArtistId = albumArtistId;
this.mTracksCount = nbTracks;
this.duration = duration;
if (TextUtils.isEmpty(title)) {
if (UNKNOWN_ALBUM == null)
UNKNOWN_ALBUM = Medialibrary.getContext().getString(R.string.unknown_album);
mTitle = UNKNOWN_ALBUM;
}
if (TextUtils.isEmpty(albumArtist)) {
if (Artist.UNKNOWN_ARTIST == null)
Artist.UNKNOWN_ARTIST = Medialibrary.getContext().getString(R.string.unknown_artist);
this.albumArtist = Artist.UNKNOWN_ARTIST;
if (TextUtils.isEmpty(title)) mTitle = SpecialRes.UNKNOWN_ALBUM;
if (albumArtistId == 1L) {
this.albumArtist = Artist.SpecialRes.UNKNOWN_ARTIST;
} else if (albumArtistId == 2L) {
this.albumArtist = Artist.SpecialRes.VARIOUS_ARTISTS;
}
}
......
......@@ -13,8 +13,10 @@ public class Artist extends MediaLibraryItem {
private String artworkMrl;
private String musicBrainzId;
static String UNKNOWN_ARTIST;
private static String VARIOUS_ARTISTS;
static class SpecialRes {
static String UNKNOWN_ARTIST = Medialibrary.getContext().getString(R.string.unknown_artist);
static String VARIOUS_ARTISTS = Medialibrary.getContext().getString(R.string.various_artists);
}
public Artist(long id, String name, String shortBio, String artworkMrl, String musicBrainzId) {
super(id, name);
......@@ -22,13 +24,9 @@ public class Artist extends MediaLibraryItem {
this.artworkMrl = artworkMrl != null ? VLCUtil.UriFromMrl(artworkMrl).getPath() : null;
this.musicBrainzId = musicBrainzId;
if (id == 1L) {
if (UNKNOWN_ARTIST == null)
UNKNOWN_ARTIST = Medialibrary.getContext().getString(R.string.unknown_artist);
mTitle = UNKNOWN_ARTIST;
mTitle = SpecialRes.UNKNOWN_ARTIST;
} else if (id == 2L) {
if (VARIOUS_ARTISTS == null)
VARIOUS_ARTISTS = Medialibrary.getContext().getString(R.string.various_artists);
mTitle = VARIOUS_ARTISTS;
mTitle = SpecialRes.VARIOUS_ARTISTS;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment