Merge pull request #5951 from osmandapp/js_voice_routing
Prolog will be used if there is no js file
This commit is contained in:
commit
d4737f496c
4 changed files with 29 additions and 24 deletions
|
@ -219,7 +219,8 @@ public class LocalIndexHelper {
|
||||||
if (voiceDir.canRead()) {
|
if (voiceDir.canRead()) {
|
||||||
//First list TTS files, they are preferred
|
//First list TTS files, they are preferred
|
||||||
for (File voiceF : listFilesSorted(voiceDir)) {
|
for (File voiceF : listFilesSorted(voiceDir)) {
|
||||||
if (voiceF.isDirectory() && JSTTSCommandPlayerImpl.isMyData(voiceF)) {
|
if (voiceF.isDirectory() && (JSTTSCommandPlayerImpl.isMyData(voiceF)
|
||||||
|
|| TTSCommandPlayerImpl.isMyData(voiceF))) {
|
||||||
LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.TTS_VOICE_DATA, voiceF, backup, app);
|
LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.TTS_VOICE_DATA, voiceF, backup, app);
|
||||||
updateDescription(info);
|
updateDescription(info);
|
||||||
result.add(info);
|
result.add(info);
|
||||||
|
@ -230,7 +231,8 @@ public class LocalIndexHelper {
|
||||||
|
|
||||||
//Now list recorded voices
|
//Now list recorded voices
|
||||||
for (File voiceF : listFilesSorted(voiceDir)) {
|
for (File voiceF : listFilesSorted(voiceDir)) {
|
||||||
if (voiceF.isDirectory() && JSMediaCommandPlayerImpl.isMyData(voiceF)) {
|
if (voiceF.isDirectory() && (JSMediaCommandPlayerImpl.isMyData(voiceF)
|
||||||
|
|| MediaCommandPlayerImpl.isMyData(voiceF))) {
|
||||||
LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.VOICE_DATA, voiceF, backup, app);
|
LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.VOICE_DATA, voiceF, backup, app);
|
||||||
updateDescription(info);
|
updateDescription(info);
|
||||||
result.add(info);
|
result.add(info);
|
||||||
|
|
|
@ -46,6 +46,7 @@ import net.osmand.plus.views.MapControlsLayer;
|
||||||
import net.osmand.plus.voice.JSMediaCommandPlayerImpl;
|
import net.osmand.plus.voice.JSMediaCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.JSTTSCommandPlayerImpl;
|
import net.osmand.plus.voice.JSTTSCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
||||||
|
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameter;
|
import net.osmand.router.GeneralRouter.RoutingParameter;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -341,7 +342,8 @@ public class RoutePreferencesMenu {
|
||||||
if (extStorage.exists()) {
|
if (extStorage.exists()) {
|
||||||
for (File f : extStorage.listFiles()) {
|
for (File f : extStorage.listFiles()) {
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
if (JSMediaCommandPlayerImpl.isMyData(f) || JSTTSCommandPlayerImpl.isMyData(f)) {
|
if (JSMediaCommandPlayerImpl.isMyData(f) || JSTTSCommandPlayerImpl.isMyData(f)
|
||||||
|
|| MediaCommandPlayerImpl.isMyData(f) || TTSCommandPlayerImpl.isMyData(f)) {
|
||||||
setFiles.add(f.getName());
|
setFiles.add(f.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,6 +389,10 @@ public class ResourceManager {
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
String lang = f.getName().replace("-tts", "");
|
String lang = f.getName().replace("-tts", "");
|
||||||
File conf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS);
|
File conf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS);
|
||||||
|
if (!conf.exists()) {
|
||||||
|
conf = new File(f, "_config.p");
|
||||||
|
conf = conf.exists() ? conf : new File(f, "_ttsconfig.p");
|
||||||
|
}
|
||||||
if (conf.exists()) {
|
if (conf.exists()) {
|
||||||
indexFileNames.put(f.getName(), dateFormat.format(conf.lastModified())); //$NON-NLS-1$
|
indexFileNames.put(f.getName(), dateFormat.format(conf.lastModified())); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat
|
||||||
protected static final String DELAY_CONST = "delay_";
|
protected static final String DELAY_CONST = "delay_";
|
||||||
private static final String WEAR_ALERT = "WEAR_ALERT";
|
private static final String WEAR_ALERT = "WEAR_ALERT";
|
||||||
/** Must be sorted array! */
|
/** Must be sorted array! */
|
||||||
private final int[] sortedVoiceVersions;
|
private int[] sortedVoiceVersions;
|
||||||
private static AudioFocusHelper mAudioFocusHelper;
|
private static AudioFocusHelper mAudioFocusHelper;
|
||||||
protected String language = "";
|
protected String language = "";
|
||||||
protected int streamType;
|
protected int streamType;
|
||||||
|
@ -78,24 +78,23 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
|
||||||
this.streamType = ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(applicationMode);
|
this.streamType = ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(applicationMode);
|
||||||
// if (!ctx.getSettings().USE_JS_VOICE_GUIDANCE.get()) {
|
initVoiceDir(voiceProvider);
|
||||||
// if (log.isInfoEnabled()) {
|
if (voiceDir != null && (MediaCommandPlayerImpl.isMyData(voiceDir) || TTSCommandPlayerImpl.isMyData(voiceDir))) {
|
||||||
// log.info("Initializing prolog system : " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
|
if (log.isInfoEnabled()) {
|
||||||
// }
|
log.info("Initializing prolog system : " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
|
||||||
// try {
|
}
|
||||||
// prologSystem = new Prolog(getLibraries());
|
try {
|
||||||
// } catch (InvalidLibraryException e) {
|
prologSystem = new Prolog(getLibraries());
|
||||||
// log.error("Initializing error", e); //$NON-NLS-1$
|
} catch (InvalidLibraryException e) {
|
||||||
// throw new RuntimeException(e);
|
log.error("Initializing error", e); //$NON-NLS-1$
|
||||||
// }
|
throw new RuntimeException(e);
|
||||||
// init(voiceProvider, ctx.getSettings(), configFile);
|
}
|
||||||
// final Term langVal = solveSimplePredicate("language");
|
init(voiceProvider, ctx.getSettings(), configFile);
|
||||||
// if (langVal instanceof Struct) {
|
final Term langVal = solveSimplePredicate("language");
|
||||||
// language = ((Struct) langVal).getName();
|
if (langVal instanceof Struct) {
|
||||||
// }
|
language = ((Struct) langVal).getName();
|
||||||
// }
|
}
|
||||||
if (voiceProvider != null) {
|
} else {
|
||||||
initVoiceDir(voiceProvider);
|
|
||||||
language = voiceProvider.replace("-tts", "").replace("-formal", "");
|
language = voiceProvider.replace("-tts", "").replace("-formal", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,8 +146,6 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat
|
||||||
|
|
||||||
private void init(String voiceProvider, OsmandSettings settings, String configFile) throws CommandPlayerException {
|
private void init(String voiceProvider, OsmandSettings settings, String configFile) throws CommandPlayerException {
|
||||||
prologSystem.clearTheory();
|
prologSystem.clearTheory();
|
||||||
voiceDir = null;
|
|
||||||
initVoiceDir(voiceProvider);
|
|
||||||
|
|
||||||
// see comments below why it is impossible to read from zip (don't know
|
// see comments below why it is impossible to read from zip (don't know
|
||||||
// how to play file from zip)
|
// how to play file from zip)
|
||||||
|
|
Loading…
Reference in a new issue