* enable use ID3 Tags as datasource in GUI

This commit is contained in:
Reinhard Pointner 2013-11-14 13:24:30 +00:00
parent e2e4ee240e
commit 64c3d77100
3 changed files with 15 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

View File

@ -61,6 +61,7 @@ import net.sourceforge.filebot.web.EpisodeListProvider;
import net.sourceforge.filebot.web.Movie;
import net.sourceforge.filebot.web.MovieFormat;
import net.sourceforge.filebot.web.MovieIdentificationService;
import net.sourceforge.filebot.web.MusicIdentificationService;
import net.sourceforge.filebot.web.SortOrder;
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
import net.sourceforge.tuned.ui.ActionPopup;
@ -300,7 +301,9 @@ public class RenamePanel extends JComponent {
actionPopup.addSeparator();
actionPopup.addDescription(new JLabel("Music Mode:"));
actionPopup.add(new AutoCompleteAction(WebServices.AcoustID.getName(), WebServices.AcoustID.getIcon(), new AudioFingerprintMatcher(WebServices.AcoustID)));
for (MusicIdentificationService it : WebServices.getMusicIdentificationServices()) {
actionPopup.add(new AutoCompleteAction(it.getName(), it.getIcon(), new AudioFingerprintMatcher(it)));
}
actionPopup.addSeparator();
actionPopup.addDescription(new JLabel("Options:"));

View File

@ -1,7 +1,5 @@
package net.sourceforge.filebot.web;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@ -9,43 +7,41 @@ import java.util.Map;
import javax.swing.Icon;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.mediainfo.MediaInfo;
import net.sourceforge.filebot.mediainfo.MediaInfo.StreamKind;
public class ID3Lookup implements MusicIdentificationService {
@Override
public String getName() {
return "ID3";
return "ID3 Tags";
}
@Override
public Icon getIcon() {
return null;
return ResourceManager.getIcon("search.mediainfo");
}
@Override
public Map<File, AudioTrack> lookup(Iterable<File> files) throws Exception {
Map<File, AudioTrack> info = new HashMap<File, AudioTrack>();
MediaInfo mediaInfo = new MediaInfo();
for (File f : files) {
if (!mediaInfo.open(f)) {
throw new IOException("MediaInfo failed to open file: " + f);
}
String artist = mediaInfo.get(StreamKind.General, 0, "Performer");
String title = mediaInfo.get(StreamKind.General, 0, "Title");
String album = mediaInfo.get(StreamKind.General, 0, "Album");
mediaInfo.close();
info.put(f, new AudioTrack(artist, title, album));
}
return info;
}
}