Removed prolog voice guidance

This commit is contained in:
PaulStets 2018-08-28 15:51:43 +03:00
parent 3377577787
commit cc4f40ec42
10 changed files with 26 additions and 113 deletions

View file

@ -5,43 +5,6 @@
<!-- alwaysCopyOnFirstInstall - Copies file on first install, always -->
<!-- alwaysOverwriteOrCopy - Copies or overwrites file unconditionally -->
<!-- copyOnlyIfDoesNotExist - Copies file only this file is not present on target system -->
<asset source="voice/ar/ttsconfig.p" destination="voice/ar-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/be/ttsconfig.p" destination="voice/be-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/cs/ttsconfig.p" destination="voice/cs-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/da/ttsconfig.p" destination="voice/da-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/de/ttsconfig.p" destination="voice/de-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/el/ttsconfig.p" destination="voice/el-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/en/ttsconfig.p" destination="voice/en-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/en-gb/ttsconfig.p" destination="voice/en-gb-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/es/ttsconfig.p" destination="voice/es-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/es-ar/ttsconfig.p" destination="voice/es-ar-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/et/ttsconfig.p" destination="voice/et-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/fa/ttsconfig.p" destination="voice/fa-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/fi/ttsconfig.p" destination="voice/fi-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/fr/ttsconfig.p" destination="voice/fr-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/he/ttsconfig.p" destination="voice/he-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/hi/ttsconfig.p" destination="voice/hi-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/hr/ttsconfig.p" destination="voice/hr-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/hu/ttsconfig.p" destination="voice/hu-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/hu-formal/ttsconfig.p" destination="voice/hu_formal-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/it/ttsconfig.p" destination="voice/it-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/ja/ttsconfig.p" destination="voice/ja-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/ko/ttsconfig.p" destination="voice/ko-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/lv/ttsconfig.p" destination="voice/lv-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/nl/ttsconfig.p" destination="voice/nl-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/pl/ttsconfig.p" destination="voice/pl-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/pt/ttsconfig.p" destination="voice/pt-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/pt-br/ttsconfig.p" destination="voice/pt-br-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/ro/ttsconfig.p" destination="voice/ro-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/ru/ttsconfig.p" destination="voice/ru-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/sc/ttsconfig.p" destination="voice/sc-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/sk/ttsconfig.p" destination="voice/sk-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/sl/ttsconfig.p" destination="voice/sl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/sv/ttsconfig.p" destination="voice/sv-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/sw/ttsconfig.p" destination="voice/sw-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/uk/ttsconfig.p" destination="voice/uk-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<asset source="voice/zh/ttsconfig.p" destination="voice/zh-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
<asset source="voice/zh-hk/ttsconfig.p" destination="voice/zh-hk-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
<!--JavaScript files-->
<asset source="voice/ar/ar_tts.js" destination="voice/ar-tts/ar_tts.js" mode="overwriteOnlyIfExists" />
@ -82,14 +45,6 @@
<asset source="voice/zh/zh_tts.js" destination="voice/zh-tts/zh_tts.js" mode="alwaysOverwriteOrCopy" />
<asset source="voice/zh-hk/zh-hk_tts.js" destination="voice/zh-hk-tts/zh-hk_tts.js" mode="overwriteOnlyIfExists" />
<asset source="voice/de/config.p" destination="voice/de/_config.p" mode="overwriteOnlyIfExists" />
<asset source="voice/en/config.p" destination="voice/en/_config.p" mode="overwriteOnlyIfExists" />
<asset source="voice/es/config.p" destination="voice/es/_config.p" mode="overwriteOnlyIfExists" />
<asset source="voice/fa/config.p" destination="voice/fa/_config.p" mode="overwriteOnlyIfExists" />
<asset source="voice/it/config.p" destination="voice/it/_config.p" mode="overwriteOnlyIfExists" />
<asset source="voice/pt/config.p" destination="voice/pt/_config.p" mode="overwriteOnlyIfExists" />
<asset source="voice/ru/config.p" destination="voice/ru/_config.p" mode="overwriteOnlyIfExists" />
<asset source="fonts/05_NotoSans-Regular.ttf" destination="fonts/05_NotoSans-Regular.ttf" mode="alwaysOverwriteOrCopy" />
<asset source="fonts/10_NotoSans-Bold.ttf" destination="fonts/10_NotoSans-Bold.ttf" mode="alwaysOverwriteOrCopy" />
<asset source="fonts/15_NotoSans-Italic.ttf" destination="fonts/15_NotoSans-Italic.ttf" mode="alwaysOverwriteOrCopy" />

View file

@ -237,7 +237,6 @@ task validateTranslate {
task collectVoiceAssets(type: Sync) {
from "../../resources/voice"
into "assets/voice"
include "**/*.p"
include "**/*.js"
}

View file

@ -585,10 +585,9 @@ public class AppInitializer implements IProgress {
if (!voiceDir.exists()) {
throw new CommandPlayerException(ctx.getString(R.string.voice_data_unavailable));
}
boolean useJs = app.getSettings().USE_JS_VOICE_GUIDANCE.get();
if (useJs && JSTTSCommandPlayerImpl.isMyData(voiceDir)) {
if (JSTTSCommandPlayerImpl.isMyData(voiceDir)) {
return new JSTTSCommandPlayerImpl(ctx, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider);
} else if (useJs && JSMediaCommandPlayerImpl.isMyData(voiceDir)) {
} else if (JSMediaCommandPlayerImpl.isMyData(voiceDir)) {
return new JSMediaCommandPlayerImpl(osmandApplication, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider);
} else if (TTSCommandPlayerImpl.isMyData(voiceDir)) {
return new TTSCommandPlayerImpl(ctx, applicationMode, osmandApplication.getRoutingHelper().getVoiceRouter(), voiceProvider);

View file

@ -1346,7 +1346,6 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> ANIMATE_MY_LOCATION = new BooleanPreference("animate_my_location", true).makeGlobal().cache();
public final OsmandPreference<Boolean> USE_JS_VOICE_GUIDANCE = new BooleanPreference("use_js_voice_guidance", true);
public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_START_MY_LOC = new BooleanPreference("route_map_markers_start_my_loc", false).makeGlobal().cache();
public final OsmandPreference<Boolean> ROUTE_MAP_MARKERS_ROUND_TRIP = new BooleanPreference("route_map_markers_round_trip", false).makeGlobal().cache();

View file

@ -216,12 +216,11 @@ public class LocalIndexHelper {
private void loadVoiceData(File voiceDir, List<LocalIndexInfo> result, boolean backup, AbstractLoadLocalIndexTask loadTask) {
if (voiceDir.canRead()) {
boolean useJs = app.getSettings().USE_JS_VOICE_GUIDANCE.get();
//First list TTS files, they are preferred
for (File voiceF : listFilesSorted(voiceDir)) {
if (voiceF.isDirectory() && !MediaCommandPlayerImpl.isMyData(voiceF)) {
LocalIndexInfo info = null;
if ((TTSCommandPlayerImpl.isMyData(voiceF) && !useJs) || (JSTTSCommandPlayerImpl.isMyData(voiceF) && useJs)) {
if (JSTTSCommandPlayerImpl.isMyData(voiceF)) {
info = new LocalIndexInfo(LocalIndexType.TTS_VOICE_DATA, voiceF, backup, app);
}
if (info != null) {

View file

@ -33,8 +33,6 @@ import java.util.Set;
public class SettingsDevelopmentActivity extends SettingsBaseActivity {
private StateChangedListener<Boolean> useJSVoiceGuidanceListener;
@SuppressLint("SimpleDateFormat")
@Override
public void onCreate(Bundle savedInstanceState) {
@ -64,18 +62,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.ANIMATE_MY_LOCATION,
R.string.animate_my_location,
R.string.animate_my_location_desc));
useJSVoiceGuidanceListener = new StateChangedListener<Boolean>() {
@Override
public void stateChanged(Boolean change) {
if (change) {
getMyApplication().getResourceManager().copyMissingJSAssets();
}
getMyApplication().getDownloadThread().runReloadIndexFilesSilent();
}
};
cat.addPreference(createCheckBoxPreference(settings.USE_JS_VOICE_GUIDANCE, "Use JS voice guidance",
"Use new voice guidance logic based on JavaScript"));
settings.USE_JS_VOICE_GUIDANCE.addListener(useJSVoiceGuidanceListener);
final Preference firstRunPreference = new Preference(this);
firstRunPreference.setTitle(R.string.simulate_initial_startup);
@ -262,10 +248,4 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
b.setView(v);
b.show();
}
@Override
public void onDestroy() {
super.onDestroy();
settings.USE_JS_VOICE_GUIDANCE.removeListener(useJSVoiceGuidanceListener);
}
}

View file

@ -316,12 +316,9 @@ public class DownloadResources extends DownloadResourceGroup {
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
OsmandRegions regs = app.getRegions();
boolean useJS = app.getSettings().USE_JS_VOICE_GUIDANCE.get();
for (IndexItem ii : resources) {
if (ii.getType() == DownloadActivityType.VOICE_FILE) {
if (ii.getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP) && !useJS) {
voiceTTS.addItem(ii);
} else if (ii.getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS) && useJS){
if (ii.getFileName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)){
voiceTTS.addItem(ii);
} else if (ii.getFileName().endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP)){
voiceRec.addItem(ii);

View file

@ -43,6 +43,8 @@ import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.routing.RouteProvider;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.voice.JSMediaCommandPlayerImpl;
import net.osmand.plus.voice.JSTTSCommandPlayerImpl;
import net.osmand.plus.voice.MediaCommandPlayerImpl;
import net.osmand.router.GeneralRouter;
import net.osmand.router.GeneralRouter.RoutingParameter;
@ -336,31 +338,18 @@ public class RoutePreferencesMenu {
OsmandApplication app = ((OsmandApplication) activity.getApplication());
File extStorage = app.getAppPath(IndexConstants.VOICE_INDEX_DIR);
Set<String> setFiles = new LinkedHashSet<String>();
boolean addJS = app.getSettings().USE_JS_VOICE_GUIDANCE.get();
if (extStorage.exists()) {
for (File f : extStorage.listFiles()) {
if (f.isDirectory()) {
if ((addJS && hasJavaScript(f)) || MediaCommandPlayerImpl.isMyData(f)) {
setFiles.add(f.getName());
} else if (!addJS) {
if (JSMediaCommandPlayerImpl.isMyData(f) || JSTTSCommandPlayerImpl.isMyData(f)) {
setFiles.add(f.getName());
}
}
}
}
return setFiles;
}
private static boolean hasJavaScript(File f) {
for (File file : f.listFiles()) {
if (file.getName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) {
return true;
}
}
return false;
}
public OnItemClickListener getItemClickListener(final ArrayAdapter<?> listAdapter) {
return new OnItemClickListener() {
@Override

View file

@ -387,13 +387,8 @@ public class ResourceManager {
if (lf != null) {
for (File f : lf) {
if (f.isDirectory()) {
File conf = new File(f, "_config.p");
boolean useJS = context.getSettings().USE_JS_VOICE_GUIDANCE.get();
if (!conf.exists()) {
String lang = f.getName().replace("-tts", "");
conf = useJS ? new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS) :
new File(f, "_ttsconfig.p");
}
File conf = new File(f, lang + "_" + IndexConstants.TTSVOICE_INDEX_EXT_JS);
if (conf.exists()) {
indexFileNames.put(f.getName(), dateFormat.format(conf.lastModified())); //$NON-NLS-1$
}

View file

@ -78,22 +78,23 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat
this.ctx = ctx;
this.streamType = ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(applicationMode);
if (!ctx.getSettings().USE_JS_VOICE_GUIDANCE.get()) {
if (log.isInfoEnabled()) {
log.info("Initializing prolog system : " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
}
try {
prologSystem = new Prolog(getLibraries());
} catch (InvalidLibraryException e) {
log.error("Initializing error", e); //$NON-NLS-1$
throw new RuntimeException(e);
}
init(voiceProvider, ctx.getSettings(), configFile);
final Term langVal = solveSimplePredicate("language");
if (langVal instanceof Struct) {
language = ((Struct) langVal).getName();
}
} else if (voiceProvider != null) {
// if (!ctx.getSettings().USE_JS_VOICE_GUIDANCE.get()) {
// if (log.isInfoEnabled()) {
// log.info("Initializing prolog system : " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
// }
// try {
// prologSystem = new Prolog(getLibraries());
// } catch (InvalidLibraryException e) {
// log.error("Initializing error", e); //$NON-NLS-1$
// throw new RuntimeException(e);
// }
// init(voiceProvider, ctx.getSettings(), configFile);
// final Term langVal = solveSimplePredicate("language");
// if (langVal instanceof Struct) {
// language = ((Struct) langVal).getName();
// }
// }
if (voiceProvider != null) {
initVoiceDir(voiceProvider);
language = voiceProvider.replace("-tts", "").replace("-formal", "");
}