From 31deeb7f593a2716b6560a80c6dc6a2662ede16b Mon Sep 17 00:00:00 2001 From: eggplants Date: Sat, 6 Nov 2021 23:13:40 +0900 Subject: [PATCH 1/6] add: console_script --- pyproject.toml | 4 ++++ twspace_dl/__main__.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f3377e5..b5cc790 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,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() From 0e05f9cb278808a4725e25eed5223c00576ef687 Mon Sep 17 00:00:00 2001 From: eggplants Date: Sat, 6 Nov 2021 23:16:40 +0900 Subject: [PATCH 2/6] fix: document --- README.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7372e75..83af093 100644 --- a/README.md +++ b/README.md @@ -2,28 +2,24 @@ 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 - -### Linux +### From source ```bash -./twspace_dl.bin -i space_url +git clone --depth 1 https://github.com/Ryu1845/twspace-dl +cd twspace-dl +pip install . ``` -### Windows -```batch -.\twspace_dl.exe -i space_url +### From PyPI +```bash +pip install twspace-dl ``` ## 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 From f22cedeb10cb34da9f6ec8cd5d71a203aa066d7d Mon Sep 17 00:00:00 2001 From: eggplants Date: Sat, 6 Nov 2021 23:18:30 +0900 Subject: [PATCH 3/6] fix: document --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 83af093..96ae0e0 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ pip install . pip install twspace-dl ``` +## Usage +```bash +twspace_dl -i space_url +``` + ## Features Here's the output of the help option ``` From f84d7516d90fbfb6c66a1dc4a1a2139fa2ccb403 Mon Sep 17 00:00:00 2001 From: eggplants Date: Sat, 6 Nov 2021 23:24:18 +0900 Subject: [PATCH 4/6] add: extra info to toml --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b5cc790..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" From dbd4194f6f26109d6e13943f090dfd2ed87f7781 Mon Sep 17 00:00:00 2001 From: eggplants Date: Sat, 6 Nov 2021 23:39:44 +0900 Subject: [PATCH 5/6] add: publish ci --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ce44956 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +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 (test) + # uses: pypa/gh-action-pypi-publish@master + # with: + # user: __token__ + # password: ${{ secrets.TEST_PYPI_API_TOKEN }} + # repository_url: https://test.pypi.org/legacy/ + - name: Publish (production) + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From 304e885bf9b1fbd7e6713a39af734740e24960f6 Mon Sep 17 00:00:00 2001 From: eggplants Date: Sat, 6 Nov 2021 23:59:13 +0900 Subject: [PATCH 6/6] add: test workflow triggered by manual --- .github/workflows/publish.yml | 6 ------ .github/workflows/publish_test.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/publish_test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ce44956..b055c3c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,12 +21,6 @@ jobs: pip install poetry - name: Build run: poetry build - # - name: Publish (test) - # uses: pypa/gh-action-pypi-publish@master - # with: - # user: __token__ - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ - name: Publish (production) uses: pypa/gh-action-pypi-publish@master with: 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/