Skip to content

Commit 1c0633d

Browse files
committed
fix: Fire recording-ready callbacks every time
1 parent 8b1aef6 commit 1c0633d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

bbblb/recordings.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RecordingImportError(RuntimeError):
3434
pass
3535

3636

37-
def playback_xml(playback: model.PlaybackFormat) -> ETree:
37+
def format_xml(playback: model.PlaybackFormat) -> ETree:
3838
orig = lxml.etree.fromstring(playback.xml)
3939
playback_domain = config.PLAYBACK_DOMAIN.format(
4040
DOMAIN=config.DOMAIN, REALM=playback.recording.tenant.realm
@@ -382,7 +382,6 @@ def _extract():
382382
self._breakpoint()
383383
self._log(f"Extracting: {self.source}")
384384
with tarfile.open(self.source) as tar:
385-
self._log(f"Opened: {tar}")
386385
tar.extractall(self.task_dir, filter=tarfile.data_filter)
387386
self._log(f"Extracted: {self.source}")
388387

@@ -526,15 +525,17 @@ async def _process_one(self, metafile: Path):
526525
if not format_created:
527526
pass # TODO: Merge existing with new format?
528527

529-
# Each new format triggers the recording-ready callbacks again,
530-
# just like BBB does it. We never know when the last format
531-
# arrived, so we keep the callbacks around for a while.
532-
if format_created and "bbblb-uuid" in record.meta:
528+
# The recording-ready callbacks are triggered for each format,
529+
# and may be triggered again if a format is imported multiple
530+
# times. That#s the way BBB behaves and most front-ends expect.
531+
# We never know when the last import happend, so we keep the
532+
# callbacks around for a while. (TODO)
533+
if "bbblb-uuid" in record.meta:
533534
async with model.session() as session:
534535
stmt = model.Callback.select(
535536
uuid=record.meta["bbblb-uuid"], type=model.CALLBACK_TYPE_REC
536537
)
537-
callbacks = (await session.execute(stmt)).scalars()
538+
callbacks = (await session.execute(stmt)).scalars().all()
538539

539540
# Fire callbacks in the background, they may take a while to
540541
# complete if the front-end is unresponsive.

bbblb/web/bbbapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ async def handle_get_recordings(ctx: BBBApiRequest):
663663

664664
playback_xml: ETree = rec_xml.find("playback")
665665
for playback in rec.formats:
666-
format_xml = recordings.playback_xml(playback, root_tag="format")
666+
format_xml = recordings.format_xml(playback)
667667
playback_xml.append(format_xml)
668668

669669
all_recordings.append(rec_xml)

0 commit comments

Comments
 (0)