diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index 254293298c..8c84c0d85d 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java index 54d713431b..b1b0b28dfc 100644 --- a/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java @@ -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; + } + } diff --git a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java index 6e439b2fe0..a3366dec37 100644 --- a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java @@ -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;