diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b055c3c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish Package + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + pip install --upgrade pip + pip install poetry + - name: Build + run: poetry build + - name: Publish (production) + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/publish_test.yml b/.github/workflows/publish_test.yml new file mode 100644 index 0000000..c4804f5 --- /dev/null +++ b/.github/workflows/publish_test.yml @@ -0,0 +1,27 @@ +name: Publish Package + +on: + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + pip install --upgrade pip + pip install poetry + - name: Build + run: poetry build + - name: Publish (test) + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ diff --git a/README.md b/README.md index 7372e75..96ae0e0 100644 --- a/README.md +++ b/README.md @@ -2,28 +2,29 @@ A python script to download twitter space. -## Downloads +## Install -[Linux](https://github.com/Ryu1845/twspace-dl/releases/latest/download/twspace_dl.bin) - -[Windows](https://github.com/Ryu1845/twspace-dl/releases/latest/download/twspace_dl.exe) - -## Usage +### From source +```bash +git clone --depth 1 https://github.com/Ryu1845/twspace-dl +cd twspace-dl +pip install . +``` -### Linux +### From PyPI ```bash -./twspace_dl.bin -i space_url +pip install twspace-dl ``` -### Windows -```batch -.\twspace_dl.exe -i space_url +## Usage +```bash +twspace_dl -i space_url ``` ## Features Here's the output of the help option ``` -usage: main.py [-h] [-t THREADS] [-v] [-s] [-k] [-i SPACE_URL] [-d DYN_URL] [-f URL] [-o FORMAT_STR] [-m] [-p] [-u] +usage: twspace_dl [-h] [-t THREADS] [-v] [-s] [-k] [-i SPACE_URL] [-d DYN_URL] [-f URL] [-o FORMAT_STR] [-m] [-p] [-u] Script designed to help download twitter spaces diff --git a/pyproject.toml b/pyproject.toml index f3377e5..ee55b82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,10 @@ [tool.poetry] name = "twspace-dl" version = "1.0.0" -description = "" +description = "Twitter Space archive helper script" authors = ["Ryu1845 "] +readme = "README.md" +license = "" [tool.poetry.dependencies] python = "^3.8" @@ -11,6 +13,10 @@ requests = "^2.26.0" [tool.poetry.dev-dependencies] pytest = "^5.2" +[tool.poetry.scripts] +twspace_dl = "twspace_dl.__main__:main" + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + diff --git a/twspace_dl/__main__.py b/twspace_dl/__main__.py index deafad4..dae6082 100644 --- a/twspace_dl/__main__.py +++ b/twspace_dl/__main__.py @@ -350,7 +350,7 @@ def get_args(): return args -if __name__ == "__main__": +def main(): args = get_args() if not args.input_url and not args.from_master_url: print("Either space url or master url should be provided") @@ -377,3 +377,7 @@ def get_args(): finally: if not args.keep_files and os.path.exists("tmp"): shutil.rmtree("tmp") + + +if __name__ == "__main__": + main()