-
Notifications
You must be signed in to change notification settings - Fork 2
/
db_createFrameworkStructure.m
43 lines (38 loc) · 1.74 KB
/
db_createFrameworkStructure.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [ ] = db_createFrameworkStructure()
%createFrameworkStructure Creates the basic framework structure
% Detailed explanation goes here
%% Load dbConfig
dbConfigFile = db_getDbConfigFileURI();
if exist(dbConfigFile, 'file') ~= 2
db_generateConfig();
end
load(dbConfigFile);
%% Start Creating Framework Structure
mkdir(dbFrameworkRootDir);
mkdir(videoDbDir);
mkdir(tmpDir);
mkdir(indexDir);
% create videoDbRecordFile and write header as 0 => no video has been
% deleted yet. Header tells the count of deleted videos in file.
fileID = fopen(videoDbRecordFile, 'w'); fwrite(fileID, 0, headerIntType); fclose(fileID);
% create videoDbCountFile and write count as 0 => no video inserted yet
fileID = fopen(videoDbCountFile, 'w'); fwrite(fileID, 0, headerIntType); fclose(fileID);
% videos will be stored starting naming from 1.
% create all index category directories with index files
numCategories = length(indexCategories);
for i = 1 : numCategories
% create directory for this index category
thisCategoryDir = strcat(indexDir, indexCategories{i}, pathSeparator);
mkdir(thisCategoryDir);
% create index files for this index category
thisCategoryClasses = eval(strcat(indexCategories{i}, classVariableExtension));
numClasses = length(thisCategoryClasses);
for j = 1 : numClasses
% create thisClass IndexFile and write header as 0 => no video has been
% deleted yet. Header tells the count of deleted videos in file.
fileID = fopen(strcat(thisCategoryDir, thisCategoryClasses{j}, indexFileExtension), 'w');
fwrite(fileID, 0, headerIntType);
fclose(fileID);
end
end
end