# cdstarcat
[![Build Status](https://github.com/clld/cdstarcat/workflows/tests/badge.svg)](https://github.com/clld/cdstarcat/actions?query=workflow%3Atests)
[![PyPI](https://img.shields.io/pypi/v/cdstarcat.svg)](https://pypi.python.org/pypi/cdstarcat)
Manage objects in a CDSTAR instance using a local catalog.
## Install
Running
```shell
pip install cdstarcat
```
will install the `cdstarcat` package as well as a commandline interface `cdstarcat`.
For developing `cdstarcat`, clone the repository `clld/cdstarcat` and run
```shell
cd cdstarcat
pip install -r requirements.txt
```
## CLI
Run
```shell
cdstarcat --help
```
to get a list of available subcommands, and
```shell
cdstarcat help SUBCOMMAND
```
to get usage information for a particular subcommand.
## cdstarcat API
Typically, `cdstarcat` will be used programmatically, to implement recurring media file maintenance tasks
within projects - such as
[uploading media files for a new submission to Dictionaria](https://github.com/dictionaria/dictionaria-intern/blob/292644d23c0495d5a339bae1a0696ffe3129dcbf/pydictionaria/commands.py#L22-L42).
In the simplest case this could look as follows:
```python
import os
from cdstarcat import Catalog
def upload(directory):
with Catalog(
os.environ['CDSTAR_CATALOG'],
cdstar_url=os.environ['CDSTAR_URL'],
cdstar_user=os.environ['CDSTAR_USER'],
cdstar_pwd=os.environ['CDSTAR_PWD']
) as cat:
md = {
'collection': 'PROJECT NAME',
'path': '%s' % directory,
}
for fname, created, obj in cat.create(directory, md):
print('{0} -> {1}'.format(fname, obj.id))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/dlce-eva/cdstarcat",
"name": "cdstarcat",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Robert Forkel",
"author_email": "robert_forkel@eva.mpg.de",
"download_url": "https://files.pythonhosted.org/packages/73/25/9c8225cdc371e8fa933a8c1e71c5c56e2f2d481141ced8e0dd35569c9122/cdstarcat-1.4.0.tar.gz",
"platform": "any",
"description": "# cdstarcat\n\n[![Build Status](https://github.com/clld/cdstarcat/workflows/tests/badge.svg)](https://github.com/clld/cdstarcat/actions?query=workflow%3Atests)\n[![PyPI](https://img.shields.io/pypi/v/cdstarcat.svg)](https://pypi.python.org/pypi/cdstarcat)\n\nManage objects in a CDSTAR instance using a local catalog.\n\n\n## Install\n\nRunning\n```shell\npip install cdstarcat\n```\n\nwill install the `cdstarcat` package as well as a commandline interface `cdstarcat`.\n\nFor developing `cdstarcat`, clone the repository `clld/cdstarcat` and run\n```shell\ncd cdstarcat\npip install -r requirements.txt\n```\n\n\n## CLI\n\nRun\n```shell\ncdstarcat --help\n```\nto get a list of available subcommands, and\n```shell\ncdstarcat help SUBCOMMAND\n```\nto get usage information for a particular subcommand.\n\n\n## cdstarcat API\n\nTypically, `cdstarcat` will be used programmatically, to implement recurring media file maintenance tasks\nwithin projects - such as \n[uploading media files for a new submission to Dictionaria](https://github.com/dictionaria/dictionaria-intern/blob/292644d23c0495d5a339bae1a0696ffe3129dcbf/pydictionaria/commands.py#L22-L42).\n\nIn the simplest case this could look as follows:\n```python\nimport os\nfrom cdstarcat import Catalog\n\ndef upload(directory):\n with Catalog(\n os.environ['CDSTAR_CATALOG'],\n cdstar_url=os.environ['CDSTAR_URL'],\n cdstar_user=os.environ['CDSTAR_USER'],\n cdstar_pwd=os.environ['CDSTAR_PWD']\n ) as cat:\n md = {\n 'collection': 'PROJECT NAME',\n 'path': '%s' % directory,\n }\n for fname, created, obj in cat.create(directory, md):\n print('{0} -> {1}'.format(fname, obj.id))\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Manage objects in a CDSTAR instance through a catalog",
"version": "1.4.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "103b132734a643f49d47713588649558",
"sha256": "e3c741a1d53594b66f9cf80d106ebf5e3eaafcbfe2e277fb5e173008142d3a40"
},
"downloads": -1,
"filename": "cdstarcat-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "103b132734a643f49d47713588649558",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 15716,
"upload_time": "2022-12-06T08:27:09",
"upload_time_iso_8601": "2022-12-06T08:27:09.250542Z",
"url": "https://files.pythonhosted.org/packages/e2/19/6b344d76ef27e79813facf6999fcd32020fb1581d65bd2df47c419675562/cdstarcat-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "43cab4aadbec5c4bd4892abe1a6c5988",
"sha256": "2b221cd6502283de5ea465c1a7dab2b006eee9b8ba88b8df2a5e18fbd75c083e"
},
"downloads": -1,
"filename": "cdstarcat-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "43cab4aadbec5c4bd4892abe1a6c5988",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 14385,
"upload_time": "2022-12-06T08:27:10",
"upload_time_iso_8601": "2022-12-06T08:27:10.778339Z",
"url": "https://files.pythonhosted.org/packages/73/25/9c8225cdc371e8fa933a8c1e71c5c56e2f2d481141ced8e0dd35569c9122/cdstarcat-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-06 08:27:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "dlce-eva",
"github_project": "cdstarcat",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": null,
"specs": []
}
],
"lcname": "cdstarcat"
}