mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 18:17:53 -06:00
refactor: one torrentzip comment test for capture
This commit is contained in:
1 parent
30cd881ef3
commit
eebe6a66c3
2 files changed
+8
-5
No files matched your search
@@ -180,7 +180,12 @@ def rebuild_torrentzip(source: str | Path) -> bytes:
|
||||
return build_torrentzip(members)
|
||||
|
||||
|
||||
def has_torrentzip_comment(comment: bytes) -> bool:
|
||||
"""Report whether an archive comment is the TorrentZip signature."""
|
||||
return comment.startswith(_COMMENT_PREFIX.encode("ascii"))
|
||||
|
||||
|
||||
def is_torrentzip(source: str | Path) -> bool:
|
||||
"""Report whether an archive already carries the TorrentZip signature."""
|
||||
with zipfile.ZipFile(source) as zf:
|
||||
return zf.comment.decode("ascii", "replace").startswith(_COMMENT_PREFIX)
|
||||
return has_torrentzip_comment(zf.comment)
|
||||
Reference in new issue
Block a user