mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
write to OBS log if verbose logging is enabled
This commit is contained in:
parent
8d23dd46b0
commit
c17cbb66d9
|
|
@ -502,7 +502,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_48">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoStopSceneCheckBox_2">
|
||||
<widget class="QCheckBox" name="verboseLogging">
|
||||
<property name="text">
|
||||
<string>Enable verbose logging (Only needed for debugging)</string>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ SceneSwitcher::SceneSwitcher(QWidget *parent)
|
|||
ui->autoStopScenes->setDisabled(true);
|
||||
}
|
||||
|
||||
ui->verboseLogging->setChecked(switcher->verbose);
|
||||
|
||||
for (auto &scene : switcher->pauseScenesSwitches) {
|
||||
std::string sceneName = GetWeakSourceName(scene);
|
||||
QString text = QString::fromStdString(sceneName);
|
||||
|
|
@ -495,10 +497,19 @@ void SwitcherData::Thread()
|
|||
OBSWeakSource scene;
|
||||
OBSWeakSource transition;
|
||||
std::chrono::milliseconds duration;
|
||||
if (sleep > interval)
|
||||
if (sleep > interval) {
|
||||
duration = std::chrono::milliseconds(sleep);
|
||||
else
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher sleep for %d",
|
||||
sleep);
|
||||
} else {
|
||||
duration = std::chrono::milliseconds(interval);
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher sleep for %d",
|
||||
interval);
|
||||
}
|
||||
sleep = 0;
|
||||
switcher->Prune();
|
||||
writeSceneInfoToFile();
|
||||
|
|
@ -613,6 +624,10 @@ void switchScene(OBSWeakSource &scene, OBSWeakSource &transition,
|
|||
obs_frontend_set_current_scene(source);
|
||||
lock.lock();
|
||||
|
||||
if (switcher->verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher switched scene");
|
||||
|
||||
obs_weak_source_release(nextTransitionWs);
|
||||
}
|
||||
obs_source_release(currentSource);
|
||||
|
|
|
|||
|
|
@ -189,6 +189,10 @@ void SwitcherData::checkExeSwitch(bool &match, OBSWeakSource &scene,
|
|||
scene = s.mScene;
|
||||
transition = s.mTransition;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher exec match");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,6 +158,10 @@ void SwitcherData::checkFileContent(bool &match, OBSWeakSource &scene,
|
|||
transition = s.transition;
|
||||
match = true;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher file match");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,15 @@ void SceneSwitcher::closeEvent(QCloseEvent *)
|
|||
obs_frontend_save();
|
||||
}
|
||||
|
||||
void SceneSwitcher::on_verboseLogging_stateChanged(int state)
|
||||
{
|
||||
if (loading)
|
||||
return;
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->verbose = state;
|
||||
}
|
||||
|
||||
void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
||||
{
|
||||
obs_data_set_int(obj, "interval", switcher->interval);
|
||||
|
|
@ -122,6 +131,8 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
|
|||
obs_data_set_string(obj, "autoStopSceneName",
|
||||
autoStopSceneName.c_str());
|
||||
|
||||
obs_data_set_bool(obj, "verbose", switcher->verbose);
|
||||
|
||||
obs_data_set_int(obj, "priority0",
|
||||
switcher->functionNamesByPriority[0]);
|
||||
obs_data_set_int(obj, "priority1",
|
||||
|
|
@ -162,6 +173,8 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
|
|||
switcher->autoStopEnable = obs_data_get_bool(obj, "autoStopEnable");
|
||||
switcher->autoStopScene = GetWeakSourceByName(autoStopScene.c_str());
|
||||
|
||||
switcher->verbose = obs_data_get_bool(obj, "verbose");
|
||||
|
||||
obs_data_set_default_int(obj, "priority0", DEFAULT_PRIORITY_0);
|
||||
obs_data_set_default_int(obj, "priority1", DEFAULT_PRIORITY_1);
|
||||
obs_data_set_default_int(obj, "priority2", DEFAULT_PRIORITY_2);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ public slots:
|
|||
void on_autoStopSceneCheckBox_stateChanged(int state);
|
||||
void on_autoStopScenes_currentTextChanged(const QString &text);
|
||||
|
||||
void on_verboseLogging_stateChanged(int state);
|
||||
|
||||
void on_sceneTransitions_currentRowChanged(int idx);
|
||||
void on_transitionsAdd_clicked();
|
||||
void on_transitionsRemove_clicked();
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ struct SwitcherData {
|
|||
std::condition_variable transitionCv;
|
||||
bool startAtLaunch = false;
|
||||
bool stop = false;
|
||||
bool verbose = false;
|
||||
|
||||
int interval = DEFAULT_INTERVAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ void SwitcherData::checkIdleSwitch(bool &match, OBSWeakSource &scene,
|
|||
transition = idleData.transition;
|
||||
match = true;
|
||||
idleData.alreadySwitched = true;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher idle match");
|
||||
} else
|
||||
idleData.alreadySwitched = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,10 @@ void SwitcherData::checkMediaSwitch(bool &match, OBSWeakSource &scene,
|
|||
? previousScene
|
||||
: mediaSwitch.scene;
|
||||
transition = mediaSwitch.transition;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher meida match");
|
||||
}
|
||||
mediaSwitch.matched = matched;
|
||||
obs_source_release(source);
|
||||
|
|
|
|||
|
|
@ -219,6 +219,11 @@ bool SwitcherData::checkPause()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose && pause)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher pause match");
|
||||
|
||||
return pause;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,10 @@ void SwitcherData::checkRandom(bool &match, OBSWeakSource &scene,
|
|||
delay = (int)r.delay * 1000;
|
||||
match = true;
|
||||
lastRandomScene = r.scene;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO, "Advanced Scene Switcher random match");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,12 @@ void SwitcherData::checkSceneRoundTrip(bool &match, OBSWeakSource &scene,
|
|||
int dur = s.delay - interval;
|
||||
if (dur > 0) {
|
||||
waitScene = currentSource;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher sequence sleep %d",
|
||||
dur);
|
||||
|
||||
cv.wait_for(lock,
|
||||
std::chrono::milliseconds(dur));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,6 +162,11 @@ void SwitcherData::setDefaultSceneTransitions()
|
|||
//This might cancel the current transition
|
||||
//There is no way to be sure when the previous transition finished
|
||||
obs_frontend_set_current_transition(transition);
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher default transition set");
|
||||
|
||||
obs_source_release(transition);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ void SwitcherData::checkScreenRegionSwitch(bool &match, OBSWeakSource &scene,
|
|||
scene = s.scene;
|
||||
transition = s.transition;
|
||||
minRegionSize = regionSize;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher region match");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,11 @@ void SwitcherData::checkTimeSwitch(bool &match, OBSWeakSource &scene,
|
|||
scene = (s.usePreviousScene) ? previousScene : s.scene;
|
||||
transition = s.transition;
|
||||
match = true;
|
||||
|
||||
if (verbose)
|
||||
blog(LOG_INFO,
|
||||
"Advanced Scene Switcher time match");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user