From 6a7cf23e9de65a7acc7eec238550aa676b5cb2e4 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 24 Apr 2024 10:58:48 +0200 Subject: [PATCH] initial commit --- .vscode/settings.json | 5 ++++ development/playground.py | 6 +++++ pyproject.toml | 40 ++++++++++++++++++++++++++++++++ python_sponsorblock/__about__.py | 1 + python_sponsorblock/__init__.py | 12 ++++++++++ 5 files changed, 64 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 development/playground.py create mode 100644 pyproject.toml create mode 100644 python_sponsorblock/__about__.py create mode 100644 python_sponsorblock/__init__.py diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..117871e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "sponsorblock" + ] +} \ No newline at end of file diff --git a/development/playground.py b/development/playground.py new file mode 100644 index 0000000..bab8e3b --- /dev/null +++ b/development/playground.py @@ -0,0 +1,6 @@ +from python_sponsorblock import SponsorBlock + + +if __name__ == "__main__": + sb = SponsorBlock() + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..366be37 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +requires = ["hatchling", "hatch-requirements-txt", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.build] +directory = "dist" + +[tool.hatch.build.targets.sdist] +include = ["python_sponsorblock/*.py", "python_sponsorblock/**/*.py" ] + +[tool.hatch.build.targets.wheel] +packages = ["python_sponsorblock"] + +[project.scripts] +music-kraken = "python_sponsorblock.__main__:cli" + +[tool.hatch.version] +path = "python_sponsorblock/__about__.py" + +[project] +name = "python-sponsorblock" +description = "This is a wrapper for the sponsorblock api, enabling you to get the timestamps of sponsor segments from youtube videos." +authors = [{ name = "Hazel", email = "hazel_is_cute@proton.me" }] +license = "MIT" +readme = "README.md" +repository = "https://gitea.elara.ws/music-kraken/python-sponsorblock" +requires-python = ">=3.10" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", +] +dependencies = [ + "requests~=2.31.0", +] +dynamic = [ + "version" +] diff --git a/python_sponsorblock/__about__.py b/python_sponsorblock/__about__.py new file mode 100644 index 0000000..c57bfd5 --- /dev/null +++ b/python_sponsorblock/__about__.py @@ -0,0 +1 @@ +__version__ = '0.0.0' diff --git a/python_sponsorblock/__init__.py b/python_sponsorblock/__init__.py new file mode 100644 index 0000000..2b5520d --- /dev/null +++ b/python_sponsorblock/__init__.py @@ -0,0 +1,12 @@ +import requests + +class SponsorBlockError(Exception): + pass + + +class SponsorBlock: + def __init__(self, session: requests.Session = None, base_url: str = "https://sponsor.ajay.app"): + self.base_url: str = base_url + self.session: requests.Session = session or requests.Session() + +