rbutil: try to fix all Bugs from FS#7982 in the talkfile creation. Additionally fix the positon of the _dirname.talk file and uninstallation of talkfiles.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15212 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Wenger 2007-10-19 21:49:07 +00:00
parent 5d066590cc
commit 04f1eaf4f0
3 changed files with 20 additions and 19 deletions

View file

@ -114,7 +114,8 @@ void InstallTalkWindow::accept()
userSettings->sync();
talkcreator->setDir(folderToTalk);
talkcreator->setDir(QDir(folderToTalk));
talkcreator->setMountPoint(userSettings->value("mountpoint").toString());
talkcreator->setTTSexe(pathTTS);
talkcreator->setTTsOpts(ttsOpts);
talkcreator->setTTsLanguage(ttsLanguage);
@ -166,8 +167,6 @@ void InstallTalkWindow::setUserSettings(QSettings *user)
{
userSettings = user;
talkcreator->setMountPoint(userSettings->value("mountpoint").toString());
setTalkFolder(userSettings->value("last_talked_folder").toString());
}

View file

@ -43,7 +43,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
{
m_abort = false;
m_logger = logger;
m_logger->addItem("Starting Talkfile generation",LOGINFO);
m_logger->addItem("Starting Talk file generation",LOGINFO);
if(m_curTTS == "sapi")
m_tts = new TTSSapi();
@ -78,7 +78,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
{
if(m_abort)
{
m_logger->addItem("Talkfile creation aborted",LOGERROR);
m_logger->addItem("Talk file creation aborted",LOGERROR);
m_tts->stop();
return false;
}
@ -88,13 +88,15 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
QString toSpeak;
QString filename;
QString wavfilename;
if(fileInf.fileName() == "." || fileInf.fileName() == ".." || fileInf.suffix() == "talk")
//! skip dotdot and .talk files
if(fileInf.fileName() == ".." || fileInf.suffix() == "talk")
{
it.next();
continue;
}
if(fileInf.isDir()) // if it is a dir
//! if it is a dir
if(fileInf.isDir())
{
// skip entry if folder talking isnt enabled
if(m_talkFolders == false)
@ -102,7 +104,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
it.next();
continue;
}
toSpeak = fileInf.fileName();
toSpeak = fileInf.absoluteDir().dirName();
filename = fileInf.absolutePath() + "/_dirname.talk";
}
else // if it is a file
@ -124,6 +126,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
QFileInfo filenameInf(filename);
QFileInfo wavfilenameInf(wavfilename);
//! the actual generation of the .talk files
if(!filenameInf.exists() || m_overwriteTalk)
{
if(!wavfilenameInf.exists() || m_overwriteWav)
@ -146,7 +149,8 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
return false;
}
}
//! remove the intermedia wav file, if requested
QString now = QDate::currentDate().toString("yyyyMMdd");
if(m_removeWav)
{
@ -155,15 +159,16 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
installlog.remove(wavfilename);
}
else
installlog.setValue(wavfilename.remove(m_mountpoint),now);
installlog.setValue(filename.remove(m_mountpoint),now);
installlog.setValue(wavfilename.remove(0,m_mountpoint.length()),now);
//! add the .talk file to the install log
installlog.setValue(filename.remove(0,m_mountpoint.length()),now);
it.next();
}
installlog.endGroup();
m_tts->stop();
m_logger->addItem("Finished creating Talkfiles",LOGOK);
m_logger->addItem("Finished creating Talk files",LOGOK);
m_logger->setProgressMax(1);
m_logger->setProgressValue(1);
m_logger->abort();

View file

@ -67,7 +67,7 @@ public:
void setEncOpts(QString opts) {m_EncOpts=opts;}
void setEncTemplate(QString t) { m_curEncTemplate = t; }
void setDir(QString dir){m_dir = dir; }
void setDir(QDir dir){m_dir = dir; }
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
void setOverwriteTalk(bool ov) {m_overwriteTalk = ov;}
@ -83,14 +83,11 @@ private slots:
private:
TTSBase* m_tts;
//bool initTTS();
//bool stopTTS();
bool initEncoder();
bool encode(QString input,QString output);
//bool voice(QString text,QString wavfile);
QString m_dir;
QDir m_dir;
QString m_mountpoint;
QString m_curTTS;
QString m_TTSexec;