Skip to content

Commit d4153ee

Browse files
Fixes issue where no video capture devices selected for merge, and issue where protection flagged exports would not import correctly even when logged in.
1 parent 404469d commit d4153ee

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

src/scene-bundle.cpp

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,36 @@ bool SceneBundle::MergeCollection(std::string collection_name,
257257

258258
_collection = nlohmann::json::parse(collectionData);
259259

260+
if (_collection.contains("modules") &&
261+
_collection["modules"].contains("elgato_marketplace_connect") &&
262+
_collection["modules"]["elgato_marketplace_connect"].contains("id")
263+
) { // This was a downloaded collection that has been exported
264+
auto api = elgatocloud::MarketplaceApi::getInstance();
265+
std::string currentId = api->id();
266+
std::string embeddedId = _collection["modules"]["elgato_marketplace_connect"]["id"];
267+
if (currentId != embeddedId) {
268+
obs_log(LOG_INFO, "Ids don't match");
269+
QMessageBox msgBox;
270+
msgBox.setWindowTitle("Alert");
271+
msgBox.setText("This scene collection file contains portions of a scene collection purchased on the Elgato Marketplace. To install it, you will need to be logged in to the original account that purchased the collection. Please log in through the Elgato Marketplace menu item, and try to install again.");
272+
msgBox.setIcon(QMessageBox::Information);
273+
msgBox.setStandardButtons(QMessageBox::Close);
274+
msgBox.exec();
275+
return false;
276+
}
277+
id = embeddedId;
278+
}
279+
260280
// Code to swap out video capture devices in _collection,
261281
// with source clones if needed.
262282

263283
for (auto& source : _collection["sources"]) {
264284
if (source["id"] == "dshow_input") {
285+
// If the user did not select a video device for this
286+
// source.. continue
287+
if (!source["settings"].contains("video_device_id")) {
288+
continue;
289+
}
265290
std::string vdi = source["settings"]["video_device_id"];
266291
if (cVideoCaptureSources.find(vdi) != cVideoCaptureSources.end()) {
267292
source["id"] = "source-clone";
@@ -354,8 +379,6 @@ bool SceneBundle::MergeCollection(std::string collection_name,
354379

355380
_bundleInfo = nlohmann::json::parse(bundleInfoData);
356381

357-
358-
359382
nlohmann::json module_info = {
360383
{"first_run", true}
361384
};
@@ -370,26 +393,6 @@ bool SceneBundle::MergeCollection(std::string collection_name,
370393

371394
_collection = currentCollectionJson;
372395

373-
if (_collection.contains("modules") &&
374-
_collection["modules"].contains("elgato_marketplace_connect") &&
375-
_collection["modules"]["elgato_marketplace_connect"].contains("id")
376-
) { // This was a downloaded collection that has been exported
377-
auto api = elgatocloud::MarketplaceApi::getInstance();
378-
std::string currentId = api->id();
379-
std::string embeddedId = _collection["modules"]["elgato_marketplace_connect"]["id"];
380-
if (currentId != embeddedId) {
381-
obs_log(LOG_INFO, "Ids don't match");
382-
QMessageBox msgBox;
383-
msgBox.setWindowTitle("Alert");
384-
msgBox.setText("This scene collection file contains portions of a scene collection purchased on the Elgato Marketplace. To install it, you will need to be logged in to the original account that purchased the collection. Please log in through the Elgato Marketplace menu item, and try to install again.");
385-
msgBox.setIcon(QMessageBox::Information);
386-
msgBox.setStandardButtons(QMessageBox::Close);
387-
msgBox.exec();
388-
return false;
389-
}
390-
id = embeddedId;
391-
}
392-
393396
_collection["modules"]["elgato_marketplace_connect"] = module_info;
394397

395398
return _createSceneCollection(collection_name);

0 commit comments

Comments
 (0)