Add date/time replacement for save path

Also OBS will now automatically create directories when needed
This commit is contained in:
palana 2014-08-20 21:41:11 +02:00
parent 38f96367d1
commit c57758e7d2
3 changed files with 47 additions and 22 deletions

View File

@ -130,6 +130,26 @@ String GetOutputFilename()
bool bUseDateTimeName = true;
bool bOverwrite = GlobalConfig->GetInt(L"General", L"OverwriteRecordings", false) != 0;
{
SYSTEMTIME st;
GetLocalTime(&st);
strOutputFile.FindReplace(L"$Y", UIntString(st.wYear).Array());
strOutputFile.FindReplace(L"$M", UIntString(st.wMonth).Array());
strOutputFile.FindReplace(L"$0M", FormattedString(L"%02u", st.wMonth).Array());
strOutputFile.FindReplace(L"$D", UIntString(st.wDay).Array());
strOutputFile.FindReplace(L"$0D", FormattedString(L"%02u", st.wDay).Array());
strOutputFile.FindReplace(L"$h", UIntString(st.wHour).Array());
strOutputFile.FindReplace(L"$0h", FormattedString(L"%02u", st.wHour).Array());
strOutputFile.FindReplace(L"$m", UIntString(st.wMinute).Array());
strOutputFile.FindReplace(L"$0m", FormattedString(L"%02u", st.wMinute).Array());
strOutputFile.FindReplace(L"$s", UIntString(st.wSecond).Array());
strOutputFile.FindReplace(L"$0s", FormattedString(L"%02u", st.wSecond).Array());
strOutputFile.FindReplace(L"$T", FormattedString(L"%u-%02u-%02u-%02u%02u-%02u", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond).Array());
}
CreatePath(GetPathDirectory(strOutputFile));
if (!bOverwrite && (hFind = OSFindFirstFile(strOutputFile, ofd)))
{
String strFileExtension = GetPathExtension(strOutputFile);

View File

@ -674,27 +674,6 @@ INT_PTR SettingsPublish::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
//--------------------------------------------
BOOL bKeepRecording = AppConfig->GetInt(TEXT("Publish"), TEXT("KeepRecording"));
SendMessage(GetDlgItem(hwnd, IDC_KEEPRECORDING), BM_SETCHECK, bKeepRecording ? BST_CHECKED : BST_UNCHECKED, 0);
BOOL bSaveToFile = AppConfig->GetInt(TEXT("Publish"), TEXT("SaveToFile"));
SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_SETCHECK, bSaveToFile ? BST_CHECKED : BST_UNCHECKED, 0);
String path = OSGetDefaultVideoSavePath(L"\\.flv");
CTSTR lpSavePath = AppConfig->GetStringPtr(TEXT("Publish"), TEXT("SavePath"), path.IsValid() ? path.Array() : nullptr);
SetWindowText(GetDlgItem(hwnd, IDC_SAVEPATH), lpSavePath);
EnableWindow(GetDlgItem(hwnd, IDC_KEEPRECORDING), true);
EnableWindow(GetDlgItem(hwnd, IDC_SAVEPATH), true);
EnableWindow(GetDlgItem(hwnd, IDC_BROWSE), true);
//--------------------------------------------
//SetWindowText(GetDlgItem(hwnd, IDC_DASHBOARDLINK), App->strDashboard);
//--------------------------------------------
HWND hwndToolTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, NULL, hinstMain, NULL);
@ -709,7 +688,32 @@ INT_PTR SettingsPublish::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
ti.uFlags |= TTF_RTLREADING;
SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 500);
SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 8000);
SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 20000);
//--------------------------------------------
BOOL bKeepRecording = AppConfig->GetInt(TEXT("Publish"), TEXT("KeepRecording"));
SendMessage(GetDlgItem(hwnd, IDC_KEEPRECORDING), BM_SETCHECK, bKeepRecording ? BST_CHECKED : BST_UNCHECKED, 0);
BOOL bSaveToFile = AppConfig->GetInt(TEXT("Publish"), TEXT("SaveToFile"));
SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_SETCHECK, bSaveToFile ? BST_CHECKED : BST_UNCHECKED, 0);
String path = OSGetDefaultVideoSavePath(L"\\.flv");
CTSTR lpSavePath = AppConfig->GetStringPtr(TEXT("Publish"), TEXT("SavePath"), path.IsValid() ? path.Array() : nullptr);
SetWindowText(GetDlgItem(hwnd, IDC_SAVEPATH), lpSavePath);
ti.lpszText = (LPWSTR)Str("Settings.Publish.SavePathTooltip");
ti.uId = (UINT_PTR)GetDlgItem(hwnd, IDC_SAVEPATH);
SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
EnableWindow(GetDlgItem(hwnd, IDC_KEEPRECORDING), true);
EnableWindow(GetDlgItem(hwnd, IDC_SAVEPATH), true);
EnableWindow(GetDlgItem(hwnd, IDC_BROWSE), true);
//--------------------------------------------
//SetWindowText(GetDlgItem(hwnd, IDC_DASHBOARDLINK), App->strDashboard);
//--------------------------------------------

View File

@ -278,6 +278,7 @@ Settings.Publish.Mode="Mode:"
Settings.Publish.Password="Password (if any):"
Settings.Publish.Playpath="Play Path/Stream Key (if any):"
Settings.Publish.SavePath="File Path:"
Settings.Publish.SavePathTooltip="The following character sequences are automatically replaced:\n\nCurrent time:\n$T\tfull time (parts zero padded)\n$Y\tyear\n$M\tmonth\n$0M\tmonth (zero padded)\n$D\tday of the month\n$0D\tday of the month (zero padded)\n$h\thour (24 hour based)\n$0h\thour (24 hour based, zero padded)\n$m\tminute\n$0m\tminute (zero padded)\n$s\tsecond\n$0s\tsecond (zero padded)"
Settings.Publish.SaveToFile="Automatically save stream to file:"
Settings.Publish.Server="Server:"
Settings.Publish.Service="Streaming Service:"