How to use the edxval.models.Video.DoesNotExist function in edxval

To help you get started, we’ve selected a few edxval examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / xblock-azure-media-services / azure_media_services / ams.py View on Github external
def get_captions_and_video_info(self, data, suffix=''):
        edx_video_id = data.get('edx_video_id')

        try:
            video = Video.objects.get(edx_video_id=edx_video_id)
        except Video.DoesNotExist:
            asset = None
        else:
            media_service = get_media_service_client(self.location.org)
            asset = media_service.get_input_asset_by_video_id(edx_video_id, 'ENCODED')

        error_message = _("Target Video is no longer available on Azure or is corrupted in some way.")
        captions = []
        video_info = {}
        asset_files = None

        if asset:
            locator_on_demand = media_service.get_asset_locators(asset['Id'], LocatorTypes.OnDemandOrigin)
            locator_sas = media_service.get_asset_locators(asset['Id'], LocatorTypes.SAS)

            if locator_on_demand:
                error_message = ''

edxval

edx-val

AGPL-3.0
Latest version published 1 month ago

Package Health Score

72 / 100
Full package analysis