1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 08:48:51 -05:00

* 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

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,10 +70,12 @@ public class ID3Lookup implements MusicIdentificationService {
return info;
}
private String getString(MediaInfo mediaInfo, String field) {
String value = mediaInfo.get(StreamKind.General, 0, field).trim();
if (value.length() > 0) {
return value;
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;
}