From 3af39325cda1ab4cc8086e3894a91c2e5ff817ef Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 3 Feb 2025 23:37:37 +0300 Subject: [PATCH] Feat: List content of a torrent metafile (simpler format) --- ls-torrent-simple | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 ls-torrent-simple diff --git a/ls-torrent-simple b/ls-torrent-simple new file mode 100755 index 0000000..aab33c0 --- /dev/null +++ b/ls-torrent-simple @@ -0,0 +1,19 @@ +#! /usr/bin/env python3 + +import sys +from eff_bdecode import eff_bdecode + +torrent_file = open(sys.argv[1], 'rb') +data = torrent_file.read() +torrent_file.close() + +data = eff_bdecode(data) + +print('Meta:') +for key, value in data.items(): + if key != b'info': + print(key, ':', value) +print('\nInfo:') +for key, value in data[b'info'].items(): + if key != b'pieces': + print(key, ':', value) -- 2.39.5