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