annotate base/RecordDirectory.cpp @ 1590:2f8ee436e858 bqaudiostream

Merge
author Chris Cannam
date Thu, 17 Jan 2019 17:30:09 +0000
parents fbe8afdfa8a6
children
rev   line source
Chris@1519 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1519 2
Chris@1519 3 /*
Chris@1519 4 Sonic Visualiser
Chris@1519 5 An audio file viewer and annotation editor.
Chris@1519 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1519 7
Chris@1519 8 This program is free software; you can redistribute it and/or
Chris@1519 9 modify it under the terms of the GNU General Public License as
Chris@1519 10 published by the Free Software Foundation; either version 2 of the
Chris@1519 11 License, or (at your option) any later version. See the file
Chris@1519 12 COPYING included with this distribution for more information.
Chris@1519 13 */
Chris@1519 14
Chris@1519 15 #include "RecordDirectory.h"
Chris@1519 16 #include "TempDirectory.h"
Chris@1519 17
Chris@1519 18 #include <QDir>
Chris@1519 19 #include <QDateTime>
Chris@1519 20
Chris@1519 21 #include "Debug.h"
Chris@1519 22
Chris@1519 23 QString
Chris@1519 24 RecordDirectory::getRecordContainerDirectory()
Chris@1519 25 {
Chris@1519 26 QDir parent(TempDirectory::getInstance()->getContainingPath());
Chris@1519 27 QString subdirname("recorded");
Chris@1519 28
Chris@1519 29 if (!parent.mkpath(subdirname)) {
Chris@1519 30 SVCERR << "ERROR: RecordDirectory::getRecordContainerDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
Chris@1519 31 return "";
Chris@1519 32 } else {
Chris@1519 33 return parent.filePath(subdirname);
Chris@1519 34 }
Chris@1519 35 }
Chris@1519 36
Chris@1519 37 QString
Chris@1519 38 RecordDirectory::getRecordDirectory()
Chris@1519 39 {
Chris@1519 40 QDir parent(getRecordContainerDirectory());
Chris@1519 41 QDateTime now = QDateTime::currentDateTime();
Chris@1519 42 QString subdirname = QString("%1").arg(now.toString("yyyyMMdd"));
Chris@1519 43
Chris@1519 44 if (!parent.mkpath(subdirname)) {
Chris@1519 45 SVCERR << "ERROR: RecordDirectory::getRecordDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
Chris@1519 46 return "";
Chris@1519 47 } else {
Chris@1519 48 return parent.filePath(subdirname);
Chris@1519 49 }
Chris@1519 50 }
Chris@1519 51
Chris@1519 52 QString
Chris@1519 53 RecordDirectory::getConvertedAudioDirectory()
Chris@1519 54 {
Chris@1519 55 QDir parent(getRecordContainerDirectory());
Chris@1519 56 QDateTime now = QDateTime::currentDateTime();
Chris@1519 57 QString subdirname = "converted";
Chris@1519 58
Chris@1519 59 if (!parent.mkpath(subdirname)) {
Chris@1519 60 SVCERR << "ERROR: RecordDirectory::getConvertedAudioDirectory: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
Chris@1519 61 return "";
Chris@1519 62 } else {
Chris@1519 63 return parent.filePath(subdirname);
Chris@1519 64 }
Chris@1519 65 }
Chris@1519 66
Chris@1519 67