Recognize BitComet padding file names
This commit is contained in:
@@ -168,7 +168,7 @@ def _v1_files(info: dict[bytes, Any]) -> list[MetaFile]:
|
||||
components = [name] + [_component(part) for part in raw_path]
|
||||
result.append(MetaFile(
|
||||
"/".join(components), _length(item.get(b"length")),
|
||||
_padding(item),
|
||||
_padding(item) or _bitcomet_padding_name(components[-1]),
|
||||
))
|
||||
return result
|
||||
|
||||
@@ -223,3 +223,13 @@ def _length(value: Any) -> int:
|
||||
def _padding(value: dict[bytes, Any]) -> bool:
|
||||
attributes = value.get(b"attr", b"")
|
||||
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_")
|
||||
|
||||
Reference in New Issue
Block a user