]> git.phdru.name Git - bittorrent.git/commitdiff
Feat: List content of a torrent metafile (simpler format)
authorOleg Broytman <phd@phdru.name>
Mon, 3 Feb 2025 20:37:37 +0000 (23:37 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 31 Aug 2025 20:38:19 +0000 (23:38 +0300)
ls-torrent-simple [new file with mode: 0755]

diff --git a/ls-torrent-simple b/ls-torrent-simple
new file mode 100755 (executable)
index 0000000..aab33c0
--- /dev/null
@@ -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)