metaindex


Namemetaindex JSON
Version 2.3.0 PyPI version JSON
download
home_pagehttps://vonshednob.cc/metaindex
SummaryUtilities to tag files
upload_time2023-06-20 19:53:55
maintainer
docs_urlNone
authorR
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # metaindex

metaindex allows you to find files based on metadata information.

For example, if you want to find all pictures that are have a certain width,
you could do this:

    metaindex find mimetype:image resolution:1200x

The following file formats are supported out of the box (although they might
need additional python packages, see <#Installation>):

 - images (png, jpg, etc.; whatever is supported by [Pillow](https://python-pillow.org/))
 - audio (mp3, m4a, ogg, etc.; whatever is supported by [mutagen](https://mutagen.readthedocs.io/))
 - OpenDocument (odt, ods, etc.)
 - Office Open XML (docx, pptx, xlsx)
 - pdf
 - html
 - epub
 - [abc](https://abcnotation.com/) music notation
 - cbz (through [ComicInfo.xml](https://github.com/anansi-project/comicinfo))
 - gpx
 - filetags in the style of [Karl Voit's filetags](https://karl-voit.at/managing-digital-photographs/)


## Installation

To install metaindex either install it directly through pypi:

    pip install metaindex

Or clone the repository and install that then through pip:

    git clone https://codeberg.org/vonshednob/metaindex
    cd metaindex
    pip install .

Most modules are optional. If you, for example, want to use metaindex for audio
files and PDFs, you will have to install it like this:

    pip install metaindex[pdf,audio]

or, for the cloned repository:

    pip install .[pdf,audio]

These modules exist for indexing:

 - `pdf`, for PDF files,
 - `audio`, any type of audio/music file,
 - `image`, any type of image file,
 - `video`, any type of video file (overlaps somewhat with `audio`),
 - `ebook`, ebooks and comic book formats,
 - `xdg`, support for XDG (if you use Linux, just add it),
 - `yaml`, extra metadata in YAML format,
 - `ocr`, find and extract text from images with tesseract (you must have
   tesseract installed for this to work).

In case you just want everything, this is your install command:

    pip install .[all]

There is also an experimental FuseFS filesystem. To be able to use it, you
will have to specify ``fuse`` as an additional module:

    pip install .[all,fuse]


### Server dependencies

If you just want to connect to another instance of the metaindex server,
you are ready to go.  
More likely though you will have to install [Xapian](https://xapian.org/)
and its Python3 bindings. Please follow the usual way of your OS to install
both.

For example, on Archlinux you'd `pacman -S xapian python-xapian`. On
debian-likes it would be `apt install python3-xapian`.


## Usage

Before you can use metaindex to search for files, you have to initialize the
cache by telling it where your files to index are, for example:

    metaindex index --recursive --index ~/Pictures

Afterwards you can start searching for files by metadata, like this:

    metaindex find


## Searching

Search queries for use with `metaindex find` allow you to search

 - for files that have a metadata tag: `metaindex find resolution:`
 - for files that have a metadata tag with a certain value: `metaindex find title:"dude, where is my car"`
 - for files that have any metadata tag with a certain value: `metaindex find "just anything"`

Each value that you provide is actually a case insensitive regular expression.


## Usage from Python

To use the metaindex infrastructure from Python, you should instantiate a
`Cache` and run queries against it (with `find`).

`Cache.find` will return an iterable of `CacheEntry` instances, consisting of

 - `path`, the location in the file system where that file was last seen
 - `metadata`, a multidict of all metadata
 - `last_modified`, the timestamp when the file was last modified on disk (to
   the knowledge of the cache)

You can just iterate over the `CacheEntry` instances to get their `tag,
value` tuples.

To use the user's preferences, it's a good idea to load their configuration.
Here's an example snippet that'll do both things:

```python
    from metaindex.configuration import load
    from metaindex import Cache

    config = load()
    cache = Cache(config)

    searchquery = 'mimetype:image'

    for entry in cache.find(searchquery):
        print(entry.path)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://vonshednob.cc/metaindex",
    "name": "metaindex",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "R",
    "author_email": "devel+metaindex@kakaomilchkuh.de",
    "download_url": "https://files.pythonhosted.org/packages/9b/df/91e6261ab10134d62e221fa72f39e0c5699b0fe6858d7340a49f22f91725/metaindex-2.3.0.tar.gz",
    "platform": null,
    "description": "# metaindex\n\nmetaindex allows you to find files based on metadata information.\n\nFor example, if you want to find all pictures that are have a certain width,\nyou could do this:\n\n    metaindex find mimetype:image resolution:1200x\n\nThe following file formats are supported out of the box (although they might\nneed additional python packages, see <#Installation>):\n\n - images (png, jpg, etc.; whatever is supported by [Pillow](https://python-pillow.org/))\n - audio (mp3, m4a, ogg, etc.; whatever is supported by [mutagen](https://mutagen.readthedocs.io/))\n - OpenDocument (odt, ods, etc.)\n - Office Open XML (docx, pptx, xlsx)\n - pdf\n - html\n - epub\n - [abc](https://abcnotation.com/) music notation\n - cbz (through [ComicInfo.xml](https://github.com/anansi-project/comicinfo))\n - gpx\n - filetags in the style of [Karl Voit's filetags](https://karl-voit.at/managing-digital-photographs/)\n\n\n## Installation\n\nTo install metaindex either install it directly through pypi:\n\n    pip install metaindex\n\nOr clone the repository and install that then through pip:\n\n    git clone https://codeberg.org/vonshednob/metaindex\n    cd metaindex\n    pip install .\n\nMost modules are optional. If you, for example, want to use metaindex for audio\nfiles and PDFs, you will have to install it like this:\n\n    pip install metaindex[pdf,audio]\n\nor, for the cloned repository:\n\n    pip install .[pdf,audio]\n\nThese modules exist for indexing:\n\n - `pdf`, for PDF files,\n - `audio`, any type of audio/music file,\n - `image`, any type of image file,\n - `video`, any type of video file (overlaps somewhat with `audio`),\n - `ebook`, ebooks and comic book formats,\n - `xdg`, support for XDG (if you use Linux, just add it),\n - `yaml`, extra metadata in YAML format,\n - `ocr`, find and extract text from images with tesseract (you must have\n   tesseract installed for this to work).\n\nIn case you just want everything, this is your install command:\n\n    pip install .[all]\n\nThere is also an experimental FuseFS filesystem. To be able to use it, you\nwill have to specify ``fuse`` as an additional module:\n\n    pip install .[all,fuse]\n\n\n### Server dependencies\n\nIf you just want to connect to another instance of the metaindex server,\nyou are ready to go.  \nMore likely though you will have to install [Xapian](https://xapian.org/)\nand its Python3 bindings. Please follow the usual way of your OS to install\nboth.\n\nFor example, on Archlinux you'd `pacman -S xapian python-xapian`. On\ndebian-likes it would be `apt install python3-xapian`.\n\n\n## Usage\n\nBefore you can use metaindex to search for files, you have to initialize the\ncache by telling it where your files to index are, for example:\n\n    metaindex index --recursive --index ~/Pictures\n\nAfterwards you can start searching for files by metadata, like this:\n\n    metaindex find\n\n\n## Searching\n\nSearch queries for use with `metaindex find` allow you to search\n\n - for files that have a metadata tag: `metaindex find resolution:`\n - for files that have a metadata tag with a certain value: `metaindex find title:\"dude, where is my car\"`\n - for files that have any metadata tag with a certain value: `metaindex find \"just anything\"`\n\nEach value that you provide is actually a case insensitive regular expression.\n\n\n## Usage from Python\n\nTo use the metaindex infrastructure from Python, you should instantiate a\n`Cache` and run queries against it (with `find`).\n\n`Cache.find` will return an iterable of `CacheEntry` instances, consisting of\n\n - `path`, the location in the file system where that file was last seen\n - `metadata`, a multidict of all metadata\n - `last_modified`, the timestamp when the file was last modified on disk (to\n   the knowledge of the cache)\n\nYou can just iterate over the `CacheEntry` instances to get their `tag,\nvalue` tuples.\n\nTo use the user's preferences, it's a good idea to load their configuration.\nHere's an example snippet that'll do both things:\n\n```python\n    from metaindex.configuration import load\n    from metaindex import Cache\n\n    config = load()\n    cache = Cache(config)\n\n    searchquery = 'mimetype:image'\n\n    for entry in cache.find(searchquery):\n        print(entry.path)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Utilities to tag files",
    "version": "2.3.0",
    "project_urls": {
        "Homepage": "https://vonshednob.cc/metaindex"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f364fd2bb11812da24ae9fc01e3e602f30bfad43ecb13c9e5659962cc09131fc",
                "md5": "a2fbf8d027d15de9dff926b2b281d9c1",
                "sha256": "f250d9e0e44c612493ad603c5fb01b4fa79deae68cc3e49359822bbd7f6433c0"
            },
            "downloads": -1,
            "filename": "metaindex-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a2fbf8d027d15de9dff926b2b281d9c1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 121556,
            "upload_time": "2023-06-20T19:53:52",
            "upload_time_iso_8601": "2023-06-20T19:53:52.720728Z",
            "url": "https://files.pythonhosted.org/packages/f3/64/fd2bb11812da24ae9fc01e3e602f30bfad43ecb13c9e5659962cc09131fc/metaindex-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9bdf91e6261ab10134d62e221fa72f39e0c5699b0fe6858d7340a49f22f91725",
                "md5": "014eb8cf83a5a81169e1edae35f38e73",
                "sha256": "ec6007f74559017747a2003d26134c3cfab02de76c7ba7a02123b0e9818b6f13"
            },
            "downloads": -1,
            "filename": "metaindex-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "014eb8cf83a5a81169e1edae35f38e73",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 417245,
            "upload_time": "2023-06-20T19:53:55",
            "upload_time_iso_8601": "2023-06-20T19:53:55.637155Z",
            "url": "https://files.pythonhosted.org/packages/9b/df/91e6261ab10134d62e221fa72f39e0c5699b0fe6858d7340a49f22f91725/metaindex-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-20 19:53:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "metaindex"
}
        
R
Elapsed time: 0.08007s