* make music matching work properly and adjust build

This commit is contained in:
Reinhard Pointner 2013-01-11 07:05:11 +00:00
parent 0171f31b09
commit bd3652ff2d
3 changed files with 27 additions and 12 deletions

View File

@ -244,7 +244,7 @@
</target> </target>
<target name="deb-arch"> <target name="deb-arch">
<deb todir="${dir.dist}" package="filebot" version="${version}" architecture="${arch}" section="misc" depends="default-jre-headless" recommends="openjdk-7-jre" homepage="http://filebot.sourceforge.net" priority="optional" postinst="${dir.installer}/deb/postinst.sh" prerm="${dir.installer}/deb/prerem.sh"> <deb todir="${dir.dist}" package="filebot" version="${version}" architecture="${arch}" section="misc" depends="openjdk-7-jre | default-jre-headless" recommends="libchromaprint-tools" homepage="http://filebot.sourceforge.net" priority="optional" postinst="${dir.installer}/deb/postinst.sh" prerm="${dir.installer}/deb/prerem.sh">
<maintainer name="Reinhard Pointner" email="rednoah@users.sourceforge.net" /> <maintainer name="Reinhard Pointner" email="rednoah@users.sourceforge.net" />
<description synopsis="The ultimate tv renamer / subtitle downloader / sfv validator">FileBot is the ultimate tool for renaming your movies, tv shows or anime and downloading subtitles. It's smart, streamlined for simplicity and just works. Plus there's a full-featured command-line interface for all sorts of automation.</description> <description synopsis="The ultimate tv renamer / subtitle downloader / sfv validator">FileBot is the ultimate tool for renaming your movies, tv shows or anime and downloading subtitles. It's smart, streamlined for simplicity and just works. Plus there's a full-featured command-line interface for all sorts of automation.</description>
<tarfileset fullpath="usr/share/filebot/FileBot.jar" file="${path.fatjar}" /> <tarfileset fullpath="usr/share/filebot/FileBot.jar" file="${path.fatjar}" />

View File

@ -34,8 +34,10 @@ class AudioFingerprintMatcher implements AutoCompleteMatcher {
// check audio files against acoustid // check audio files against acoustid
for (Entry<File, AudioTrack> it : service.lookup(filter(files, AUDIO_FILES)).entrySet()) { for (Entry<File, AudioTrack> it : service.lookup(filter(files, AUDIO_FILES)).entrySet()) {
if (it.getKey().exists() && it.getValue() != null) {
matches.add(new Match<File, AudioTrack>(it.getKey(), it.getValue())); matches.add(new Match<File, AudioTrack>(it.getKey(), it.getValue()));
} }
}
return matches; return matches;
} }

View File

@ -75,19 +75,28 @@ public class AcoustID {
if (!data.get("status").equals("ok")) { if (!data.get("status").equals("ok")) {
throw new IOException("acoustid responded with error: " + data.get("status")); throw new IOException("acoustid responded with error: " + data.get("status"));
} }
try {
Map<?, ?> recording = (Map<?, ?>) ((List<?>) ((Map<?, ?>) ((List<?>) data.get("results")).get(0)).get("recordings")).get(0); Map<?, ?> recording = (Map<?, ?>) ((List<?>) ((Map<?, ?>) ((List<?>) data.get("results")).get(0)).get("recordings")).get(0);
String artist = (String) ((Map<?, ?>) ((List<?>) recording.get("artists")).get(0)).get("name"); String artist = (String) ((Map<?, ?>) ((List<?>) recording.get("artists")).get(0)).get("name");
String title = (String) recording.get("title"); String title = (String) recording.get("title");
String album = (String) ((Map<?, ?>) ((List<?>) recording.get("releasegroups")).get(0)).get("title"); String album = null;
audioTrack = new AudioTrack(artist, title, album); try {
album = (String) ((Map<?, ?>) ((List<?>) recording.get("releasegroups")).get(0)).get("title");
} catch (Exception e) {
// allow album to be null
}
audioTrack = new AudioTrack(artist, title, album);
cache.put(url, audioTrack); cache.put(url, audioTrack);
return audioTrack; return audioTrack;
} catch (Exception e) {
// no results
return null;
}
} }
public List<Map<String, String>> fpcalc(Iterable<File> files) throws IOException { public List<Map<String, String>> fpcalc(Iterable<File> files) throws IOException, InterruptedException {
List<String> command = new ArrayList<String>(); List<String> command = new ArrayList<String>();
command.add("fpcalc"); command.add("fpcalc");
for (File f : files) { for (File f : files) {
@ -119,6 +128,10 @@ public class AcoustID {
scanner.close(); scanner.close();
} }
if (process.waitFor() != 0) {
throw new IOException("Failed to exec fpcalc: Exit code " + process.exitValue());
}
return results; return results;
} }
} }