mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-16 16:54:39 +00:00
VC/Vidyo: Improvements in ZODB import script
This commit is contained in:
parent
4f0b047c08
commit
84c874be2f
@ -70,20 +70,18 @@ class VidyoImporter(Importer):
|
||||
vc_room.type = 'vidyo'
|
||||
vc_room.status = VCRoomStatus.created if booking._created else VCRoomStatus.deleted
|
||||
vc_room.name = booking_params['roomName']
|
||||
vc_room.show = not booking._hidden
|
||||
vc_room.data = {
|
||||
'description': booking_params['roomDescription'],
|
||||
'room_pin': booking._pin,
|
||||
'display_pin': booking_params['displayPin'],
|
||||
'moderation_pin': booking._moderatorPin,
|
||||
'show_phone_numbers': booking_params['displayPhoneNumbers'],
|
||||
'show_autojoin': booking_params['displayURL'],
|
||||
'vidyo_id': booking._roomId,
|
||||
'url': booking._url,
|
||||
'show': not booking._hidden,
|
||||
'owner': ('Avatar', booking._owner.id),
|
||||
'owner_identity': booking._ownerVidyoAccount,
|
||||
'auto_mute': booking_params.get('autoMute', True)
|
||||
}
|
||||
|
||||
db.session.add(vc_room)
|
||||
db.session.flush()
|
||||
vidyo_ext = VidyoExtension(vc_room_id=vc_room.id, value=booking._extension)
|
||||
@ -95,13 +93,34 @@ class VidyoImporter(Importer):
|
||||
|
||||
def migrate_event_bookings(self, vc_room, bookings):
|
||||
for booking in bookings:
|
||||
booking_params = booking._bookingParams
|
||||
|
||||
link_type = (VCRoomLinkType.get(MAP_LINK_TYPES[booking._linkVideoType]) if booking._linkVideoType
|
||||
else VCRoomLinkType.event)
|
||||
|
||||
if link_type == VCRoomLinkType.event:
|
||||
extracted_id = None
|
||||
elif not booking._linkVideoId:
|
||||
print cformat(
|
||||
"[%{red!}WARNING%{reset}] %{yellow!}{} is linked to a {} but no id given%{reset}. Linking to event."
|
||||
).format(vc_room, link_type.name)
|
||||
extracted_id = None
|
||||
link_type = VCRoomLinkType.event
|
||||
else:
|
||||
extracted_id = extract_id(booking._linkVideoId)
|
||||
|
||||
event_vc_room = VCRoomEventAssociation(
|
||||
event_id=booking._conf.id,
|
||||
vc_room=vc_room,
|
||||
link_type=(VCRoomLinkType.get(MAP_LINK_TYPES[booking._linkVideoType])
|
||||
if booking._linkVideoType else VCRoomLinkType.event),
|
||||
link_id=(extract_id(booking._linkVideoId) if booking._linkVideoType not in ('event', None) else None)
|
||||
link_type=link_type,
|
||||
link_id=extracted_id
|
||||
)
|
||||
event_vc_room.data = {
|
||||
'show_pin': booking_params['displayPin'],
|
||||
'show_phone_numbers': booking_params['displayPhoneNumbers'],
|
||||
'show_autojoin': booking_params['displayURL'],
|
||||
}
|
||||
|
||||
db.session.add(event_vc_room)
|
||||
print cformat(' + %{red!}{}%{reset} [%{yellow}{}%{reset}]').format(
|
||||
booking._conf.id, booking._linkVideoType)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user