Make ID3 genre value available via {genre} binding (works only if ID3 Lookup is used)

This commit is contained in:
Reinhard Pointner 2017-12-21 10:17:13 +01:00
parent ee7c19d443
commit ab94a16705
3 changed files with 12 additions and 2 deletions

View File

@ -630,6 +630,8 @@ public class MediaBindingBean {
return getMovieInfo().getGenres();
if (infoObject instanceof Episode)
return getSeriesInfo().getGenres();
if (infoObject instanceof AudioTrack)
return Stream.of(getMusic().getGenre()).filter(Objects::nonNull).collect(toList());
return null;
}

View File

@ -12,6 +12,7 @@ public class AudioTrack implements Serializable {
protected String albumArtist;
protected String trackTitle;
protected String genre;
protected SimpleDate albumReleaseDate;
protected Integer mediumIndex;
protected Integer mediumCount;
@ -30,6 +31,7 @@ public class AudioTrack implements Serializable {
this.album = other.album;
this.albumArtist = other.albumArtist;
this.trackTitle = other.trackTitle;
this.genre = other.genre;
this.albumReleaseDate = other.albumReleaseDate;
this.mediumIndex = other.mediumIndex;
this.mediumCount = other.mediumCount;
@ -46,12 +48,13 @@ public class AudioTrack implements Serializable {
this.database = database;
}
public AudioTrack(String artist, String title, String album, String albumArtist, String trackTitle, SimpleDate albumReleaseDate, Integer mediumIndex, Integer mediumCount, Integer trackIndex, Integer trackCount, String mbid, String database) {
public AudioTrack(String artist, String title, String album, String albumArtist, String trackTitle, String genre, SimpleDate albumReleaseDate, Integer mediumIndex, Integer mediumCount, Integer trackIndex, Integer trackCount, String mbid, String database) {
this.artist = artist;
this.title = title;
this.album = album;
this.albumArtist = albumArtist;
this.trackTitle = trackTitle;
this.genre = genre;
this.albumReleaseDate = albumReleaseDate;
this.mediumIndex = mediumIndex;
this.mediumCount = mediumCount;
@ -81,6 +84,10 @@ public class AudioTrack implements Serializable {
return trackTitle;
}
public String getGenre() {
return genre;
}
public SimpleDate getAlbumReleaseDate() {
return albumReleaseDate;
}

View File

@ -95,6 +95,7 @@ public class ID3Lookup implements MusicIdentificationService {
String album = getString(m, "Album");
String albumArtist = getString(m, "Album/Performer");
String trackTitle = getString(m, "Track");
String genre = getString(m, "Genre");
Integer mediumIndex = null;
Integer mediumCount = null;
Integer trackIndex = getInteger(m, "Track/Position");
@ -113,7 +114,7 @@ public class ID3Lookup implements MusicIdentificationService {
}
}
return new AudioTrack(artist, title, album, albumArtist, trackTitle, albumReleaseDate, mediumIndex, mediumCount, trackIndex, trackCount, mbid, getIdentifier());
return new AudioTrack(artist, title, album, albumArtist, trackTitle, genre, albumReleaseDate, mediumIndex, mediumCount, trackIndex, trackCount, mbid, getIdentifier());
}
public Episode getEpisode(MediaInfo m) {