AutoRecorder: Record in batches of 30 minutes.
Restarts recording at roundstarts, if recording for longer then 30 minutes.
This commit is contained in:
parent
8b8d9abd4c
commit
a592567ca7
@ -10,9 +10,12 @@ ConVar g_hTimeStop;
|
||||
ConVar g_hFinishMap;
|
||||
ConVar g_hDemoPath;
|
||||
|
||||
bool g_bRestartRecording = false;
|
||||
bool g_bIsRecording = false;
|
||||
bool g_bIsManual = false;
|
||||
|
||||
int g_iRestartRecording;
|
||||
|
||||
// Default: o=rx,g=rx,u=rwx | 755
|
||||
#define DIRECTORY_PERMISSIONS (FPERM_O_READ|FPERM_O_EXEC | FPERM_G_READ|FPERM_G_EXEC | FPERM_U_READ|FPERM_U_WRITE|FPERM_U_EXEC)
|
||||
|
||||
@ -40,6 +43,8 @@ public void OnPluginStart()
|
||||
RegAdminCmd("sm_record", Command_Record, ADMFLAG_KICK, "Starts a SourceTV demo");
|
||||
RegAdminCmd("sm_stoprecord", Command_StopRecord, ADMFLAG_KICK, "Stops the current SourceTV demo");
|
||||
|
||||
HookEvent("round_start", OnRoundStart);
|
||||
|
||||
g_hTvEnabled = FindConVar("tv_enable");
|
||||
|
||||
static char sPath[PLATFORM_MAX_PATH];
|
||||
@ -60,6 +65,15 @@ public void OnPluginStart()
|
||||
CheckStatus();
|
||||
}
|
||||
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
if(g_bRestartRecording && g_iRestartRecording <= GetTime())
|
||||
{
|
||||
StopRecord();
|
||||
CheckStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
if(convar == g_hDemoPath)
|
||||
@ -77,6 +91,9 @@ public void OnMapEnd()
|
||||
{
|
||||
StopRecord();
|
||||
g_bIsManual = false;
|
||||
|
||||
g_bRestartRecording = false;
|
||||
g_iRestartRecording = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,6 +208,9 @@ void StartRecord()
|
||||
g_bIsRecording = true;
|
||||
|
||||
LogMessage("Recording to auto-%s-%s.dem", sTime, sMap);
|
||||
|
||||
g_bRestartRecording = true;
|
||||
g_iRestartRecording = GetTime() + 1800;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,5 +220,8 @@ void StopRecord()
|
||||
{
|
||||
ServerCommand("tv_stoprecord");
|
||||
g_bIsRecording = false;
|
||||
|
||||
g_bRestartRecording = false;
|
||||
g_iRestartRecording = -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user