From: Oleg Broytman Date: Mon, 3 Feb 2025 20:37:37 +0000 (+0300) Subject: Feat: List content of a torrent metafile (simpler format) X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=3af39325cda1ab4cc8086e3894a91c2e5ff817ef;p=bittorrent.git Feat: List content of a torrent metafile (simpler format) --- 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)