diff --git a/cpln.sh b/cpln.sh new file mode 100644 index 0000000..de8bfaf --- /dev/null +++ b/cpln.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +function cpln { + + for f in `ls $1` + + do + + ln $1/$f $2 && ln -sf $2/$f $1 + + done + +} diff --git a/dircompare b/dircompare new file mode 100755 index 0000000..5899231 --- /dev/null +++ b/dircompare @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# ft=python + +import os, sys + +def compare_dirs(d1: "old directory name", d2: "new directory name"): + def print_local(a, msg): + print('DIR ' if a[2] else 'FILE', a[1], msg) + # ensure validity + for d in [d1,d2]: + if not os.path.isdir(d): + raise ValueError("not a directory: " + d) + # get relative path + l1 = [(x,os.path.join(d1,x)) for x in os.listdir(d1)] + l2 = [(x,os.path.join(d2,x)) for x in os.listdir(d2)] + # determine type: directory or file? + l1 = sorted([(x,y,os.path.isdir(y)) for x,y in l1]) + l2 = sorted([(x,y,os.path.isdir(y)) for x,y in l2]) + i1 = i2 = 0 + common_dirs = [] + while i1l2[i2][0]: + print_local(l2[i2],'added') + i2 += 1 + while i1/dev/null | grep --color=none ass + fi +done \ No newline at end of file diff --git a/torrentinfo.sh b/torrentinfo.sh new file mode 100755 index 0000000..0832308 --- /dev/null +++ b/torrentinfo.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +from bencodepy import decode_from_file +import os + +filename = 'Another - TV Series [2012] - Blu-ray MKV h264 10-bit 1080p FLAC 2.0 Softsubs (Coalgirls).50781.torrent' +folder = '/home/lukas/Torrents/' +fullpath = os.path.join(folder,filename) +print(f"Full path to file: {fullpath}.") +print(f"File exists: {os.path.lexists(fullpath)}") + +torrent_pieces = decode_from_file(fullpath)[b'info'][b'files'] + +for torrent_piece in torrent_pieces: + print(torrent_piece[b'path'][0].decode("utf-8")) +