Support --db ID3 (same as "ID3 Tags")

This commit is contained in:
Reinhard Pointner 2016-03-28 20:45:43 +00:00
parent 5ff4be457e
commit d74347591b
5 changed files with 21 additions and 7 deletions

View File

@ -104,7 +104,7 @@ public final class WebServices {
}
private static <T extends Datasource> T getService(String name, T[] services) {
return StreamEx.of(services).findFirst(it -> it.getIdentifier().equalsIgnoreCase(name)).orElse(null);
return StreamEx.of(services).findFirst(it -> it.getIdentifier().equalsIgnoreCase(name) || it.getName().equalsIgnoreCase(name)).orElse(null);
}
public static final ExecutorService requestThreadPool = Executors.newCachedThreadPool();

View File

@ -30,7 +30,7 @@ public class ArgumentBean {
@Option(name = "-rename", usage = "Rename media files")
public boolean rename = false;
@Option(name = "--db", usage = "Database", metaVar = "[TheTVDB, AniDB] or [TheMovieDB] or [AcoustID, ID3 Tags] or [xattr]")
@Option(name = "--db", usage = "Database", metaVar = "[TheTVDB, AniDB] or [TheMovieDB] or [AcoustID, ID3] or [xattr]")
public String db;
@Option(name = "--order", usage = "Episode order", metaVar = "[Airdate, Absolute, DVD]")

View File

@ -92,21 +92,25 @@ public class Preset {
}
public AutoCompleteMatcher getAutoCompleteMatcher() {
EpisodeListProvider sdb = WebServices.getEpisodeListProvider(database);
if (sdb != null) {
return new EpisodeListMatcher(sdb, sdb != WebServices.AniDB, sdb == WebServices.AniDB);
}
MovieIdentificationService mdb = WebServices.getMovieIdentificationService(database);
if (mdb != null) {
return new MovieHashMatcher(mdb);
}
EpisodeListProvider sdb = WebServices.getEpisodeListProvider(database);
if (sdb != null) {
return new EpisodeListMatcher(sdb, sdb != WebServices.AniDB, sdb == WebServices.AniDB);
}
MusicIdentificationService adb = WebServices.getMusicIdentificationService(database);
if (adb != null) {
return new AudioFingerprintMatcher(adb);
}
if (PlainFileMatcher.getInstance().getIdentifier().equals(database)) {
return PlainFileMatcher.getInstance();
}
throw new IllegalStateException(database);
}
@ -114,21 +118,26 @@ public class Preset {
if (database == null || database.isEmpty()) {
return null;
}
MovieIdentificationService mdb = WebServices.getMovieIdentificationService(database);
if (mdb != null) {
return mdb;
}
EpisodeListProvider sdb = WebServices.getEpisodeListProvider(database);
if (sdb != null) {
return sdb;
}
MusicIdentificationService adb = WebServices.getMusicIdentificationService(database);
if (adb != null) {
return adb;
}
if (PlainFileMatcher.getInstance().getIdentifier().equals(database)) {
return PlainFileMatcher.getInstance();
}
throw new IllegalStateException(database);
}

View File

@ -23,6 +23,11 @@ public class ID3Lookup implements MusicIdentificationService {
return "ID3 Tags";
}
@Override
public String getIdentifier() {
return "ID3";
}
@Override
public Icon getIcon() {
return ResourceManager.getIcon("search.mediainfo");

View File

@ -181,7 +181,7 @@
<td>Movie mode: TheMovieDB, OMDb</td>
</tr>
<tr>
<td>Music mode: AcoustID, ID3 Tags</td>
<td>Music mode: AcoustID, ID3</td>
</tr>
</table>
</td>