def creatives(): """Processes creatives. """ creative_asset_feed = Feed(project.task['auth'], project.task['sheet_id'], 'creative_asset_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) creative_feed = Feed(project.task['auth'], project.task['sheet_id'], 'creative_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) third_party_url_feed = Feed(project.task['auth'], project.task['sheet_id'], 'third_party_url_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) creative_association_feed = Feed(project.task['auth'], project.task['sheet_id'], 'creative_asset_association_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) creative_dao.map_creative_third_party_url_feeds(creative_feed.feed, third_party_url_feed.feed) third_party_url_feed.update() creative_dao.map_creative_and_association_feeds( creative_feed.feed, creative_association_feed.feed) creative_dao.map_assets_feed(creative_asset_feed) execute_feed(creative_feed, creative_dao, FieldMap.CREATIVE_NAME, 'Processing creative') execute_feed(creative_association_feed, creative_association_dao, FieldMap.CREATIVE_ID, 'Associating with campaign, creative id') creative_association_feed.update()
def placements(): """Processes placements. """ placement_feed = Feed(project.task['auth'], project.task['sheet_id'], 'placement_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) pricing_schedule_feed = Feed(project.task['auth'], project.task['sheet_id'], 'placement_pricing_schedule_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) transcode_configs_feed = Feed(project.task['auth'], project.task['sheet_id'], 'transcode_configs_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) placement_dao.map_placement_transcode_configs(placement_feed.feed, transcode_configs_feed.feed, pricing_schedule_feed.feed) execute_feed(placement_feed, placement_dao, FieldMap.PLACEMENT_NAME, 'Processing placement') pricing_schedule_feed.update()
def process_feed(feed_name, dao, print_field, msg='Processing'): """Processes a feed that represents a specific entity in the Bulkdozer feed. Args: feed_name: Name of the feed to process, refer to feed.py for the supported feed names. dao: The data access object to be used to interact with the CM API and update, must match the entity being updated in CM, in the sense that the required fields to fetch, create, and update the entity in CM must be included in the feed. print_field: Field that identifies the item, used to print status messages to the Log tab of the Bulkdozer feed. msg: Prefix message to use when writing to the Log tab of the Bulkdozer feed, for instance we display Processing Campaign for campaign, and Uploading Asset for assets. """ feed = Feed(project.task['auth'], project.task['sheet_id'], feed_name, spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) execute_feed(feed, dao, print_field, msg)
def ads(): """Processes ads. """ placement_feed = Feed(project.task['auth'], project.task['sheet_id'], 'placement_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) event_tag_profile_feed = Feed(project.task['auth'], project.task['sheet_id'], 'event_tag_profile_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) ad_feed = Feed(project.task['auth'], project.task['sheet_id'], 'ad_feed', spreadsheet=spreadsheet, timezone=project.task.get('timezone', None)) ad_creative_assignment_feed = Feed(project.task['auth'], project.task['sheet_id'], 'ad_creative_assignment_feed', spreadsheet=spreadsheet, timezone=project.task.get( 'timezone', None)) ad_placement_assignment_feed = Feed(project.task['auth'], project.task['sheet_id'], 'ad_placement_assignment_feed', spreadsheet=spreadsheet, timezone=project.task.get( 'timezone', None)) ad_event_tag_assignment_feed = Feed(project.task['auth'], project.task['sheet_id'], 'event_tag_ad_assignment_feed', spreadsheet=spreadsheet, timezone=project.task.get( 'timezone', None)) ad_dao.map_feeds(ad_feed.feed, ad_creative_assignment_feed.feed, ad_placement_assignment_feed.feed, ad_event_tag_assignment_feed.feed, placement_feed.feed, event_tag_profile_feed.feed) execute_feed(ad_feed, ad_dao, FieldMap.AD_ID, 'Processing Ad') ad_creative_assignment_feed.update() ad_placement_assignment_feed.update() ad_event_tag_assignment_feed.update() event_tag_profile_feed.update()