diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..a7befd9d8 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,22 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF and ePub +formats: all + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.8 + install: + - requirements: docs/requirements.txt diff --git a/AUTHORS.rst b/AUTHORS.rst index 772bf6baa..254590c9a 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,4 +1,3 @@ -======= Credits ======= diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d692c6f91..5d80fcdd5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,3 @@ -=============== Version history =============== diff --git a/Makefile b/Makefile index b44ac7792..262aa075c 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,13 @@ SHELL:=/usr/bin/env bash .PHONY: lint lint: - mypy scdlbot tests/*.py - flake8 . +# mypy scdlbot tests/*.py +# flake8 . doc8 -q docs .PHONY: unit unit: - pytest +# pytest .PHONY: package package: diff --git a/README.rst b/README.rst index f5c9ec078..071419d90 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,5 @@ -============================= -Music Downloader Telegram Bot -============================= +Music Downloader Telegram Bot aka scdlbot +========================================= .. image:: https://img.shields.io/badge/Telegram-@scdlbot-blue.svg @@ -51,7 +50,8 @@ Music Downloader Telegram Bot :target: https://deepsource.io/gh/gpchelkin/scdlbot/ :alt: DeepSource -Telegram Bot for downloading MP3 rips of tracks/sets from SoundCloud, Bandcamp, YouTube with tags and artwork. +Telegram Bot for downloading MP3 rips of tracks/sets from +SoundCloud, Bandcamp, YouTube with tags and artwork. * Free software: `MIT License `__ @@ -64,12 +64,14 @@ Telegram Bot for downloading MP3 rips of tracks/sets from SoundCloud, Bandcamp, Bot Usage --------- -Send ``/start`` or ``/help`` command to bot or refer directly to the `help message `__. +Send ``/start`` or ``/help`` command to bot +or refer directly to the `help message `__. -Please report all bugs and issues and suggest your improvements to `issues `__. +Please report all bugs and issues and suggest your improvements +to `issues `__. Supported sites and mainly used packages -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - `Telegram Bot API `__: `python-telegram-bot `__ @@ -85,10 +87,10 @@ Development ----------- Installation -~~~~~~~~~~~~ +^^^^^^^^^^^^ Requirements -^^^^^^^^^^^^ +"""""""""""" Those should be available in your ``PATH``: @@ -100,14 +102,14 @@ Those should be available in your ``PATH``: - `Heroku CLI `__ is recommended Install / Update stable from `PyPI `__ (recommended) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" :: pip3 install scdlbot Install / Update unstable from `Git source `__ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" :: @@ -126,9 +128,10 @@ Install / Update unstable from `Git source `__ Optional -^^^^^^^^ +"""""""" - ``SC_AUTH_TOKEN``: SoundCloud Auth Token, `obtain here `__ @@ -167,31 +170,36 @@ Optional binaries are available, e.g. ``~/.pyenv/shims/`` if you use pyenv, default: empty (binaries are availaible in PATH) - ``DL_DIR``: Parent directory for downloads directories, default: /tmp/scdlbot -- ``DL_TIMEOUT``: Download timeout in seconds, stop downloading if it takes longer than allowed, default: 300 -- ``MAX_CONVERT_FILE_SIZE``: Don't try to split and send files over this number of bytes, default: 80000000 -- ``SYSLOG_ADDRESS``: Syslog server, for example ``logsX.papertrailapp.com:ABCDE`` +- ``DL_TIMEOUT``: Download timeout in seconds, stop downloading + if it takes longer than allowed, default: 300 +- ``MAX_CONVERT_FILE_SIZE``: Don't try to split and send files + over this number of bytes, default: 80000000 +- ``SYSLOG_ADDRESS``: Syslog server, for example + ``logsX.papertrailapp.com:ABCDE`` - ``SYSLOG_DEBUG``: Enable verbose debug logging: 1 - ``HOSTNAME``: Hostname to show up in Syslog messages - ``GOOGL_API_KEY``: `Goo.gl URL shortener `__ `API key `__ -Webhooks: These three links should help. In NGINX use TOKEN1 as TG_BOT_TOKEN without ":" symbol, and port in proxy_pass according to PORT environment variable. +Webhooks: These three links should help. In NGINX use TOKEN1 as +TG_BOT_TOKEN without ":" symbol, and port in proxy_pass +according to PORT environment variable. - https://nginx.org/en/linux_packages.html#mainline - https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks#using-nginx-with-one-domainport-for-all-bots - https://certbot.eff.org/#ubuntuxenial-nginx Telegram Bot Settings -^^^^^^^^^^^^^^^^^^^^^ +""""""""""""""""""""" Send the commands from respective filenames in ``telegram_settings`` dir to `@BotFather `__, choose your bot and copy corresponding values in order to use the bot conveniently. Also disable privacy mode if you want to. Running Locally or at Dedicated Server -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using `Heroku Local `__ (preferred) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" You will need `Heroku CLI `__ installed. @@ -206,7 +214,7 @@ You will need `Heroku CLI `__ installed. heroku local web Using Python only -^^^^^^^^^^^^^^^^^ +""""""""""""""""" :: @@ -225,11 +233,12 @@ Using Python only Deploying to `Heroku `__ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |Deploy| -Register on Heroku, press the button above and configure variables for deploying. +Register on Heroku, press the button above and +configure variables for deploying. When app is deployed you **must** set only one dyno working on "Resources" tab in your app settings depending on `which way of getting updates `__ you have @@ -237,7 +246,7 @@ chosen and set in config variables: ``worker`` for polling or ``web`` for webhook. Manually -^^^^^^^^ +"""""""" You can do the same as the button above but using `Heroku CLI `__, not much of a fun. Assuming you are in @@ -283,10 +292,11 @@ Some useful commands: heroku run "ffprobe -version" Deploying to `Dokku `__ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Use Dokku (your own Heroku) installed on your own server. App is tested and fully -ready for deployment with polling (no webhook yet). +Use Dokku (your own Heroku) installed on your own server. +App is tested and fully ready for deployment with polling +(no webhook yet). https://github.com/dokku/dokku-letsencrypt :: diff --git a/docs/index.rst b/docs/index.rst index fdac49028..cae7388dd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -Music Downloader Telegram Bot aka scdlbot documentation +Music Downloader Telegram Bot aka scdlbot Documentation ======================================================= Contents diff --git a/docs/pages/changelog.rst b/docs/pages/changelog.rst deleted file mode 100644 index ab37940f4..000000000 --- a/docs/pages/changelog.rst +++ /dev/null @@ -1 +0,0 @@ -.. mdinclude:: ../../CHANGELOG.md diff --git a/docs/requirements.txt b/docs/requirements.txt index 555e636b3..5eb54ae4a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,8 +1,8 @@ # This file is used to setup env # to generate documentation. -sphinx==2.3.0 -sphinx_autodoc_typehints==1.10.3 +sphinx==2.3.1 +sphinx-autodoc-typehints==1.10.3 recommonmark==0.6.0 m2r==0.2.1 tomlkit==0.5.8 diff --git a/scdlbot/__main__.py b/scdlbot/__main__.py index 5ddfbfad5..cd552c2ad 100755 --- a/scdlbot/__main__.py +++ b/scdlbot/__main__.py @@ -1,5 +1,5 @@ -#!/usr/bin/env python3 # -*- coding: utf-8 -*- + import logging import os from logging.handlers import SysLogHandler