Skip to content

Commit 9243c00

Browse files
sven337Benehiko
authored andcommitted
when getting highres, remove corresponding sub stream and re-parent tree
1 parent 8cacb47 commit 9243c00

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

examples/video_review_gui.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,28 @@ def add_video(self, video_path):
375375
# Find a potentially pre-existing channel0 item for this datetime, if so, add as a child
376376
# This lets channel1 appear as a child, but also main & sub videos appear in the same group
377377
channel_0_item = self.find_channel_0_item(start_datetime)
378+
378379
if channel_0_item:
379-
channel_0_item.addChild(video_item)
380+
# Check if the current item is a main stream and the existing channel_0_item is a sub stream
381+
if "RecM" in base_file_name and "RecS" in channel_0_item.text(1):
382+
# Make the current main stream item the new parent
383+
new_parent = video_item
384+
# Move all children of the sub stream item to the new main stream item
385+
while channel_0_item.childCount() > 0:
386+
child = channel_0_item.takeChild(0)
387+
new_parent.addChild(child)
388+
# Remove the old sub stream item
389+
parent = channel_0_item.parent()
390+
if parent:
391+
parent.removeChild(channel_0_item)
392+
else:
393+
index = self.video_tree.indexOfTopLevelItem(channel_0_item)
394+
self.video_tree.takeTopLevelItem(index)
395+
# Add the new main stream item as a top-level item
396+
self.video_tree.addTopLevelItem(new_parent)
397+
else:
398+
# If it's not a main stream replacing a sub stream, add as a child as before
399+
channel_0_item.addChild(video_item)
380400
else:
381401
self.video_tree.addTopLevelItem(video_item)
382402

0 commit comments

Comments
 (0)