An open API service indexing awesome lists of open source software.

https://github.com/alisharify7/xmeta

**Xmeta** is a Python package to perform CRUD operations on media metadata across various file types like images, videos, audio, and documents.
https://github.com/alisharify7/xmeta

Last synced: 4 months ago
JSON representation

**Xmeta** is a Python package to perform CRUD operations on media metadata across various file types like images, videos, audio, and documents.

Awesome Lists containing this project

README

          

# ๐Ÿ’ซ XMeta

Donate/Support [Optional]

GitHub repo size GitHub contributors

XMeta Logo

**XMeta** is a powerful and extensible Python package for performing CRUD operations on media metadata.
It supports a wide range of file types including images, videos, audio files, and documents.

---

## โœจ Features

- โœ… Unified interface to **read**, **update**, and **delete** metadata
- ๐Ÿ–ผ๏ธ Supports **images** (`.jpeg`, `.png`, etc.)
- ๐ŸŽž๏ธ Supports **videos** (`.mp4`, `.mkv`, etc.)
- ๐ŸŽง Supports **audio files** (`.mp3`, `.flac`, etc.)
- ๐Ÿ“„ Supports **documents** (`.pdf`, `.docx`, etc.)
- ๐Ÿง  Automatic file type detection via MIME type and file extension
- ๐Ÿ”Œ Easily extensible with **custom handlers**

---

## ๐Ÿ“ฆ Installation

> XMeta is not yet published on PyPI. You can install it locally for development:

```bash
pip install xmeta # Coming soon to PyPI
```

---

## ๐Ÿ› ๏ธ Usage Guide

XMeta offers a simple and consistent interface to interact with media metadata.

---

### โœ… 1. Initialize the Metadata Manager

Create an instance of `XmetaMetadataManager` by passing the file path:

```python
from xmeta import XmetaMetadataManager

file_meta = XmetaMetadataManager("path/to/your/file")
```

---

### โœ… 2. Read Metadata

Retrieve and inspect the metadata of the file:

```python
metadata = file_meta.read()
print(metadata)
```

> โ„น๏ธ Returns a dictionary of key-value pairs representing the file's metadata.

---

### โœ… 3. Update Metadata

Modify or add metadata by passing a new dictionary:

```python
file_meta.update(new_metadata={
"Author": "Ali Sharify",
"Description": "Sample image"
})
```

> โš ๏ธ This replaces the existing metadata fields with the new values provided.

---

### โœ… 4. Save the Changes

Write the updated metadata back to a file. You can either overwrite the original or write to a new file:

```python
file_meta.save(output_path="updated_file.jpg") # Saves to a new file
```

If `output_path` is **not** provided, the original file will be **overwritten**.

---

## ๐Ÿงช Example

A complete usage example:

```python
from xmeta import XmetaMetadataManager

meta = XmetaMetadataManager("sample.jpg")

# Read existing metadata
print(meta.read())

# Update selected fields
meta.update({
"Title": "Sunset Photo",
"Location": "Caspian Sea"
})

# Save changes to a new file
meta.save("sunset_updated.jpg")
```

---

## ๐Ÿ“š Coming Soon

- ๐Ÿงฐ **Command-line interface** (CLI) for quick metadata editing
- ๐Ÿ”Œ **Plugin system** for extending media type support
- ๐Ÿ–ฅ๏ธ **Web dashboard** for managing metadata visually

---

## ๐Ÿ‘จโ€๐Ÿ’ป Author

Developed with โค๏ธ by [Ali Sharify](https://github.com/alisharify7)
Proudly maintained by the [Free Developers](https://github.com/free-programmers) organization.

---

## ๐Ÿ“„ License

This project is licensed under the GPL-3.0 license License.

## Star History

[![Stargazers over time](https://starchart.cc/alisharify7/xmeta.svg?variant=adaptive)](https://starchart.cc/alisharify7/xmeta)