cinera.c: Add -q flag
This sets cinera to "oneshot mode" which makes a Project Edition instance quit after syncing from annotation files in project input directory
This commit is contained in:
parent
1bbdf5aea4
commit
4a954b6ac6
|
@ -14,7 +14,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 5,
|
.Minor = 5,
|
||||||
.Patch = 11
|
.Patch = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CINERA_DB_VERSION 2
|
#define CINERA_DB_VERSION 2
|
||||||
|
@ -69,7 +69,8 @@ enum
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MODE_BARE,
|
MODE_BARE,
|
||||||
MODE_INTEGRATE
|
MODE_INTEGRATE,
|
||||||
|
MODE_ONESHOT
|
||||||
} modes;
|
} modes;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -1694,6 +1695,9 @@ PrintUsage(char *BinaryLocation, config *DefaultConfig)
|
||||||
"\n"
|
"\n"
|
||||||
" -p <project ID>\n"
|
" -p <project ID>\n"
|
||||||
" Set the project ID, corresponding to the \"project\" field in the HMML files\n"
|
" Set the project ID, corresponding to the \"project\" field in the HMML files\n"
|
||||||
|
" -q\n"
|
||||||
|
" Quit after syncing with annotation files in project input directory\n"
|
||||||
|
" (Only affects PROJECT edition)\n"
|
||||||
" -s <style>\n"
|
" -s <style>\n"
|
||||||
" Set the style / theme, corresponding to a cinera__*.css file\n"
|
" Set the style / theme, corresponding to a cinera__*.css file\n"
|
||||||
" This is equal to the \"project\" field in the HMML files by default\n"
|
" This is equal to the \"project\" field in the HMML files by default\n"
|
||||||
|
@ -2281,6 +2285,7 @@ HMMLToBuffers(buffers *CollationBuffers, char *Filename)
|
||||||
break;
|
break;
|
||||||
case RC_ERROR_FILE:
|
case RC_ERROR_FILE:
|
||||||
case RC_ERROR_MEMORY:
|
case RC_ERROR_MEMORY:
|
||||||
|
hmml_free(&HMML);
|
||||||
return RC_ERROR_FATAL;
|
return RC_ERROR_FATAL;
|
||||||
};
|
};
|
||||||
if(!HasFilterMenu)
|
if(!HasFilterMenu)
|
||||||
|
@ -2542,6 +2547,7 @@ AppendedIdentifier:
|
||||||
break;
|
break;
|
||||||
case RC_ERROR_FILE:
|
case RC_ERROR_FILE:
|
||||||
case RC_ERROR_MEMORY:
|
case RC_ERROR_MEMORY:
|
||||||
|
hmml_free(&HMML);
|
||||||
return RC_ERROR_FATAL;
|
return RC_ERROR_FATAL;
|
||||||
};
|
};
|
||||||
if(!HasFilterMenu)
|
if(!HasFilterMenu)
|
||||||
|
@ -3880,6 +3886,8 @@ IndexToBuffer(buffers *CollationBuffers)
|
||||||
if(!ProjectFound)
|
if(!ProjectFound)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Missing Project Info for %s\n", Config.ProjectID);
|
fprintf(stderr, "Missing Project Info for %s\n", Config.ProjectID);
|
||||||
|
FreeBuffer(&Index.Metadata.Buffer);
|
||||||
|
FreeBuffer(&Index.File.Buffer);
|
||||||
return RC_ERROR_PROJECT;
|
return RC_ERROR_PROJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3934,6 +3942,8 @@ IndexToBuffer(buffers *CollationBuffers)
|
||||||
CollationBuffers->Index.Size = StringLength(queryContainer) + (Index.Header.EntryCount * EntryLength) + StringLength(Script);
|
CollationBuffers->Index.Size = StringLength(queryContainer) + (Index.Header.EntryCount * EntryLength) + StringLength(Script);
|
||||||
if(!(CollationBuffers->Index.Location = malloc(CollationBuffers->Index.Size)))
|
if(!(CollationBuffers->Index.Location = malloc(CollationBuffers->Index.Size)))
|
||||||
{
|
{
|
||||||
|
FreeBuffer(&Index.Metadata.Buffer);
|
||||||
|
FreeBuffer(&Index.File.Buffer);
|
||||||
return(RC_ERROR_MEMORY);
|
return(RC_ERROR_MEMORY);
|
||||||
}
|
}
|
||||||
CollationBuffers->Index.Ptr = CollationBuffers->Index.Location;
|
CollationBuffers->Index.Ptr = CollationBuffers->Index.Location;
|
||||||
|
@ -4001,6 +4011,7 @@ IndexToBuffer(buffers *CollationBuffers)
|
||||||
CopyStringToBuffer(&CollationBuffers->Index, Script);
|
CopyStringToBuffer(&CollationBuffers->Index, Script);
|
||||||
|
|
||||||
FreeBuffer(&Index.Metadata.Buffer);
|
FreeBuffer(&Index.Metadata.Buffer);
|
||||||
|
FreeBuffer(&Index.File.Buffer);
|
||||||
return RC_SUCCESS;
|
return RC_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4544,7 +4555,7 @@ main(int ArgC, char **Args)
|
||||||
}
|
}
|
||||||
|
|
||||||
char CommandLineArg;
|
char CommandLineArg;
|
||||||
while((CommandLineArg = getopt(ArgC, Args, "a:b:B:c:d:fhi:j:l:m:n:o:p:r:R:s:t:U:vx:")) != -1)
|
while((CommandLineArg = getopt(ArgC, Args, "a:b:B:c:d:fhi:j:l:m:n:o:p:qr:R:s:t:U:vx:")) != -1)
|
||||||
{
|
{
|
||||||
switch(CommandLineArg)
|
switch(CommandLineArg)
|
||||||
{
|
{
|
||||||
|
@ -4589,6 +4600,9 @@ main(int ArgC, char **Args)
|
||||||
case 'p':
|
case 'p':
|
||||||
Config.ProjectID = optarg;
|
Config.ProjectID = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'q':
|
||||||
|
Config.Mode = MODE_ONESHOT;
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
Config.RootDir = StripTrailingSlash(optarg);
|
Config.RootDir = StripTrailingSlash(optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -4821,6 +4835,10 @@ 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)
|
||||||
|
{
|
||||||
|
goto RIP;
|
||||||
|
}
|
||||||
|
|
||||||
printf("\n┌╼ Monitoring Project Directory for \e[1;32mnew\e[0m, \e[1;33medited\e[0m and \e[1;30mdeleted\e[0m .hmml files ╾┐\n");
|
printf("\n┌╼ Monitoring Project Directory for \e[1;32mnew\e[0m, \e[1;33medited\e[0m and \e[1;30mdeleted\e[0m .hmml files ╾┐\n");
|
||||||
int inotifyInstance = inotify_init1(IN_NONBLOCK);
|
int inotifyInstance = inotify_init1(IN_NONBLOCK);
|
||||||
|
|
Loading…
Reference in New Issue