Skip to main content

A simple database for storing metadata associated with (media) files.

Project description

MetaVault

MetaVault is a simple database for storing metadata associated with (media) files. This is a simple wrapper around sqlite3 which mimics the behavior of a Python dictionary. This is designed to provide an easy-to-use interface for managing metadata. I am fully aware that this is not the most efficient way to work with sqlite3, but it is a simple way to work with sqlite in an object-oriented way.

Installation

Install using pip:

pip install metavault

Usage

from metavault import MetaVaultDatabase

# connect to database
database = MetaVaultDatabase('test.vault')

# create dataset (or version of dataset)
database.create_dataset('test')
dataset = database['test']

# add data to dataset
dataset["riddim.mp3"] = {"artist": "Bounty Killer", "title": "Riddim Killa"}
dataset["ambient.mp3"] = {"artist": "Dog The Bounty Hunter", "title": "Trashcore"}

# iterate
for item in dataset:
    print(f"- {item}") # - {'riddim.mp3': {'artist': 'Bounty Killer', 'title': 'Riddim Killa'}}

# acts like a dictionary
print(f"\n{dataset['riddim.mp3']}") # {'artist': 'Bounty Killer', 'title': 'Riddim Killa'}

# remove data
del dataset['riddim.mp3']
print(dataset.keys()) # ['ambient.mp3']

# remove attribute
dataset.remove_attribute('artist')
print(dataset['ambient.mp3']) # {'title': 'Trashcore'}

# add attribute
dataset.add_attribute('artist')
dataset['ambient.mp3']['artist'] = "Dog The Bounty Hunter"
print(dataset['ambient.mp3']) # {'title': 'Trashcore', 'artist': 'Dog The Bounty Hunter'}

database.close()

# or with context manager
with MetaVaultDatabase('test.locker') as database:
    dataset = database['test']
    # export as various formats
    dataset.export('test.csv')
    dataset.export('test.json')
    dataset.export('test.jsonl')

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

MetaVault-0.1.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file MetaVault-0.1.tar.gz.

File metadata

  • Download URL: MetaVault-0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for MetaVault-0.1.tar.gz
Algorithm Hash digest
SHA256 b9e470183a7ad32d94809f81d2b0d6bdef7888f1a0a296a33b7b2a7eaddc6dbe
MD5 50abd0ec55ba7f3b00ba411865954567
BLAKE2b-256 1f76f1b1f08bce9896b78b5f023400681e38ea954c79c370d384bc05e4cf28f9

See more details on using hashes here.

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