Metadata-Version: 2.2
Name: audiomatic
Version: 0.1.4
Summary: The official Python client for the Audiomatic API
Author-email: Audiomatic <support@audiomatic.app>
License: MIT License
        
        Copyright (c) 2024 Audiomatic
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/AudiomaticInc/audiomatic-python
Keywords: audiomatic,translation,video,api,client
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: filetype>=1.2.0
Requires-Dist: imageio-ffmpeg>=0.5.1
Requires-Dist: requests>=2.32.3
Requires-Dist: urllib3<2.0.0

# audiomatic-python

The official Python library for the Audiomatic API

## Installation

```bash
pip install -U audiomatic
```

## Quick Start

```python
from audiomatic import Audiomatic

# Initialize the client
client = Audiomatic(api_key="your_api_key")

# Translate a local video file
project_id = client.translate(
    source="path/to/video.mp4",
    target_lang="es",
    project_name="Spanish Translation"
)

# Check translation status
status, result_url = client.get_status(project_id)
```

## Usage Examples

### Translating a YouTube Video

```python
# Translate a YouTube video to French
project_id = client.translate(
    source="https://youtube.com/watch?v=example",
    target_lang="fr",
    project_name="French Translation"
)
```

### Advanced Options

```python
# Translate with custom options
project_id = client.translate(
    source="path/to/video.mp4",
    target_lang="de",
    project_name="German Translation",
    opt_params={
        "accent_level": 0.75,
        "num_speakers": 2,
        "remove_background_audio": True,
        "start_time": 30000,  # Start at 30 seconds
        "end_time": 120000,   # End at 2 minutes
        "captions_path": "path/to/captions.vtt"
    }
)
```

## API Reference

### Client Initialization

#### `Audiomatic(api_key: str)`

Initialize the Audiomatic client.

**Parameters:**
- `api_key` (str): Your Audiomatic API key

### Methods

#### `translate(source: str, target_lang: str, project_name: Optional[str] = None, opt_params: Optional[Dict] = None) -> str`

Translate a video file or YouTube URL.

**Parameters:**
- `source` (str): Path to local video file or YouTube URL
- `target_lang` (str): Target language code (e.g., "es", "fr", "de")
- `project_name` (str, optional): Custom project name (defaults to filename)
- `opt_params` (Dict, optional): Additional parameters:
  - `accent_level` (float): Voice accent level (0, 0.25, 0.5, 0.75, or 1)
  - `num_speakers` (int): Number of speakers in video (defaults to auto-detect)
  - `remove_background_audio` (bool): Whether to remove background audio
  - `start_time` (int): Start time of video clip in milliseconds
  - `end_time` (int): End time of video clip in milliseconds
  - `captions_path` (str): Path to custom captions file

**Returns:** Project ID string

#### `get_status(project_id: str) -> Tuple[str, Optional[str]]`

Check the status of a translation project.

**Parameters:**
- `project_id` (str): Project ID returned from translate()

**Returns:** Tuple of (status, result_url)

## Limitations

- Maximum file size: 500MB
- Maximum video duration: 15 minutes
- Supported languages: ['en', 'fr', 'es', 'de', 'pt', 'zh', 'ja', 'hi', 'it', 'ko', 'nl', 'pl', 'ru', 'sv', 'tr']
- Supported accent levels:[0, 0.25, 0.5, 0.75, 1]

## Error Handling

The client includes a custom `AudiomaticError` exception class that provides detailed error information:

```python
try:
    project_id = client.translate(...)
except AudiomaticError as e:
    print(f"Error: {e}")
    print(f"Status Code: {e.status_code}")
    print(f"Error Code: {e.error_code}")
```
