# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['flumes', 'flumes.alembic', 'flumes.alembic.versions']

package_data = \
{'': ['*']}

install_requires = \
['PyGObject>=3.42.0,<4.0.0',
 'SQLAlchemy>=1.4.26,<2.0.0',
 'alembic>=1.7.5,<2.0.0',
 'packaging>=21.3,<22.0',
 'python-dateutil>=2.8.2,<3.0.0']

entry_points = \
{'console_scripts': ['flumes-discovery = flumes.discoverer:run']}

setup_kwargs = {
    'name': 'flumes',
    'version': '0.1.23',
    'description': 'Scan and index your media files',
    'long_description': '<div align="center">\n  <h1>Flumes\n  <h4>Scan and index your media files</h4>\n<div align="center">\n  \n  <a href="">[![PyPI version](https://badge.fury.io/py/flumes.svg)](https://badge.fury.io/py/flumes)</a>\n  <a href=""><img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/fluendo/flumes"></a>\n  <a href=""><img alt="Maintenance" src="https://img.shields.io/maintenance/yes/2022"></a>\n  <a href=""><img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/fluendo/flumes"></a>\n  <a href="">[![ci](https://github.com/fluendo/flumes/actions/workflows/ci.yml/badge.svg)](https://github.com/fluendo/flumes/actions/workflows/ci.yml) </a>\n  <a href="">[![cd](https://github.com/fluendo/flumes/actions/workflows/cd.yml/badge.svg)](https://github.com/fluendo/flumes/actions/workflows/cd.yml)</a>\n  <a href="">[![License](https://img.shields.io/github/license/fluendo/flumes.svg)](https://github.com/fluendo/flumes)</a>\n  <a href=""><img alt="Website" src="https://img.shields.io/website?label=fluendo.com&up_color=blue&up_message=flumes&url=https%3A%2F%2Ffluendo.com"></a>\n\n  \n</div>\n</div><br>\n  \n## Table of Contents\n- [About The Project](#about_the_project)\n- [Getting Started](#getting_started)\n  - [System requirements](#system_requirements)\n  - [Installation](#installation)  \n    - [Poetry](#poetry)\n    - [Docker](#docker)\n  - [Troubleshooting](#troubleshooting)\n- [Usage](#usage)\n  - [Querying the database](#querying_the_database)\n  - [Trigger rescan](#trigger_rescan)\n- [Development](#development)\n  - [Required dependencies](#required_dependencies)\n  - [Git hook](#git_hook)\n  - [New releases](#new_releases)\n  - [Tagging](#tagging)\n  - [Database](#database)\n  - [Testing](#testing)\n- [License](#license)\n\n## About The Project <a name = "about_the_project"></a>\nFlumes is a tool that allows you to select a folder and detect existing media files automatically. These media files are scanned and all relevant information is stored in a database. In addition, you can trigger a scan manually anytime to update your database.\n\n**Features**\n* Scan media files in a selected directory\n* Automatically rescan selected media directory when changes are detected\n* Stores the `GstDiscoveryStream` information and the `GstCaps` structure fields in a database\n* Trigger directory rescan manually\n\n## Getting Started <a name = "getting_started"></a>\n**System requirements** <a name = "system_requirements"></a>\n\n* Operating system: Linux 64-bit\n  \n* [gstreamer-1.0](https://gstreamer.freedesktop.org/download/)\n  ```\n  gst-launch-1.0 --gst-version\n  ```\n  \n* [Gio >=2.62](https://docs.gtk.org/gio/)\n  ```\n  gio version\n  ```\n  \n* [Python >=3.9](https://www.python.org/downloads/)\n* [Docker](https://docs.docker.com/engine/install/ubuntu/) *Only required for installation via Docker. [See here](#docker)*\n* [Docker Compose](https://docs.docker.com/compose/install/#install-compose) *Only required for installation via Docker. [See here](#docker)*\n\n**Installation** <a name = "installation"></a>\n\nFor a successful and complete installation, you can choose between the Poetry packaging and dependency management tool or just use Docker.\n\n1. If you select via [*Poetry*](https://python-poetry.org/docs/): <a name = "poetry"></a>\n\nMake sure you are on the root path of the project before running these commands.\n\n* Install poetry\n```\ncurl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -\n```\n* Install dependencies\n```\npoetry install\n```\n* Link the database to the folder where you want to monitor your media files:\n```\npoetry run flumes-discovery -i sqlite:///flumes.db -d <media content directory>  \n```\n2. In case you prefer an alternative to *poetry* for installation, you can use it via [*Docker*](https://www.docker.com/): <a name = "docker"></a>\n```\ndocker-compose -f docker-compose-dev.yml up --build\n```\n\n**Troubleshooting** <a name = "troubleshooting"></a>\n\n- gi module:\n\nIf `error ModuleNotFoundError: No module named \'gi\'"` , check your installation:\n  \n```  \nsudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0\npip3 install pycairo\npip3 install PyGObject\n```\n\n- Sometimes there could be differences between the version of python in your virtual environment and the version to install during setup. In this case, check that both versions match.\n```\nsudo apt-get install python<version>-dev\n```\n\n## Usage <a name = "usage"></a>\n**Querying the database** <a name = "querying_the_database"></a>\n\nSQLite is the database engine used to store all the information collected in the scanning process through discovery. You can see how this database is created in the `schema.py` file and implemented through its migrations.\nsqlite3 will allow you to manually enter and execute SQL queries against your SQLite database as follows:\n```\nsqlite3 flumes-dev.db \n```\nNow you can make any query to your media files indexed in the database.\n\n**Trigger rescan** <a name = "trigger_rescan"></a>\n\nYou can trigger discovery to rescan all files at run time.\nEither locally or using [*poetry*](#poetry) you can look up the PID and send the corresponding signal:\n* Select the PID where flumes-discovery is running\n```\nps aux | grep flumes-discovery\n```\n* Send the signal to rescan\n```\nkill -USR1 <PID>\n```\n\n\nAlso this feature is available to use through [*docker*](#docker):\n* Find the running container\'s ID:\n```\ndocker ps\n```\n* Check the Process ID (PID):\n```\ndocker exec -it <container ID> ps -aux\n```\n* Now, you can send various signals to trigger the rescan:\n```\ndocker exec -t -i <container ID> /bin/sh -c \'kill -USR1 <PID>\'\n```\n\n## Development <a name = "development"></a>\n\n**Required dependencies** <a name = "required_dependencies"></a>\n\nThe installation via [*poetry*](#poetry) and [*docker*](#docker) will install all the required dependencies by default but in case you do not use any of these options the installation will not be completed. To successfully guarantee your development process, check that you have the following dependencies installed:\n* python-dateutil = ^2.8.2\n* SQLAlchemy = ^1.4.26\n* alembic = ^1.7.5\n* packaging = ^21.3\n* pytest = ^5.2\n* pre-commit = ^2.15.0\n* black = ^21.9b0\n* isort = ^5.9.3\n* tox = ^3.24.4\n* yamllint = ^1.26.3\n\n**Git hook** <a name = "git_hook"></a>\n\nYou can detect any issue before commit using pre-commit hooks.\n* Install pre-commit hooks\n```\npoetry run pre-commit install\n```\n\n**New releases** <a name = "new_releases"></a>\n\nTo generate a new release you must update the version number. The following files will need to be updated: \n* init file\n* tests/test_flumes.py\n* pyproject.toml\n\nOnce it is merged, tagging must be done in order to distribute the new version correctly.\n\n**Tagging** <a name = "tagging"></a>\n\n```\ngit tag -a <version> -m "Release <version>"\n```\n```\ngit push origin --tags\n```\n\n**Database** <a name = "database"></a>\n\nYou must use alembic for database migration. First, make the necessary changes to the `schema.py` file and then proceed with the steps to successfully perform the migration.\n```\nalembic revision --autogenerate\n```\n```\nalembic upgrade head\n```\n```\nalembic stamp head\n```\n\n**Testing** <a name = "testing"></a>\n\nAll tests are located in the tests folder. The framework used is [*pytest*](https://docs.pytest.org/). \nYou can run the tests locally using the following command under the same path for example:\n```\npoetry run pytest\n```\n\n## License <a name = "license"></a>\nSee `LICENSE.LGPL` for more information.\n',
    'author': 'Jorge Zapata',
    'author_email': 'jorgeluis.zapata@gmail.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://fluendo.com',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
