Improved ogg voice guidance initialization

This commit is contained in:
PaulStets 2018-08-08 11:53:22 +03:00
parent 8eaedd8d38
commit 72da03870e
3 changed files with 11 additions and 2 deletions

View file

@ -583,7 +583,7 @@ public class AppInitializer implements IProgress {
if (useJs && JSTTSCommandPlayerImpl.isMyData(voiceDir)) {
return new JSTTSCommandPlayerImpl(ctx, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider);
} else if (MediaCommandPlayerImpl.isMyData(voiceDir)) {
return useJs ? new JSMediaCommandPlayerImpl(osmandApplication, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider)
return useJs && JSMediaCommandPlayerImpl.isMyData(voiceDir) ? new JSMediaCommandPlayerImpl(osmandApplication, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider)
: new MediaCommandPlayerImpl(osmandApplication, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider);
} else if (TTSCommandPlayerImpl.isMyData(voiceDir)) {
return new TTSCommandPlayerImpl(ctx, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider);

View file

@ -89,4 +89,13 @@ public class JSMediaCommandPlayerImpl extends MediaCommandPlayerImpl {
return commandBuilder;
}
public static boolean isMyData(File voiceDir) {
for (File f : voiceDir.listFiles()) {
if (f.getName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) {
return true;
}
}
return false;
}
}

View file

@ -159,7 +159,7 @@ public class MediaCommandPlayerImpl extends AbstractPrologCommandPlayer implemen
* @param file
*/
private void playFile(File file) {
if (!file.exists()) {
if (!file.exists() || file.isDirectory()) {
log.error("Unable to play, does not exist: "+file);
playQueue();
return;