Skip to main content

Image and video processing for Agoras social media manager

Project description

Image and video processing for social media platforms.

Installation

pip install agoras-media

Contents

  • MediaFactory: Factory for creating Image and Video instances

  • Image: Image download, validation, and processing

  • Video: Video download, validation, and platform-specific limits

Usage

import asyncio
from agoras.media import MediaFactory, Image, Video

# Create and download images
async def download_image():
    image = Image('https://example.com/image.jpg')
    await image.download()
    # Use image.content, image.temp_file
    image.cleanup()

# Create platform-specific video
async def download_video():
    video = MediaFactory.create_video('https://example.com/video.mp4', 'facebook')
    await video.download()
    # Use video.content, video.temp_file
    video.cleanup()

# Download multiple images
async def batch_download():
    images = await MediaFactory.download_images([
        'https://example.com/image1.jpg',
        'https://example.com/image2.jpg'
    ])
    for img in images:
        print(f'Downloaded: {img.url}')
        img.cleanup()

asyncio.run(download_image())

Media constraints

Per-platform MIME, size, duration, and transfer limits live in agoras.media.constraints. Wrappers and MediaFactory import the same table; do not hardcode limits elsewhere.

To inspect limits:

agoras utils media-limits
agoras utils media-limits --platform discord --kind video

To add a platform row, edit constraints.py and run:

pytest packages/media/tests/test_constraints_contract.py

Dependencies

  • agoras-common

  • Pillow (image processing)

  • opencv-python-headless (video duration and validation)

  • filetype (file type detection)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agoras_media-2.0.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agoras_media-2.0.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file agoras_media-2.0.1.tar.gz.

File metadata

  • Download URL: agoras_media-2.0.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agoras_media-2.0.1.tar.gz
Algorithm Hash digest
SHA256 0172bc0b2726274c8f751147d0c07734270002237d4200b4d74be794acb389b6
MD5 8b9c066bcaf3a382ceecae5a92c536d1
BLAKE2b-256 40c7b91b703d1d7c6a25b9d8c6cd90a7b3797a15ff39b78a5c57d671cea4ce60

See more details on using hashes here.

Provenance

The following attestation bundles were made for agoras_media-2.0.1.tar.gz:

Publisher: release.yml on LuisAlejandro/agoras

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agoras_media-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: agoras_media-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agoras_media-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef40d0ba9b33e635d198256188a8963d725b195f348cac3e5c190f5efd487852
MD5 3620531f97eff28ac068a5c05852c3d7
BLAKE2b-256 839a29b124540473d252b4847c1a79fd9271157bc0c4cc6caf549c604ce7633f

See more details on using hashes here.

Provenance

The following attestation bundles were made for agoras_media-2.0.1-py3-none-any.whl:

Publisher: release.yml on LuisAlejandro/agoras

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page