blob: 8aebf727d30508486361fc1761cd3bcc4e59865d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import subprocess
from typing import Optional
def metadata_list(db, prefix: Optional[str] = None) -> list[str]:
cmdline = ['xapian-metadata', 'list', db]
if prefix:
cmdline.append(prefix)
cmd = subprocess.run(cmdline, capture_output=True, text=True)
return cmd.stdout.split('\n')
def metadata_get(db, key: str) -> str:
cmd = subprocess.run(['xapian-metadata', 'get', db, key],
capture_output=True, text=True)
return cmd.stdout.strip()
|