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