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

packages = \
['namer', 'namer.web']

package_data = \
{'': ['*'],
 'namer.web': ['public/*',
               'public/assets/*',
               'public/assets/fonts/*',
               'templates/components/*',
               'templates/pages/*',
               'templates/partials/*',
               'templates/render/*']}

install_requires = \
['Flask-Compress>=1.12,<2.0',
 'Pillow>=9.1.1,<10.0.0',
 'Unidecode>=1.3.4,<2.0.0',
 'flask>=2.1.2,<3.0.0',
 'jinja2>=3.1.2,<4.0.0',
 'loguru>=0.6.0,<0.7.0',
 'lxml>=4.8.0,<5.0.0',
 'mutagen>=1.45.1,<2.0.0',
 'pathvalidate>=2.5.0,<3.0.0',
 'rapidfuzz>=2.0.5,<3.0.0',
 'requests-cache>=0.9.4,<0.10.0',
 'requests>=2.27.1,<3.0.0',
 'schedule>=1.1.0,<2.0.0',
 'waitress>=2.1.1,<3.0.0',
 'watchdog>=2.1.6,<3.0.0']

setup_kwargs = {
    'name': 'namer',
    'version': '1.5.10',
    'description': 'A namer of video files based on metadata from the porndb.',
    'long_description': '.. |logo| image:: ./logo/namer.png\n  :width: 80\n  :class: display: inline flow; align: left\n\n##############\n|logo| Namer\n##############\n\n.. image:: https://github.com/ThePornDatabase/namer/actions/workflows/ci.yml/badge.svg?\n  :target: https://github.com/ThePornDatabase/namer/actions/workflows/ci.yml/\n.. image:: https://codecov.io/gh/ThePornDatabase/namer/branch/main/graph/badge.svg?token=4MQEN2NUKZ\n  :target: https://codecov.io/gh/ThePornDatabase/namer\n.. image:: https://badge.fury.io/py/namer.svg?\n  :target: https://badge.fury.io/py/namer\n.. image:: https://img.shields.io/pypi/dm/namer?logo=pypi&logoColor=fff\n  :target: https://pypi.org/project/namer\n.. image:: https://static.pepy.tech/personalized-badge/namer?period=total&units=international_system&left_color=grey&right_color=yellowgreen&left_text=Downloads\n  :target: https://pepy.tech/project/namer  \n.. image:: https://static.pepy.tech/personalized-badge/namer?period=month&units=international_system&left_color=grey&right_color=yellowgreen&left_text=Downloads/Month\n  :target: https://pepy.tech/project/namer\n\nNamer is a powerful command line tool for renaming and tagging mp4 video files in a way that helps plex/jellyfin/emby and related plugins extract that data or lookup data with the PornDB_\'s plugins for plex or jellyfin/emby.\nNamer is easily installed as a python pip and can:\n\n* can be used to name and embed tags in individual files with metadata from porndb:\n\n  ``python -m namer rename -f /path/to/file/Site.[YY]YY.MM.DD.MessOfText.XXX.2160.mp4 [-v]`` \n\n* can be used to name and tag files with metadata from a jellyfin/emby/kodi .nfo file (should be named the same as the file except for extension).\n\n  ``python -m namer rename -f /path/to/file/Site.[YY]YY.MM.DD.MessOfText.XXX.2160.mp4 -i [-v]``\n\n* can be used to rename a tag a file based on the directory name, so if you have a file like ``/Site.[YY]YY.MM.DD.MessOfText.XXX.2160/abc.mp4`` \n\n  ``python -m namer rename -d /path/to/dir/Site.[YY]YY.MM.DD.MessOfText.XXX.2160/``\n\n* can be used to rename a tag a whole mess of dirs and files in a directory (using -m, meaning "many").\n\n  ``python -m namer rename -m -d /path/to/dir/``\n  \n* can be used to just suggest a possible name.  The file doesn\'t need to exist but should have an extension.\n\n  ``python -m namer suggest -f Site.[YY]YY.MM.DD.MessOfText.XXX.2160.mp4``\n\n* can be run watching a directory for new files to name, tag and move to an output location, possible setting file permissions, writing .nfo files with downloaded images, attempting to grab trailers, and retrying failed files nightly.\n\n  ``python -m namer watchdog``  \n\nFor all of the above it\'s recommended to have a config file in your home directory (copied from namer.cfg.sample in this git repo)\n\nAlso provided is a docker file if you prefer.\n\nIt is possible to ignore and not need to parse dates for studios added to a list in the configuration file.  This is mostly used for studios that do not list dates on videos.\n\nWhy should I use this?\n----------------------\n\n1.  You have partially well structured file names (say from an rss feed, etc) and you never want to have to manually match files in plex/jellyfin/emby with the PornDB_\'s plugin.\n2.  You don\'t want your recent videos to be added to your library until they are matchable in the PornDB_.\n3.  You want to store the metadata about a file in mp4 files, in a way that can be read by Apple TV app, including information like: Studio, date created, name, performers, original url, proper HD tags, ratings, and movie poster.   All of this data is readable by Plex, and most by Jellyfin/Emby in case you want to standard Apple video players or your library\'s metadata storage is ever damaged.\n\nHow successful at matching videos is this tool?\n------------------------------------------------\n\nFor data pulled from the internet with rss feeds (which are often in the file format listed below) .... perfect.  The author and others have only experienced one mismatch, and that type of failure can never occur again.\n\nIf running in a background watchdog mode, files that were failed to match are retried every 24 hours, letting the PornDB_ scrapers catch up with any metadata they may be missing.\n\nOptionally, a log file can be enabled to show the original file name parts, what options were evaluated, and which match was used to name the file, it will be written next to your video file with the same name as the file (with a _namer.log) suffix rather than an mp4/mkv/avi/mov/flv extension.   This is very useful for sanity checking matches, and if ever a mismatch does occur the original file name is available in the log.\n\n\nFor the curious, how is a match made?\n------------------------------------------------\n\nIt assumes that file names exist as in a format like ```sitename-[YY]YY-MM-DD-Scene.and.or.performer.name.mp4.```.  A powerful regex tries to determine the various parts of a file\'s name.   Note that the separating dashes and dots above are interchangeable, and spaces may also be used as separators (or any number of any combo of the three.)   This regex is overridable, but you really need to know what you\'re doing and if you don\'t have all the match groups for the regex, the match from the the PornDB_ will likely not be any where near as robust as it is with a site, a date, and a scene/perform name section.\nYou\'ll have to read the code to figure out how to set this.   You really shouldn\'t do it.\n\nWhen determining a possible queried match from the PornDB_:\n\nSitename my not need be the full name of the site, as long as a the looked up sitename starts with file\'s sitename it could be a valid match.\n\nThe date may have a four digit or two digit year.  If two digit, "20" is assumed as the default century, not "19".  A potential match must be with one day plus/minus the file\'s date to be considered a match.\n\nFinally the looked up scene name and all performers first and last names are combined in to what is called a powerset (every combo of including or not including each artist and/or scene name), and that is compared against the file\'s \'Scene.and.or.performer.name\' section with a tool called rapidfuzz.   A name must be 90% similar to a member of the powerset to be considered a match, though all potential matches are evaluated and sorted before selecting the best match.   Information about all potential matches are stored in the local log file if it is enabled.\n\nI\'m sold how do I install it!\n--------------------------------------------------\n\nYou have two choices.   Do you use docker?  Pull the docker image, here\'s docker-compose snippet to help you out.\n\n\n.. code-block:: yaml\n\n  version: "3"\n  services:  \n    namer:\n      container_name: namer\n      image: ghcr.io/theporndatabase/namer:latest\n      environment:\n        - PUID=1001\n        - PGID=1000\n        - TZ=America/Los_Angeles\n        - NAMER_CONFIG=/config/namer.cfg\n      volumes:\n        - /apps/namer/:/config <- this will store the namer.cfg file.\n        - /media:/data <- this will have the four folders namer needs to work, referenced in the config file.\n      restart: always\n\nCopy namer.cfg to your config location (a path mapped to /config/namer.cfg above), and set values for your setup.   \nThe config is well commented and you should only need to add a token for the porndb and change file locations.\n\nRunning a service will occur automatically once you call ``docker-compose up``.  Now check out the configuration section below.\n\n\nPip/Python usage\n--------------------\n\nWhat if you don\'t want to use docker and/or containers?  Do you have python 3 and pip (sometimes pip3) and the command line tool ``ffmpeg`` installed locally?  If so,  ``pip install namer`` gets the job done.  If\nyou don\'t have python (3), pip and ``ffmpeg`` installed Homebrew_ can help you on Mac, and Chocolatey_ can help you on windows\n\n\n.. code-block:: sh\n\n  # install namer\n  pip3 install namer\n\n  #optionallly, set your configuration location, the below is the default:\n  export NAMER_CONFIG=${HOME}/.namer.cfg  \n\n  # Run the watchdog service:\n  python3 -m namer watchdog\n\n  # Or manually rename a file, dir, or all sub-dirs/sub-files of a dir:\n  # This calls the help method so that you can see the options.\n  python3 -m namer rename -h\n\n\nConfiguration:\n---------------------------\n\nThere is a well documented template of namer.cfg in this git repo, which is broken up in to three sections.\nOne section is related to command line renaming, the `namer section`_, one related to tagging mp4s `metadata section`_, \nand finally one related to the watchdog process `watchdog section`_.\nPlease note that the `namer section`_ section and the `watchdog section`_ \nsection both have a field to describe the new name of a file based on looked up metadata from the PornDB_.   \nThey differ because when run from the command line namer will keep the file "in place".  \nIf namer is passed a dir on the command line as input it can operate in one of two modes,\nthe default mode is to look for the largest mp4 file, or other configured movie file extension if no mp4 exists,\nand rename and move that file to the root of the folder (if it\'s in a sub-folder).\nIn this case, by default the assumption is the name of the folder should be parsed to look for information to\nsearch the PornDB_ for matching rather than the file name.   Meaning,\nif you pass a file to namer on the commandline it will be renamed but stay in the same directory.\n\n\nTypical Watchdog Behavior:\n----------------------------\n\nThe watchdog process will watch a single folder, configured with watch_dir_ in the ``namer.cfg`` file.   Any new files and directories that appear in the watch_dir_\nwill be processed once an mp4/mkv/avi/mov/flv file has been fully copied in to it.  \n\nThe first step in processing is to more the newly appearing directory or file in to the work_dir_.\n\nOnce moved the processing is highly dependant on the namer.cfg file, but in general, the name of video file or the directory file (configured with ``prefer_dir_name_if_available`` flag)\nis parsed and matched with a scene from the PornDB_.   See `For the curious, how is a match made?`_.  If a match cannot be made the general assumption is that the PornDB_ doesn\'t have metadata for that file yet.\nThe file is move to the failed dir fail_dir_ to be retried once a day at a time configured with retry_time_,\nwhich by default will be a random selected minute in the 3am hour of your timezone.   If enabled_tagging_ flag is set to true then\nthe metadata (including cover art if enable_poster_ is set) will be embedded in the mp4 file.  Please read the comments in the namer.cfg to find out about genres, tags, performers, etc.\n\nFinally, the file is moved to a location defined by dest_dir_ and new_relative_path_name_.\n\n\nDevelopment\n------------------------------\n\n.. code-block:: sh\n\n  # Building:\n  poetry build\n\n  # Linting:\n  poetry run flakeheaven lint\n\n  # Testing:\n  poetry run pytest\n\n  # Code Coverage:\n  poetry run pytest --cov\n\n  # Formatting:\n  poetry run autopep8 --in-place namer/*.py test/*.py\n\n  # Html Coverage report:\n  poetry run coverage html\n\n  # Publishing:\n  # First make sure you have set gotten a token from pypi and set it on your machine.\n  poetry config pypi-token.pypi <token>\n\n  # Perhaps update the version number?\n\n  # Publishing a release to pypi.org:\n  poetry publish\n\n  # build docker file with:\n  ./docker_build.sh\n\nPull Requests Are Welcome!\n---------------------------\n\nJust be sure to pay attention to the tests and any failing pylint results.   If you want to vet a pr will be accepted before building code, file an new feature request issue, and 4c0d3r will comment on it and set you up for success.   Tests are must.\n\n.. _PornDB: http://metadataapi.net/\n.. _namer section: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L1\n.. _metadata section: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L59\n.. _watchdog section: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L89\n.. _watch_dir: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L100\n.. _work_dir: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L104\n.. _fail_dir: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L109\n.. _dest_dir: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L112\n.. _retry_time: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L115\n.. _new_relative_path_name: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L97\n.. _enabled_tagging: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L67\n.. _enable_poster: https://github.com/ThePornDatabase/namer/blob/main/namer.cfg.sample#L72\n.. _Homebrew: https://docs.brew.sh/Installation\n.. _Chocolatey: https://chocolatey.org/install\n',
    'author': '4c0d3r',
    'author_email': '4c0d3r@protonmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': None,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
