* try {media.Composer} as fallback if {media.Performer} is not set

@see https://www.filebot.net/forums/viewtopic.php?f=4&t=3061#p17550
This commit is contained in:
Reinhard Pointner 2015-11-07 13:24:44 +00:00
parent 35608f6789
commit d6569765be
1 changed files with 7 additions and 5 deletions

View File

@ -38,7 +38,7 @@ public class ID3Lookup implements MusicIdentificationService {
try { try {
// artist and song title information is required // artist and song title information is required
String artist = getString(mediaInfo, "Performer"); String artist = getString(mediaInfo, "Performer", "Composer");
String title = getString(mediaInfo, "Title"); String title = getString(mediaInfo, "Title");
if (artist != null && title != null) { if (artist != null && title != null) {
@ -70,11 +70,13 @@ public class ID3Lookup implements MusicIdentificationService {
return info; return info;
} }
private String getString(MediaInfo mediaInfo, String field) { private String getString(MediaInfo mediaInfo, String... keys) {
String value = mediaInfo.get(StreamKind.General, 0, field).trim(); for (String key : keys) {
String value = mediaInfo.get(StreamKind.General, 0, key);
if (value.length() > 0) { if (value.length() > 0) {
return value; return value;
} }
}
return null; return null;
} }