CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-media

Microsoft Azure Media Services Client Library for Python - A management library for Azure Media Services that provides programmatic access to media processing and streaming capabilities in the cloud.

83

1.09x

Quality

Pending

Does it follow best practices?

Impact

83%

1.09x

Average score across 10 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-7/

Video Streaming Filter Manager

Build a Python utility that manages manifest filters for Azure Media Services streaming assets. Filters allow you to customize playback by controlling which tracks and bitrates are available to viewers without re-encoding content.

Requirements

The utility should manage two types of filters:

Account-level filters: Apply globally to all assets in a Media Services account Asset-specific filters: Apply only to a particular asset

Core Functionality

Implement the following operations:

  • Create an account-level filter with configurable bitrate range and track type filtering
  • Create an asset-specific filter for a given asset with the same filtering capabilities
  • List all account-level filters in the account
  • Retrieve a specific filter by name to inspect its configuration
  • Delete an account-level filter when no longer needed

Filter Configuration Options

Support the following filter properties:

  • Bitrate range: Specify minimum and maximum bitrate in bits per second to limit available quality levels
  • Track type filtering: Filter by track type (Audio, Video, or Text)
  • Presentation time range: Define DVR window with start time and duration (in 100-nanosecond ticks)
  • First quality bitrate: Set the bitrate threshold for initial playback quality

Test Cases

  • Creating an account-level filter with a bitrate range of 500000-2000000 bps successfully returns a filter object with the correct bitrate properties @test
  • Creating an asset-specific filter for a given asset with video track filtering successfully returns a filter object associated with that asset @test
  • Listing account filters returns all previously created account-level filters @test
  • Retrieving a filter by name returns the correct filter configuration @test

Implementation

@generates

API

from typing import Optional, List, Dict, Any
from azure.mgmt.media import AzureMediaServices
from azure.mgmt.media.models import AccountFilter, AssetFilter

class FilterManager:
    """Manages manifest filters for Azure Media Services."""

    def __init__(self, client: AzureMediaServices, resource_group: str, account_name: str):
        """
        Initialize the filter manager.

        Args:
            client: Azure Media Services client instance
            resource_group: Azure resource group name
            account_name: Media Services account name
        """
        pass

    def create_account_filter(
        self,
        filter_name: str,
        bitrate_min: Optional[int] = None,
        bitrate_max: Optional[int] = None,
        track_type: Optional[str] = None,
        presentation_time_start: Optional[int] = None,
        presentation_time_duration: Optional[int] = None,
        first_quality_bitrate: Optional[int] = None
    ) -> AccountFilter:
        """
        Create an account-level filter.

        Args:
            filter_name: Name for the filter
            bitrate_min: Minimum bitrate in bps (optional)
            bitrate_max: Maximum bitrate in bps (optional)
            track_type: Track type filter - "Audio", "Video", or "Text" (optional)
            presentation_time_start: Start time for DVR window in ticks (optional)
            presentation_time_duration: Duration for DVR window in ticks (optional)
            first_quality_bitrate: First quality bitrate threshold in bps (optional)

        Returns:
            The created AccountFilter object
        """
        pass

    def create_asset_filter(
        self,
        asset_name: str,
        filter_name: str,
        bitrate_min: Optional[int] = None,
        bitrate_max: Optional[int] = None,
        track_type: Optional[str] = None,
        presentation_time_start: Optional[int] = None,
        presentation_time_duration: Optional[int] = None,
        first_quality_bitrate: Optional[int] = None
    ) -> AssetFilter:
        """
        Create an asset-specific filter.

        Args:
            asset_name: Name of the asset to create filter for
            filter_name: Name for the filter
            bitrate_min: Minimum bitrate in bps (optional)
            bitrate_max: Maximum bitrate in bps (optional)
            track_type: Track type filter - "Audio", "Video", or "Text" (optional)
            presentation_time_start: Start time for DVR window in ticks (optional)
            presentation_time_duration: Duration for DVR window in ticks (optional)
            first_quality_bitrate: First quality bitrate threshold in bps (optional)

        Returns:
            The created AssetFilter object
        """
        pass

    def list_account_filters(self) -> List[AccountFilter]:
        """
        List all account-level filters.

        Returns:
            List of AccountFilter objects
        """
        pass

    def get_account_filter(self, filter_name: str) -> AccountFilter:
        """
        Get a specific account filter by name.

        Args:
            filter_name: Name of the filter to retrieve

        Returns:
            The AccountFilter object
        """
        pass

    def delete_account_filter(self, filter_name: str) -> None:
        """
        Delete an account-level filter.

        Args:
            filter_name: Name of the filter to delete
        """
        pass

Dependencies { .dependencies }

azure-mgmt-media { .dependency }

Provides Azure Media Services management capabilities including filter operations.

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-media

tile.json