Mercurial > hg > svapp
changeset 508:b84d9b512dbd tony-2.0-integration
Put recorded files in subdirectories by date
author | Chris Cannam |
---|---|
date | Wed, 14 Oct 2015 15:08:55 +0100 |
parents | 9a125d1c8a22 |
children | 7cf6f5501212 |
files | audio/AudioRecordTarget.cpp audio/AudioRecordTarget.h |
diffstat | 2 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/audio/AudioRecordTarget.cpp Wed Oct 14 14:52:46 2015 +0100 +++ b/audio/AudioRecordTarget.cpp Wed Oct 14 15:08:55 2015 +0100 @@ -98,10 +98,26 @@ } QString +AudioRecordTarget::getRecordContainerFolder() +{ + QDir parent(TempDirectory::getInstance()->getContainingPath()); + QString subdirname("recorded"); + + if (!parent.mkpath(subdirname)) { + cerr << "ERROR: AudioRecordTarget::getRecordContainerFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; + return ""; + } else { + return parent.filePath(subdirname); + } +} + +QString AudioRecordTarget::getRecordFolder() { - QDir parent(TempDirectory::getInstance()->getContainingPath()); - QString subdirname = "recorded"; //!!! tr? + QDir parent(getRecordContainerFolder()); + QDateTime now = QDateTime::currentDateTime(); + QString subdirname = QString("%1").arg(now.toString("yyyyMMdd")); + if (!parent.mkpath(subdirname)) { cerr << "ERROR: AudioRecordTarget::getRecordFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; return "";
--- a/audio/AudioRecordTarget.h Wed Oct 14 14:52:46 2015 +0100 +++ b/audio/AudioRecordTarget.h Wed Oct 14 15:08:55 2015 +0100 @@ -51,6 +51,7 @@ virtual void audioProcessingOverload() { } + QString getRecordContainerFolder(); QString getRecordFolder(); bool isRecording() const { return m_recording; }