Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: eLearning

Entity: slide.slide

Compute Method: _compute_vimeo_id

Inputs Method Outputs
for slide in self:
            if slide.video_url and slide.video_source_type == 'vimeo':
                match = re.search(self.VIMEO_VIDEO_ID_REGEX, slide.video_url)
                if match and len(match.groups()) == 3:
                    if match.group(3):
                        # in case of privacy 'with URL only', vimeo adds a token after the video ID
                        # the share url is then 'vimeo_id/token'
                        # the token will be captured in the third group of the regex (if any)
                        slide.vimeo_id = '%s/%s' % (match.group(2), match.group(3))
                    else:
                        # regular video, we just capture the vimeo_id
                        slide.vimeo_id = match.group(2)
            else:
                slide.vimeo_id = False

Back to entity