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

packages = \
['homepage']

package_data = \
{'': ['*'], 'homepage': ['static/*', 'templates/*']}

install_requires = \
['Flask', 'easyparse', 'gevent', 'youtube_dl']

entry_points = \
{'console_scripts': ['homepage = homepage:main']}

setup_kwargs = {
    'name': 'homepage',
    'version': '0.3.7',
    'description': 'A simple flask webapp to download the audio track from almost any internet video.',
    'long_description': '# HomePage\n\nHomePage is a trivial flask web app that allows downloading the audio track from almost any internet video.\nIt is intended to be deployed inside a private network for personal use, so that hosts within the network can access\nand download the tracks they want.\n\nHomePage is very basic, but it has a Material Design front-end which is simple and easy to use.\nHomePage uses `youtube_dl` to download the videos, so quite a few sites are supported. Playlists are also supported.\n\n![HomePage](homepage/static/HomePage.png)\n\n## Setup & Prerequsites\n\n- `python 3.6` or above\n- The `pip` module for the above python version\n- `sudo` access if you wish to use port `80`\n- `pyenv` installed (optional)\n- `poetry` installed (optional)\n\nThe basic installation is very simple.\n\n```bash\n$ python3 -m pip install --user homepage\n\n# Normal desktop\n$ homepage -i\n\n# TTY only server\n$ homepage -ic\n```\n\nThen, you can deploy with:\n\n```bash\n$ homepage -df\n```\n\nAlternatively, if your system is running an older version of python or you wish to run this project inside\na virtual environment, you can do that too. In fact, this is the __recommended__ method of installing this project.\n\nFirst, go ahead and install [pyenv](https://github.com/pyenv/pyenv#basic-github-checkout). Then install [poetry](https://github.com/sdispater/poetry).\nOnce you\'ve installed those, we just to install a few more things.\n\n```bash\n$ git clone https://github.com/Sh3llcod3/HomePage.git\n$ cd HomePage/\n$ pyenv install 3.7.4\n$ pyenv local 3.7.4\n$ poetry self:update --preview || poetry self update --preview\n$ poetry update\n$ poetry install # Add --no-dev if you don\'t want to tweak.\n$ poetry shell\n$ homepage -ip\n$ homepage -df\n```\n\nAfter installing `pyenv`, the lines you add to your `~/.bashrc` may need to be different, please see the [FAQ](#faq--troubleshooting).\n\n## Usage\n\nOnce deployed, if you\'re using this on the device which is hosting it, fire up your\nfavourite web browser and head to `http://0.0.0.0:5000/`. If you\'re on another device,\nsimply head to the IP address that it prints out when you run it.\n\nIf you have `sudo` access, please use the `-f` switch. If you don\'t, other hosts can\nstill use this, but they will need to explicitly specify the port, e.g. `http://192.168.0.10:5000`.\n\nFrom there, you just need to select your options and paste in a link to the video or playlist\nthat you want to download the tracks from. Obviously, you can download from `YouTube`, but thanks\nto the power of the `youtube_dl` library, many other sites will also work, e.g. `Vimeo`, or `Reddit`.\nYou can find the full list [here](https://bit.ly/2XKgkuV).\n\n## FAQ & Troubleshooting\n\n#### I\'m having trouble with the env\n\nYou may have inserted the wrong lines in your `~/.bashrc`.\nThe initialization lines shown on the pyenv repo don\'t work\nwell with poetry. Instead, add these lines to the end of the file\nand remove any previous lines you may have added before\n(taking care to ensure you don\'t remove anything else).\n\n```bash\n# Pyenv installation\n\nif [[ -z "$VIRTUAL_ENV" ]]; then\n    export PATH="$HOME/.pyenv/bin:$PATH"\n    eval "$(pyenv init -)"\nfi\n```\n\n#### Can I change the background?\n\nYou absolutely can. To change the background, change out `homepage/static/Background.jpg` with any image you like,\nbut it has to be called `Background.jpg` and in the `JPEG` format. I will make this process easier in the future.\n\n#### Pyenv fails to install 3.7.4\n\nYou may have forgotten to install some crucial `pyenv` dependencies.\nIf you\'re using other package managers, check [here](https://github.com/pyenv/pyenv/wiki#suggested-build-environment)\nfor their wiki page. If you\'re using `apt`, you can simply run:\n\n```bash\n$ sudo apt update\n$ sudo apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev\n```\n\nThen retry the `pyenv` installation.\n\n#### Why does HomePage exist?\n\nThat is a really good question.\nI wanted a simple web app where I could download music from various videos on any\ndevice, without having access to a command line version of `youtube_dl` or resorting\nto using shady sites and apps.\n\nThe code is bad at best, but it is functional and you have the freedom of choice.\nWhether you want to use it or not is up to you, but I assumed that people prefer\nconvenience, so I should probably upload this where more people may be able to take\nadvantage of this.\n\n#### Why is it not working?\n\nYour version of `youtube_dl` may be out of date. Having a version of `youtube_dl`\nthat is even one version old can mean your tracks may fail to download. Fortunately,\nthe library is updated frequently and you can pull in the updates very easily.\n\nIf you\'re using it from PyPi, then:\n```shell\n$ python3 -m pip install --upgrade youtube_dl gevent Flask --user\n```\n\nIf you\'re using it from the `env`, then simply `cd` to the directory you installed it\nand run:\n```shell\n$ poetry update\n$ poetry shell\n```\n\n> You may want to write some sort of `cron` job to do this every few days or so.\n\n#### Does HomePage scale?\n\nNo. It was never intended to scale in the first place. Neither is it secure in any way.\nTherefore, I should stress that you should __NOT__ deploy this to anywhere except your\nprivate/internal network.\n\n#### Does it have Windows support?\n\nNo. However I am planning to release compiled executables for both Windows and Linux so\nstay tuned for that, if you\'re interested.\n\n#### Why does it take a long time?\n\nTime is of the essence. I understand that if a specific computational task does not complete\nas quickly as someone anticipates, it can leave the user feeling disappointed.\n\nHowever, the length of time it takes for a specific video to be downloaded heavily depends\non several factors, such as the length, quantity and chosen quality of the download.\nOn top of this, you have to consider that for each video you download, `youtube_dl` has\nto first download the video, then it has to be encoded in your preferred format using\n`ffmpeg`. That can take a while, especially on older systems.\n\nI am always looking to optimise this so it downloads and converts the videos faster, but\nif you have any tips, please create an issue and I\'ll check it out as soon as possible.\n\n## To-do\n\n- [ ] Add an authentication page.\n- [ ] Make site restore state after a download.\n- [ ] Save user preferences using cookies.\n- [ ] Display past tracks only for that host.\n- [ ] Add a separate page for management.\n- [ ] Create a system to auto-update `youtube_dl`\n- [ ] Make it work on windows and generate executables\n',
    'author': 'Sh3llcod3',
    'author_email': '28938427+Sh3llcod3@users.noreply.github.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/Sh3llcod3/HomePage',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
