]> git.phdru.name Git - bittorrent.git/commitdiff
Feat: List content of a torrent metafile (full format)
authorOleg Broytman <phd@phdru.name>
Sat, 1 Mar 2025 20:44:45 +0000 (23:44 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 31 Aug 2025 20:44:45 +0000 (23:44 +0300)
ls-torrent-full [new file with mode: 0755]

diff --git a/ls-torrent-full b/ls-torrent-full
new file mode 100755 (executable)
index 0000000..c91e451
--- /dev/null
@@ -0,0 +1,18 @@
+#! /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():
+    print(key, ':', value)