File stardict_mp3.patch of Package stardict-301

diff -uNr stardict-3.0.1/src/conf.cpp stardict-3.0.2/src/conf.cpp
--- stardict-3.0.1/src/conf.cpp	2007-10-30 16:05:35.000000000 +0800
+++ stardict-3.0.2/src/conf.cpp	2009-10-19 21:00:35.971741206 +0800
@@ -109,7 +109,7 @@
 	add_entry("/apps/stardict/preferences/dictionary/collate_function", 0);
 
 #if defined(CONFIG_GTK) || defined (CONFIG_GPE)
-	add_entry("/apps/stardict/preferences/dictionary/play_command", std::string("play"));
+	add_entry("/apps/stardict/preferences/dictionary/play_command", std::string("mplayer"));
 #endif
 #ifdef _WIN32
 	add_entry("/apps/stardict/preferences/dictionary/tts_path", std::string("C:\\Program Files\\WyabdcRealPeopleTTS\nC:\\Program Files\\OtdRealPeopleTTS\nWyabdcRealPeopleTTS\nOtdRealPeopleTTS"));
diff -uNr stardict-3.0.1/src/readword.cpp stardict-3.0.2/src/readword.cpp
--- stardict-3.0.1/src/readword.cpp	2009-10-19 20:57:33.638429760 +0800
+++ stardict-3.0.2/src/readword.cpp	2009-10-19 20:59:53.545079324 +0800
@@ -97,7 +97,13 @@
 		std::string filename;
 		std::list<std::string>::const_iterator it;
 		for (it=ttspath.begin(); it!=ttspath.end(); ++it) {
-			filename = *it + G_DIR_SEPARATOR_S + lowerword[0] + G_DIR_SEPARATOR_S + lowerword + ".wav";
+            std::string suffix, aword;
+            aword = *it + G_DIR_SEPARATOR_S + "a" + G_DIR_SEPARATOR_S + "a.mp3";
+            if (g_file_test(aword.c_str(), G_FILE_TEST_EXISTS))
+                suffix = ".mp3";
+            else
+                suffix = ".wav";
+			filename = *it + G_DIR_SEPARATOR_S + lowerword[0] + G_DIR_SEPARATOR_S + lowerword + suffix;
 			return_val = g_file_test(filename.c_str(), G_FILE_TEST_EXISTS);
 			if (return_val)
 				break;
@@ -128,7 +134,13 @@
 		std::string filename;
 		std::list<std::string>::const_iterator it;
 		for (it=ttspath.begin(); it!=ttspath.end(); ++it) {
-			filename = *it + G_DIR_SEPARATOR_S + lowerword[0] + G_DIR_SEPARATOR_S + lowerword + ".wav";
+            std::string suffix, aword;
+            aword = *it + G_DIR_SEPARATOR_S + "a" + G_DIR_SEPARATOR_S + "a.mp3";
+            if (g_file_test(aword.c_str(), G_FILE_TEST_EXISTS))
+                suffix = ".mp3";
+            else
+                suffix = ".wav";
+			filename = *it + G_DIR_SEPARATOR_S + lowerword[0] + G_DIR_SEPARATOR_S + lowerword + suffix;
 			if (g_file_test(filename.c_str(), G_FILE_TEST_EXISTS)) {
 				play_wav_file(filename);
 				break;
openSUSE Build Service is sponsored by