zapdos-py


Namezapdos-py JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryA CLI tool for indexing video files with programmatic access
upload_time2025-09-04 04:18:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords cli indexing video sdk keyframes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Zapdos-Py

A CLI tool for indexing video files by extracting keyframes that can also be used programmatically.

## Installation

To install zapdos-py, you can use pip:

```bash
pip install zapdos-py
```

Or if you're using uv:

```bash
uv pip install zapdos-py
```

## Usage

### Command Line Interface

After installation, you can use the zapdos-py command:

```bash
zapdos-py <video_file_path> [--interval <seconds>] [--api-key <api_key>]
```

This command will index the specified video file by extracting keyframes at regular intervals.

You can also set your API key as an environment variable:

```bash
export ZAPDOS_API_KEY=your_api_key_here
zapdos-py <video_file_path> [--interval <seconds>]
```

### Programmatic Usage

You can also use zapdos-py programmatically in your Python code using the client-based approach:

```python
from zapdos import Client

# Create a client with your API key
client = Client(api_key="your_api_key_here")

# Index a video file
try:
    result = client.index("path/to/your/video.mp4", interval_sec=30)
    print(f"Indexed {len(result['items'])} frames")
except FileNotFoundError as e:
    print(f"Error: {e}")
except ValueError as e:
    print(f"Error: {e}")
```

#### With Progress Callback

You can also provide a callback function to receive progress updates during the indexing process:

```python
from zapdos import Client

def progress_callback(event_data):
    """Callback function to handle progress updates."""
    event_type = event_data.get("event")
    if event_type == "uploaded":
        print(f"Uploaded frame {event_data.get('file_id')}")
    elif event_type == "done-indexing":
        print("Indexing completed successfully!")
    elif event_type == "error":
        print(f"Error: {event_data.get('message')}")

# Create a client with your API key
client = Client(api_key="your_api_key_here")

# Index a video file with progress updates
try:
    result = client.index(
        "path/to/your/video.mp4", 
        interval_sec=30,
        progress_callback=progress_callback
    )
    print(f"Indexed {len(result['items'])} frames")
except FileNotFoundError as e:
    print(f"Error: {e}")
except ValueError as e:
    print(f"Error: {e}")
```

## Example

### CLI Usage
```bash
# Extract frames every 30 seconds (default)
zapdos-py ./video.mp4

# Extract frames every 10 seconds
zapdos-py ./video.mp4 --interval 10

# With API key
zapdos-py ./video.mp4 --api-key your_api_key_here
```

### Programmatic Usage
```python
from zapdos import Client
from pathlib import Path

# Create a client with your API key
client = Client(api_key="your_api_key_here")

# Index a video file
video_path = Path("video.mp4")
try:
    result = client.index(video_path, interval_sec=30)
    print(f"Indexed {len(result['items'])} frames")
    for item in result['items']:
        print(f"  - {item}")
except FileNotFoundError as e:
    print(f"Error: {e}")
except ValueError as e:
    print(f"Error: {e}")
```

## Supported Video Formats

Zapdos-Py supports the following video formats:
- MP4 (.mp4)
- AVI (.avi)
- MOV (.mov)
- MKV (.mkv)
- WMV (.wmv)
- FLV (.flv)
- WEBM (.webm)
- M4V (.m4v)
- 3GP (.3gp, .3g2)
- MPG/MPEG (.mpg, .mpeg, .m2v)

## Development

To set up the project for development:

1. Clone the repository
2. Install uv if you haven't already: `pip install uv`
3. Install the package in development mode:
   ```bash
   uv pip install --editable .
   ```
4. Run the CLI tool:
   ```bash
   zapdos-py <video_file_path>
   ```

## Testing

There are several ways to run the tests:

### Using pytest (recommended):
```bash
pytest tests/
```

### Using unittest directly:
```bash
python -m unittest tests.test_cli
```

### Running the video indexer test:
```bash
python tests/test_video_indexer.py
```

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "zapdos-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "cli, indexing, video, sdk, keyframes",
    "author": null,
    "author_email": "Tri Nguyen <tri@zapdoslabs.com>",
    "download_url": "https://files.pythonhosted.org/packages/03/53/e3e245e781c9e497110aa2326eb271ddad9715db760da16fc8c20be3f51d/zapdos_py-0.2.3.tar.gz",
    "platform": null,
    "description": "# Zapdos-Py\n\nA CLI tool for indexing video files by extracting keyframes that can also be used programmatically.\n\n## Installation\n\nTo install zapdos-py, you can use pip:\n\n```bash\npip install zapdos-py\n```\n\nOr if you're using uv:\n\n```bash\nuv pip install zapdos-py\n```\n\n## Usage\n\n### Command Line Interface\n\nAfter installation, you can use the zapdos-py command:\n\n```bash\nzapdos-py <video_file_path> [--interval <seconds>] [--api-key <api_key>]\n```\n\nThis command will index the specified video file by extracting keyframes at regular intervals.\n\nYou can also set your API key as an environment variable:\n\n```bash\nexport ZAPDOS_API_KEY=your_api_key_here\nzapdos-py <video_file_path> [--interval <seconds>]\n```\n\n### Programmatic Usage\n\nYou can also use zapdos-py programmatically in your Python code using the client-based approach:\n\n```python\nfrom zapdos import Client\n\n# Create a client with your API key\nclient = Client(api_key=\"your_api_key_here\")\n\n# Index a video file\ntry:\n    result = client.index(\"path/to/your/video.mp4\", interval_sec=30)\n    print(f\"Indexed {len(result['items'])} frames\")\nexcept FileNotFoundError as e:\n    print(f\"Error: {e}\")\nexcept ValueError as e:\n    print(f\"Error: {e}\")\n```\n\n#### With Progress Callback\n\nYou can also provide a callback function to receive progress updates during the indexing process:\n\n```python\nfrom zapdos import Client\n\ndef progress_callback(event_data):\n    \"\"\"Callback function to handle progress updates.\"\"\"\n    event_type = event_data.get(\"event\")\n    if event_type == \"uploaded\":\n        print(f\"Uploaded frame {event_data.get('file_id')}\")\n    elif event_type == \"done-indexing\":\n        print(\"Indexing completed successfully!\")\n    elif event_type == \"error\":\n        print(f\"Error: {event_data.get('message')}\")\n\n# Create a client with your API key\nclient = Client(api_key=\"your_api_key_here\")\n\n# Index a video file with progress updates\ntry:\n    result = client.index(\n        \"path/to/your/video.mp4\", \n        interval_sec=30,\n        progress_callback=progress_callback\n    )\n    print(f\"Indexed {len(result['items'])} frames\")\nexcept FileNotFoundError as e:\n    print(f\"Error: {e}\")\nexcept ValueError as e:\n    print(f\"Error: {e}\")\n```\n\n## Example\n\n### CLI Usage\n```bash\n# Extract frames every 30 seconds (default)\nzapdos-py ./video.mp4\n\n# Extract frames every 10 seconds\nzapdos-py ./video.mp4 --interval 10\n\n# With API key\nzapdos-py ./video.mp4 --api-key your_api_key_here\n```\n\n### Programmatic Usage\n```python\nfrom zapdos import Client\nfrom pathlib import Path\n\n# Create a client with your API key\nclient = Client(api_key=\"your_api_key_here\")\n\n# Index a video file\nvideo_path = Path(\"video.mp4\")\ntry:\n    result = client.index(video_path, interval_sec=30)\n    print(f\"Indexed {len(result['items'])} frames\")\n    for item in result['items']:\n        print(f\"  - {item}\")\nexcept FileNotFoundError as e:\n    print(f\"Error: {e}\")\nexcept ValueError as e:\n    print(f\"Error: {e}\")\n```\n\n## Supported Video Formats\n\nZapdos-Py supports the following video formats:\n- MP4 (.mp4)\n- AVI (.avi)\n- MOV (.mov)\n- MKV (.mkv)\n- WMV (.wmv)\n- FLV (.flv)\n- WEBM (.webm)\n- M4V (.m4v)\n- 3GP (.3gp, .3g2)\n- MPG/MPEG (.mpg, .mpeg, .m2v)\n\n## Development\n\nTo set up the project for development:\n\n1. Clone the repository\n2. Install uv if you haven't already: `pip install uv`\n3. Install the package in development mode:\n   ```bash\n   uv pip install --editable .\n   ```\n4. Run the CLI tool:\n   ```bash\n   zapdos-py <video_file_path>\n   ```\n\n## Testing\n\nThere are several ways to run the tests:\n\n### Using pytest (recommended):\n```bash\npytest tests/\n```\n\n### Using unittest directly:\n```bash\npython -m unittest tests.test_cli\n```\n\n### Running the video indexer test:\n```bash\npython tests/test_video_indexer.py\n```\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A CLI tool for indexing video files with programmatic access",
    "version": "0.2.3",
    "project_urls": null,
    "split_keywords": [
        "cli",
        " indexing",
        " video",
        " sdk",
        " keyframes"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6fe998814fc9b3c8cd267aac37b567b6430e540307dadd8e450d478e15bded49",
                "md5": "449f997a0e438a8de433470e6f2c1866",
                "sha256": "91c0001610297e73cd4e45cc00b9192e9837c97f568524a6d589179b42657201"
            },
            "downloads": -1,
            "filename": "zapdos_py-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "449f997a0e438a8de433470e6f2c1866",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 13089,
            "upload_time": "2025-09-04T04:18:40",
            "upload_time_iso_8601": "2025-09-04T04:18:40.608879Z",
            "url": "https://files.pythonhosted.org/packages/6f/e9/98814fc9b3c8cd267aac37b567b6430e540307dadd8e450d478e15bded49/zapdos_py-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0353e3e245e781c9e497110aa2326eb271ddad9715db760da16fc8c20be3f51d",
                "md5": "51bd412c466c0fdc479b28ff49488bc8",
                "sha256": "08b7b0675436062d40702d903d13fae46b65cc556fb81eaa499d0ec8b0bd0249"
            },
            "downloads": -1,
            "filename": "zapdos_py-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "51bd412c466c0fdc479b28ff49488bc8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12293,
            "upload_time": "2025-09-04T04:18:41",
            "upload_time_iso_8601": "2025-09-04T04:18:41.772545Z",
            "url": "https://files.pythonhosted.org/packages/03/53/e3e245e781c9e497110aa2326eb271ddad9715db760da16fc8c20be3f51d/zapdos_py-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-04 04:18:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "zapdos-py"
}
        
Elapsed time: 0.62197s