Metadata-Version: 2.4
Name: agoras-media
Version: 2.0.1
Summary: Image and video processing for Agoras social media manager
Home-page: https://github.com/LuisAlejandro/agoras
Author: Luis Alejandro Martínez Faneyth
Author-email: luis@luisalejandro.org
Keywords: media,image,video,processing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
Requires-Dist: agoras-common>=2.0.0
Requires-Dist: filetype==1.2.0
Requires-Dist: opencv-python-headless==4.13.0.92
Requires-Dist: Pillow>=10.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

agoras-media
============

Image and video processing for social media platforms.

Installation
------------

.. code-block:: bash

   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
-----

.. code-block:: python

   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)
