Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torrent hook #221

Merged
merged 23 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
14c4389
Scaffold for torrent_hook
shaldengeki Jul 7, 2024
44dd8e1
Pause torrent
shaldengeki Jul 7, 2024
58e671e
Run gazelle
shaldengeki Jul 7, 2024
692b263
Restructure args a little
shaldengeki Jul 7, 2024
0cbcc56
Mark as required
shaldengeki Jul 7, 2024
09c1e00
Set up logging
shaldengeki Jul 7, 2024
bb21941
Add script
shaldengeki Jul 7, 2024
b075627
Catch 404 when pausing
shaldengeki Jul 7, 2024
68380c6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 7, 2024
1775226
Remove plugin
shaldengeki Jul 7, 2024
bcaeb3a
Merge remote-tracking branch 'refs/remotes/origin/torrent-hook' into …
shaldengeki Jul 7, 2024
953bf50
Ignore typing errors in py_proto/test
shaldengeki Jul 7, 2024
589dcfb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 7, 2024
27acc9c
Fixup remaining errors
shaldengeki Jul 7, 2024
5453c68
Merge remote-tracking branch 'refs/remotes/origin/torrent-hook' into …
shaldengeki Jul 7, 2024
285342c
Fix non-required value
shaldengeki Jul 7, 2024
973d73a
Quote args
shaldengeki Jul 7, 2024
3bbcf35
Set type of pause
shaldengeki Jul 7, 2024
f9e1eb2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 7, 2024
3abd051
Type and notify
shaldengeki Jul 7, 2024
35123bc
Merge remote-tracking branch 'refs/remotes/origin/torrent-hook' into …
shaldengeki Jul 7, 2024
b3b39d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 7, 2024
43e3463
Fixup tag parsing
shaldengeki Jul 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ gazelle_python_manifest(
)

# gazelle:prefix github.com/shaldengeki/monorepo
# gazelle:resolve py python.runfiles @rules_python//python/runfiles

gazelle_binary(
name = "gazelle",
Expand Down
16 changes: 15 additions & 1 deletion gazelle_python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,20 @@ manifest:
pylint.utils.pragma_parser: pylint
pylint.utils.utils: pylint
pytest: pytest
qbittorrentapi: qbittorrent_api
qbittorrentapi.app: qbittorrent_api
qbittorrentapi.auth: qbittorrent_api
qbittorrentapi.client: qbittorrent_api
qbittorrentapi.definitions: qbittorrent_api
qbittorrentapi.exceptions: qbittorrent_api
qbittorrentapi.log: qbittorrent_api
qbittorrentapi.request: qbittorrent_api
qbittorrentapi.rss: qbittorrent_api
qbittorrentapi.search: qbittorrent_api
qbittorrentapi.sync: qbittorrent_api
qbittorrentapi.torrentcreator: qbittorrent_api
qbittorrentapi.torrents: qbittorrent_api
qbittorrentapi.transfer: qbittorrent_api
requests: requests
requests.adapters: requests
requests.api: requests
Expand Down Expand Up @@ -1952,4 +1966,4 @@ manifest:
zipp.glob: zipp
pip_repository:
name: py_deps
integrity: 16526764fd066787fd0d786c32d5660bbec64890c5fab67edf761c75c301fd4c
integrity: 67c4059086b8e8369d0be155e56b353e052f80e80da22e3ad1f879ad13b903c5
39 changes: 0 additions & 39 deletions mc_manager/api/scripts/import_data.py

This file was deleted.

2 changes: 1 addition & 1 deletion mc_manager/worker/tests/worker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def mock_post(*args, **kwargs):

monkeypatch.setattr(requests, "post", mock_post)

expected = []
expected: list[dict] = []
actual = fetch_expected_servers("fake-host", 0)
assert actual == expected

Expand Down
16 changes: 16 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[mypy]
python_version = 3.11
check_untyped_defs = True
exclude = (?x)(
^bazel-out/
|^bazel-bin/
|^bazel-monorepo/
|^bazel-testlogs/
)

# We need to ignore flask_migrate's imports;
# it has type stubs available, but they depend on
# a set of SQLAlchemy typestubs that are written for <2.x,
# which introduces spurious type errors when we install them.
[mypy-flask_migrate.*]
ignore_missing_imports = True
2 changes: 2 additions & 0 deletions py_proto/test/proto_bool_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_bool import ProtoBool
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_comment_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_comment import ProtoMultiLineComment, ProtoSingleLineComment
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_constant_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_enum_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_extend_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_extensions_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_extensions import ProtoExtensions
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_float_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_float import ProtoFloat, ProtoFloatSign
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_identifier_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_import_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_int_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_int import ProtoInt, ProtoIntSign
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_map_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_constant import ProtoConstant
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_message_field_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_identifier import (
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_message_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_oneof_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_option_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_package_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_range_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_range import ProtoRange
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_reserved_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_service_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_string_literal_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_string_literal import ProtoStringLiteral
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/proto_syntax_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest

from py_proto.proto_string_literal import ProtoStringLiteral
Expand Down
2 changes: 2 additions & 0 deletions py_proto/test/util/parser_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# type: ignore

import unittest
from textwrap import dedent

Expand Down
7 changes: 7 additions & 0 deletions requirements.lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ packaging==24.0 \
# via
# black
# pytest
# qbittorrent-api
pathspec==0.12.1 \
--hash=sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 \
--hash=sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712
Expand Down Expand Up @@ -603,12 +604,17 @@ pyyaml==6.0.1 \
# via
# -r requirements.txt
# pre-commit
qbittorrent-api==2024.5.63 \
--hash=sha256:748b34c7074ba9c1e1bdfcc97b3e7acf9a553fd3b8ffb5fe89ea51b3cfebb375 \
--hash=sha256:cd3012f042fb94e9d521c406b6dc522600efd1814d4b2d3c900c6810e9fcbe2c
# via -r requirements.txt
requests==2.32.3 \
--hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \
--hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6
# via
# -r requirements.txt
# docker
# qbittorrent-api
s3transfer==0.10.2 \
--hash=sha256:0711534e9356d3cc692fdde846b4a1e4b0cb6519971860796e6bc4c7aea00ef6 \
--hash=sha256:eca1c20de70a39daee580aef4986996620f365c4e0fda6a86100231d62f1bf69
Expand Down Expand Up @@ -716,6 +722,7 @@ urllib3==2.2.2 \
# via
# botocore
# docker
# qbittorrent-api
# requests
# types-requests
virtualenv==20.26.2 \
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pylint
pysocks
pytest
pyyaml
qbittorrent-api
requests
SQLAlchemy>=2.0.16
SQLAlchemy[mypy]>=2.0.16
Expand Down
24 changes: 24 additions & 0 deletions torrent_hook/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library")

py_binary(
name = "torrent_finished",
srcs = ["torrent_finished.py"],
visibility = ["//:__subpackages__"],
deps = [
"@py_deps//qbittorrent_api",
"@py_deps//requests",
],
)

py_library(
name = "torrent_hook",
srcs = [
"__init__.py",
"torrent_finished.py",
],
visibility = ["//:__subpackages__"],
deps = [
"@py_deps//qbittorrent_api",
"@py_deps//requests",
],
)
File renamed without changes.
4 changes: 4 additions & 0 deletions torrent_hook/scripts/torrent_finished
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

cd "$(dirname "$0")/../../"
bazel run //torrent_hook:torrent_finished -- "$@"
Loading