Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
515599f2d4 |
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "archive-clients"
|
name = "archive-clients"
|
||||||
version = "0.1.18"
|
version = "0.1.19"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = ["protobuf==7.35.1", "websockets==16.0"]
|
dependencies = ["protobuf==7.35.1", "websockets==16.0"]
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ def _v1_files(info: dict[bytes, Any]) -> list[MetaFile]:
|
|||||||
components = [name] + [_component(part) for part in raw_path]
|
components = [name] + [_component(part) for part in raw_path]
|
||||||
result.append(MetaFile(
|
result.append(MetaFile(
|
||||||
"/".join(components), _length(item.get(b"length")),
|
"/".join(components), _length(item.get(b"length")),
|
||||||
_padding(item),
|
_padding(item) or _bitcomet_padding_name(components[-1]),
|
||||||
))
|
))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -223,3 +223,13 @@ def _length(value: Any) -> int:
|
|||||||
def _padding(value: dict[bytes, Any]) -> bool:
|
def _padding(value: dict[bytes, Any]) -> bool:
|
||||||
attributes = value.get(b"attr", b"")
|
attributes = value.get(b"attr", b"")
|
||||||
return isinstance(attributes, bytes) and b"p" in attributes
|
return isinstance(attributes, bytes) and b"p" in attributes
|
||||||
|
|
||||||
|
|
||||||
|
def _bitcomet_padding_name(component: str) -> bool:
|
||||||
|
"""Recognize BitComet's legacy padding-file convention.
|
||||||
|
|
||||||
|
Such v1 torrents often omit the standard ``attr=p`` flag, but
|
||||||
|
qBittorrent/libtorrent still hides these synthetic entries from its file
|
||||||
|
API. The exact reserved prefix is the interoperable marker.
|
||||||
|
"""
|
||||||
|
return component.startswith("_____padding_file_")
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class ResourceTests(unittest.TestCase):
|
|||||||
b"files": [
|
b"files": [
|
||||||
{b"length": 3, b"path": [b"first.bin"]},
|
{b"length": 3, b"path": [b"first.bin"]},
|
||||||
{
|
{
|
||||||
b"attr": b"p", b"length": 5,
|
b"length": 5,
|
||||||
b"path": [b"_____padding_file_5"],
|
b"path": [b"_____padding_file_5"],
|
||||||
},
|
},
|
||||||
{b"length": 7, b"path": [b"last.bin"]},
|
{b"length": 7, b"path": [b"last.bin"]},
|
||||||
|
|||||||
Reference in New Issue
Block a user