cinera.c: Support a combination of modes
Specifically, with the addition of MODE_ONESHOT in v0.5.12 we must allow for the possibility of being in both that mode and MODE_INTEGRATE
This commit is contained in:
parent
4a954b6ac6
commit
120290b398
|
@ -14,7 +14,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 5,
|
.Minor = 5,
|
||||||
.Patch = 12
|
.Patch = 13
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CINERA_DB_VERSION 2
|
#define CINERA_DB_VERSION 2
|
||||||
|
@ -68,9 +68,9 @@ enum
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MODE_BARE,
|
MODE_BARE = 1 << 0,
|
||||||
MODE_INTEGRATE,
|
MODE_INTEGRATE = 1 << 1,
|
||||||
MODE_ONESHOT
|
MODE_ONESHOT = 1 << 2
|
||||||
} modes;
|
} modes;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -3228,7 +3228,7 @@ BuffersToHTML(buffers *CollationBuffers, template *Template, char *OutputPath, i
|
||||||
fclose(MemLog);
|
fclose(MemLog);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(Config.Mode == MODE_INTEGRATE)
|
if(Config.Mode & MODE_INTEGRATE)
|
||||||
{
|
{
|
||||||
if(Template->Metadata.Validity & PageType)
|
if(Template->Metadata.Validity & PageType)
|
||||||
{
|
{
|
||||||
|
@ -4601,7 +4601,7 @@ main(int ArgC, char **Args)
|
||||||
Config.ProjectID = optarg;
|
Config.ProjectID = optarg;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
Config.Mode = MODE_ONESHOT;
|
Config.Mode |= MODE_ONESHOT;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
Config.RootDir = StripTrailingSlash(optarg);
|
Config.RootDir = StripTrailingSlash(optarg);
|
||||||
|
@ -4614,7 +4614,7 @@ main(int ArgC, char **Args)
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
Config.TemplatePlayerLocation = optarg;
|
Config.TemplatePlayerLocation = optarg;
|
||||||
Config.Mode = MODE_INTEGRATE;
|
Config.Mode |= MODE_INTEGRATE;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
Config.UpdateInterval = StringToInt(optarg);
|
Config.UpdateInterval = StringToInt(optarg);
|
||||||
|
@ -4624,7 +4624,7 @@ main(int ArgC, char **Args)
|
||||||
return RC_SUCCESS;
|
return RC_SUCCESS;
|
||||||
case 'x':
|
case 'x':
|
||||||
Config.TemplateIndexLocation = optarg;
|
Config.TemplateIndexLocation = optarg;
|
||||||
Config.Mode = MODE_INTEGRATE;
|
Config.Mode |= MODE_INTEGRATE;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
|
@ -4721,13 +4721,13 @@ main(int ArgC, char **Args)
|
||||||
// Config will contain paths of multiple templates
|
// Config will contain paths of multiple templates
|
||||||
// App is running all the time, and picking up changes to the config as we go
|
// App is running all the time, and picking up changes to the config as we go
|
||||||
// If we find a new template, we first of all validate it
|
// If we find a new template, we first of all validate it
|
||||||
// In our case here, we just want to straight up validate a template if Config.Mode == MODE_INTEGRATE
|
// In our case here, we just want to straight up validate a template if Config.Mode & MODE_INTEGRATE
|
||||||
// And, in that same state, we gotta keep a Template buffer around
|
// And, in that same state, we gotta keep a Template buffer around
|
||||||
|
|
||||||
template *PlayerTemplate;
|
template *PlayerTemplate;
|
||||||
template *IndexTemplate;
|
template *IndexTemplate;
|
||||||
|
|
||||||
if(Config.Mode == MODE_INTEGRATE)
|
if(Config.Mode & MODE_INTEGRATE)
|
||||||
{
|
{
|
||||||
switch(ValidateTemplate(&Errors, &PlayerTemplate, PAGE_PLAYER))
|
switch(ValidateTemplate(&Errors, &PlayerTemplate, PAGE_PLAYER))
|
||||||
{
|
{
|
||||||
|
@ -4790,7 +4790,7 @@ main(int ArgC, char **Args)
|
||||||
StringsDiffer(Config.ImagesDir, "") ? Config.ImagesDir : "(same as root)",
|
StringsDiffer(Config.ImagesDir, "") ? Config.ImagesDir : "(same as root)",
|
||||||
StringsDiffer(Config.JSDir, "") ? Config.JSDir : "(same as root)");
|
StringsDiffer(Config.JSDir, "") ? Config.JSDir : "(same as root)");
|
||||||
|
|
||||||
if(Config.Mode == MODE_INTEGRATE)
|
if(Config.Mode & MODE_INTEGRATE)
|
||||||
{
|
{
|
||||||
printf(" Index Template: \e[1;30m(-x)\e[0m\t\t%s\n"
|
printf(" Index Template: \e[1;30m(-x)\e[0m\t\t%s\n"
|
||||||
" Player Template: \e[1;30m(-t)\e[0m\t\t%s\n",
|
" Player Template: \e[1;30m(-t)\e[0m\t\t%s\n",
|
||||||
|
@ -4835,7 +4835,7 @@ main(int ArgC, char **Args)
|
||||||
|
|
||||||
printf("┌╼ Synchronising with annotation files in Project Input Directory ╾┐\n");
|
printf("┌╼ Synchronising with annotation files in Project Input Directory ╾┐\n");
|
||||||
SyncIndexWithInput(&CollationBuffers, IndexTemplate, PlayerTemplate);
|
SyncIndexWithInput(&CollationBuffers, IndexTemplate, PlayerTemplate);
|
||||||
if(Config.Mode == MODE_ONESHOT)
|
if(Config.Mode & MODE_ONESHOT)
|
||||||
{
|
{
|
||||||
goto RIP;
|
goto RIP;
|
||||||
}
|
}
|
||||||
|
@ -4892,7 +4892,7 @@ NextFile:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.Mode == MODE_INTEGRATE)
|
if(Config.Mode & MODE_INTEGRATE)
|
||||||
{
|
{
|
||||||
DeclaimTemplate(PlayerTemplate);
|
DeclaimTemplate(PlayerTemplate);
|
||||||
if(Config.Edition == EDITION_PROJECT)
|
if(Config.Edition == EDITION_PROJECT)
|
||||||
|
|
Loading…
Reference in New Issue