1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 08:25:02 -04:00

Add database property to AudioTrack object

This commit is contained in:
Reinhard Pointner 2016-04-05 18:05:47 +00:00
parent 2a039350e4
commit 83b0f999d9
4 changed files with 14 additions and 8 deletions

View File

@ -120,7 +120,7 @@ public class AcoustIDClient implements MusicIdentificationService {
if (artist == null || title == null || releaseGroup.isEmpty())
return null;
AudioTrack audioTrack = new AudioTrack(artist, title, null);
AudioTrack audioTrack = new AudioTrack(artist, title, null, getIdentifier());
audioTrack.mbid = getString(result, "id");
String type = getString(releaseGroup, "type");

View File

@ -4,6 +4,8 @@ import java.io.Serializable;
public class AudioTrack implements Serializable {
protected String database;
protected String artist;
protected String title;
protected String album;
@ -33,15 +35,17 @@ public class AudioTrack implements Serializable {
this.trackIndex = other.trackIndex;
this.trackCount = other.trackCount;
this.mbid = other.mbid;
this.database = other.database;
}
public AudioTrack(String artist, String title, String album) {
public AudioTrack(String artist, String title, String album, String database) {
this.artist = artist;
this.title = title;
this.album = album;
this.database = database;
}
public AudioTrack(String artist, String title, String album, String albumArtist, String trackTitle, SimpleDate albumReleaseDate, Integer mediumIndex, Integer mediumCount, Integer trackIndex, Integer trackCount, String mbid) {
public AudioTrack(String artist, String title, String album, String albumArtist, String trackTitle, SimpleDate albumReleaseDate, Integer mediumIndex, Integer mediumCount, Integer trackIndex, Integer trackCount, String mbid, String database) {
this.artist = artist;
this.title = title;
this.album = album;
@ -53,6 +57,7 @@ public class AudioTrack implements Serializable {
this.trackIndex = trackIndex;
this.trackCount = trackCount;
this.mbid = mbid;
this.database = database;
}
public String getArtist() {
@ -99,6 +104,10 @@ public class AudioTrack implements Serializable {
return mbid;
}
public String getDatabase() {
return database;
}
@Override
public AudioTrack clone() {
return new AudioTrack(this);

View File

@ -1,12 +1,10 @@
package net.filebot.web;
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
public class AudioTrackFormat extends Format {
@Override
@ -14,13 +12,12 @@ public class AudioTrackFormat extends Format {
return sb.append(obj.toString());
}
@Override
public AudioTrack parseObject(String source, ParsePosition pos) {
String[] s = source.split(" - ", 2);
if (s.length == 2) {
pos.setIndex(source.length());
return new AudioTrack(s[0].trim(), s[1].trim(), "VA");
return new AudioTrack(s[0].trim(), s[1].trim(), "VA", null);
} else {
pos.setErrorIndex(0);
return null;

View File

@ -70,7 +70,7 @@ public class ID3Lookup implements MusicIdentificationService {
}
}
info.put(f, new AudioTrack(artist, title, album, albumArtist, trackTitle, albumReleaseDate, mediumIndex, mediumCount, trackIndex, trackCount, mbid));
info.put(f, new AudioTrack(artist, title, album, albumArtist, trackTitle, albumReleaseDate, mediumIndex, mediumCount, trackIndex, trackCount, mbid, getIdentifier()));
}
} catch (Throwable e) {
debug.warning(e.getMessage());