Skip to content

Commit 9342354

Browse files
committed
update
1 parent 4c46700 commit 9342354

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

qbittorrent_sync.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
from typing import Callable
1+
from typing import Any, Callable
22

33
import qbittorrentapi
44
from stdl import fs
55
from stdl.st import colored
66

77

8-
def is_windows_path(path: str):
8+
def is_windows_path(path: str) -> bool:
99
return ":" in path and "\\" in path
1010

1111

12-
def win_to_unix_path(path: str, drive_path: str = "/mnt"):
12+
def win_to_unix_path(path: str, drive_path: str = "/mnt") -> str:
1313
"""
1414
E:\\files\\ -> /mnt/e/files/
1515
/mnt/e/files/ -> /mnt/e/files/
@@ -23,7 +23,7 @@ def win_to_unix_path(path: str, drive_path: str = "/mnt"):
2323
return path
2424

2525

26-
def unix_to_win_path(path: str, drive_path: str = "/mnt"):
26+
def unix_to_win_path(path: str, drive_path: str = "/mnt") -> str:
2727
"""
2828
/mnt/e/files/ -> E:\\files\\
2929
"""
@@ -34,7 +34,7 @@ def unix_to_win_path(path: str, drive_path: str = "/mnt"):
3434
return path
3535

3636

37-
def same_path(path: str):
37+
def same_path(path: str) -> str:
3838
return path
3939

4040

@@ -56,7 +56,7 @@ def __init__(
5656
self.client.auth_log_in()
5757
self.path_transoform_func = path_transform_func
5858

59-
def get_torrents(self):
59+
def get_torrents(self) -> list[dict[Any, Any]]:
6060
torrents = [dict(**i) for i in self.client.torrents_info()] # type: ignore
6161
for i in torrents:
6262
if i["tags"] == "":
@@ -65,7 +65,7 @@ def get_torrents(self):
6565
i["tags"] = [i.strip() for i in i["tags"].split(",")]
6666
return torrents
6767

68-
def export_torrents(self, path: str):
68+
def export_torrents(self, path: str) -> None:
6969
torrents = self.get_torrents()
7070
data = []
7171
for i in torrents:
@@ -81,7 +81,7 @@ def export_torrents(self, path: str):
8181
fs.json_dump(data, path)
8282
print(f"{len(data)} torrents saved to {path}.")
8383

84-
def import_torrents(self, path: str):
84+
def import_torrents(self, path: str) -> None:
8585
current = [i["magnet_uri"] for i in self.get_torrents()]
8686
fs.ensure_paths_exist(path)
8787
data = fs.json_load(path)

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
qbittorrent-api>=2024.5.63
2-
stdl>=0.5.5
2+
stdl>=0.6.1

0 commit comments

Comments
 (0)