예제 #1
0
    def create_fact(cls, **data):
        dip = DimensionItemProvider.insert(
            True,
            provider_id=data['provider_id'],
            provider_name=data['provider_name'],
        )
        pl = DimensionLanguage.insert(iso_code=data['primary_language'])
        vendor = DimensionVendor.insert(name=data['vendor'])
        country = DimensionCountryCode.objects.get(
            iso_code=data['country_of_origin_iso'])
        meta_type = DimensionMetadataType.insert(type=data['type'])
        item = DimensionItem.insert(item_id=data['item_id'])

        f = FactServicesBackstageItemMetadata.objects.create(
            metadata_id=data['metadata_id'],
            version=data['version'],
            country_of_origin=country,
            title=data['title'],
            copyright_cline=data['copyright_cline'],
            provider=dip,
            type=meta_type,
            isan=data['isan'],
            eidr=data['eidr'],
            release_date=data['release_date'],
            production_company=data['production_company'],
            release_year=data['release_year'],
            primary_language=pl,
            short_synopsis=data['short_synopsis'],
            medium_synopsis=data['medium_synopsis'],
            long_synopsis=data['long_synopsis'],
            runtime=data['runtime'],
            vendor=vendor,
            episode_number=data['episode_number'] or None,
            season=data['season'] or None,
            show_title=data['show_title'] or None,
            created=data['created'],
            modified=data['modified'] or data['created'],
            original_url=data['original_url'],
            ultraviolet=data['ultraviolet'],
            event_utc_date=DimensionUTCDate.date_from_datetime(
                datetime=data['event_time']),
            event_utc_datetime=data['event_time'])

        f.item_meta.add(item)

        return f
    def create_fact(cls, **data):
        dip = DimensionItemProvider.insert(
            True,
            provider_id=data['provider_id'],
            provider_name=data['provider_name'],
        )
        pl = DimensionLanguage.insert(iso_code=data['primary_language'])
        vendor = DimensionVendor.insert(name=data['vendor'])
        country = DimensionCountryCode.objects.get(iso_code=data['country_of_origin_iso'])
        meta_type = DimensionMetadataType.insert(type=data['type'])
        item = DimensionItem.insert(item_id=data['item_id'])

        f = FactServicesBackstageItemMetadata.objects.create(
            metadata_id=data['metadata_id'],
            version=data['version'],
            country_of_origin=country,
            title=data['title'],
            copyright_cline=data['copyright_cline'],
            provider=dip,
            type=meta_type,
            isan=data['isan'],
            eidr=data['eidr'],
            release_date=data['release_date'],
            production_company=data['production_company'],
            release_year=data['release_year'],
            primary_language=pl,
            short_synopsis=data['short_synopsis'],
            medium_synopsis=data['medium_synopsis'],
            long_synopsis=data['long_synopsis'],
            runtime=data['runtime'],
            vendor=vendor,
            episode_number=data['episode_number'] or None,
            season=data['season'] or None,
            show_title=data['show_title'] or None,
            created=data['created'],
            modified=data['modified'] or data['created'],
            original_url=data['original_url'],
            ultraviolet=data['ultraviolet'],
            event_utc_date=DimensionUTCDate.date_from_datetime(datetime=data['event_time']),
            event_utc_datetime=data['event_time']
        )

        f.item_meta.add(item)

        return f
    def create_fact(cls, **data):
        asset = DimensionAssets.insert(asset_id=data['asset_id'],
                                       type=data['asset_type'])

        unique_studio_item = DimensionStudioItem.insert(
            unique_studio_item_id=data['unique_studio_item_id'])
        studio = DimensionStudio.insert(name=data['studio'])
        data_role = DimensionDataRole.insert(role=data['data_role'])
        definition = DimensionDefinition.insert(definition=data['definition'])
        language = DimensionLanguage.insert(iso_code=data['language'])
        audio_channel = DimensionAudioChannels.insert(
            channel=data['audio_channel'])
        client = DimensionClient.insert(client_id=data['client_id'])
        vendor = DimensionVendor.insert(name=data['vendor'])

        fact = FactServicesAggregatorAggregation.objects.create(
            asset=asset,
            unique_studio_item=unique_studio_item,
            studio=studio,
            file_name=data['file_name'],
            start_time=data['start_time'],
            end_time=data['end_time'],
            file_size=data['file_size'],
            checksum=data['checksum'],
            data_role=data_role,
            content_duration=data['content_duration'],
            definition=definition,
            language=language,
            audio_channel=audio_channel,
            client=client,
            vendor=vendor,
            event_utc_date=DimensionUTCDate.date_from_datetime(
                datetime=data['event_time']),
            event_utc_datetime=data['event_time'])

        return fact
    def create_fact(cls, **data):
        asset = DimensionAssets.insert(
            asset_id=data['asset_id'],
            type=data['asset_type']
        )

        unique_studio_item = DimensionStudioItem.insert(unique_studio_item_id=data['unique_studio_item_id'])
        studio = DimensionStudio.insert(name=data['studio'])
        data_role = DimensionDataRole.insert(role=data['data_role'])
        definition = DimensionDefinition.insert(definition=data['definition'])
        language = DimensionLanguage.insert(iso_code=data['language'])
        audio_channel = DimensionAudioChannels.insert(channel=data['audio_channel'])
        client = DimensionClient.insert(client_id=data['client_id'])
        vendor = DimensionVendor.insert(name=data['vendor'])

        fact = FactServicesAggregatorAggregation.objects.create(
            asset=asset,
            unique_studio_item=unique_studio_item,
            studio=studio,
            file_name=data['file_name'],
            start_time=data['start_time'],
            end_time=data['end_time'],
            file_size=data['file_size'],
            checksum=data['checksum'],
            data_role=data_role,
            content_duration=data['content_duration'],
            definition=definition,
            language=language,
            audio_channel=audio_channel,
            client=client,
            vendor=vendor,
            event_utc_date=DimensionUTCDate.date_from_datetime(datetime=data['event_time']),
            event_utc_datetime=data['event_time']
        )

        return fact