Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/JSON-RPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Parameters:

| Name | Type | Description |
| --- | --- | --- |
| params.recordingDirectory | string | The new recording directory. |
| params.recordingDirectory | string | The new recording directory. May be prefixed with "localtimezone;" to name recording session folders using local time instead of UTC. |

Results:

Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,9 @@ QString UsageArguments ( char** argv )
" registering with a server list hosted\n"
" behind the same NAT\n"
" -P, --delaypan start with delay panning enabled\n"
" -R, --recording set server recording directory; server will record when a session is active by default\n"
" -R, --recording set server recording directory; server will record when a session is active by default;\n"
" prefix the directory with \"localtimezone;\" to name session folders using local time\n"
" instead of UTC\n"
" --norecord set server not to record by default when recording is configured\n"
" --noraw disable raw audio\n"
" -s, --server start Server\n"
Expand Down
17 changes: 15 additions & 2 deletions src/recorder/jamcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,22 @@ void CJamController::SetRecordingDir ( QString newRecordingDir, int iServerFrame
pthJamRecorder = nullptr;
}

if ( !newRecordingDir.isEmpty() )
// An optional "localtimezone;" prefix selects local time instead of UTC for
// session folder names (#497). strRecordingDir keeps the full string below so
// the prefix round-trips unchanged through the ini file, JSON-RPC and the GUI.
const QString strLocalTimePrefix = "localtimezone;";
bool bRecordLocalTime = false;
QString strRecordingBaseDir = newRecordingDir;

if ( strRecordingBaseDir.startsWith ( strLocalTimePrefix ) )
{
pJamRecorder = new recorder::CJamRecorder ( newRecordingDir, iServerFrameSizeSamples );
bRecordLocalTime = true;
strRecordingBaseDir = strRecordingBaseDir.mid ( strLocalTimePrefix.length() );
}

if ( !strRecordingBaseDir.isEmpty() )
{
pJamRecorder = new recorder::CJamRecorder ( strRecordingBaseDir, iServerFrameSizeSamples, bRecordLocalTime );
strRecorderErrMsg = pJamRecorder->Init();
bRecorderInitialised = ( strRecorderErrMsg == QString() );
bEnableRecording = bRecorderInitialised && !bDisableRecording;
Expand Down
8 changes: 5 additions & 3 deletions src/recorder/jamrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ QString CJamClient::TranslateChars ( const QString& input ) const
/**
* @brief CJamSession::CJamSession Construct a new jam recording session
* @param recordBaseDir The recording base directory
* @param bRecordLocalTime Name the session folder using local time instead of UTC
*
* Each session is stored into its own subdirectory of the recording base directory.
*/
CJamSession::CJamSession ( QDir recordBaseDir ) :
sessionDir ( QDir ( recordBaseDir.absoluteFilePath ( "Jam-" + QDateTime().currentDateTimeUtc().toString ( "yyyyMMdd-HHmmsszzz" ) ) ) ),
CJamSession::CJamSession ( QDir recordBaseDir, const bool bRecordLocalTime ) :
sessionDir ( QDir ( recordBaseDir.absoluteFilePath (
"Jam-" + ( bRecordLocalTime ? QDateTime::currentDateTime() : QDateTime::currentDateTimeUtc() ).toString ( "yyyyMMdd-HHmmsszzz" ) ) ) ),
currentFrame ( 0 ),
chIdDisconnected ( -1 ),
vecptrJamClients ( MAX_NUM_CHANNELS ),
Expand Down Expand Up @@ -426,7 +428,7 @@ void CJamRecorder::Start()
QMutexLocker mutexLocker ( &ChIdMutex );
try
{
currentSession = new CJamSession ( recordBaseDir );
currentSession = new CJamSession ( recordBaseDir, bRecordLocalTime );
isRecording = true;
}
catch ( const CGenErr& err )
Expand Down
6 changes: 4 additions & 2 deletions src/recorder/jamrecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class CJamSession : public QObject
Q_OBJECT

public:
CJamSession ( QDir recordBaseDir );
CJamSession ( QDir recordBaseDir, const bool bRecordLocalTime );

virtual ~CJamSession();

Expand Down Expand Up @@ -176,9 +176,10 @@ class CJamRecorder : public QObject
Q_OBJECT

public:
CJamRecorder ( const QString strRecordingBaseDir, const int iServerFrameSizeSamples ) :
CJamRecorder ( const QString strRecordingBaseDir, const int iServerFrameSizeSamples, const bool bRecordLocalTime ) :
recordBaseDir ( strRecordingBaseDir ),
iServerFrameSizeSamples ( iServerFrameSizeSamples ),
bRecordLocalTime ( bRecordLocalTime ),
isRecording ( false ),
currentSession ( nullptr )
{}
Expand All @@ -203,6 +204,7 @@ class CJamRecorder : public QObject

QDir recordBaseDir;
int iServerFrameSizeSamples;
bool bRecordLocalTime;
bool isRecording;
CJamSession* currentSession;
QMutex ChIdMutex;
Expand Down
1 change: 1 addition & 0 deletions src/serverrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ CServerRpc::CServerRpc ( CServer* pServer, CRpcServer* pRpcServer, QObject* pare
/// @rpc_method jamulusserver/setRecordingDirectory
/// @brief Sets the server recording directory.
/// @param {string} params.recordingDirectory - The new recording directory.
/// May be prefixed with "localtimezone;" to name recording session folders using local time instead of UTC.
/// @result {string} result - Always "acknowledged".
/// To check if the directory was changed, call `jamulusserver/getRecorderStatus` again.
pRpcServer->HandleMethod ( "jamulusserver/setRecordingDirectory", [=] ( const QJsonObject& params, QJsonObject& response ) {
Expand Down
Loading