This commit is contained in:
despiegk 2024-01-13 09:32:52 +03:00
parent fc2de883df
commit 3d15a2e80e
Signed by: despiegk
GPG Key ID: 99E4E1492F73BC18
11 changed files with 110 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.mypy_cache
deluge_conf

5
deluge/cookie_deluge.txt Normal file
View File

@ -0,0 +1,5 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
localhost FALSE /json FALSE 1705130407 _session_id c04d013df838035551095d3b91e7d344d0e6411531d7cb281aa92e4703b8f4264176

10
deluge/curl.cfg Normal file
View File

@ -0,0 +1,10 @@
request = "POST"
compressed
cookie = "cookie_deluge.txt"
cookie-jar = "cookie_deluge.txt"
header = "Content-Type: application/json"
header = "Accept: application/json"
url = "http://localhost:8112/json"
write-out = "\n"
# curl -d '{"method": "web.add_torrents", "params": [[{"path":/Users/despiegk1/Downloads/vlc-3.0.20-arm64.dmg", "options":null}]], "id": 1}' -K curl.cfg

7
deluge/deluge_start.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
deluge -c deluge_conf -s web
deluge -c deluge_conf web
echo "default passwd is 'deluge'"
open http://localhost:8112/
# curl -d '{"method": "web.add_torrents", "params": [[{"path":/Users/despiegk1/Downloads/vlc-3.0.20-arm64.dmg", "options":null}]], "id": 1}' -K curl.cfg

BIN
deluge/existing.torrent Normal file

Binary file not shown.

4
deluge/my.torrent Normal file
View File

@ -0,0 +1,4 @@
d7:comment9:Cool Test10:created by18:My Torrent Creator13:creation datei1705127067e4:infod9:file treed7:archived32:state-2024-01-13T09-17-00.tar.xzd0:d6:lengthi268e11:pieces root32:§ãf¯<ˆÐzžÙã±#«&§uDj³rŸt#;ä~N†Ý,eee4:authd0:d6:lengthi56e11:pieces root32:)ýƒþšjÀÆÎ&ÿÅ=òô?¬p27ÑdC@w\ã[¹ee9:core.confd0:d6:lengthi2815e11:pieces root32:CµÎ„V¦RçåÒzÄ,“ŽªVW¢þÄ°@è 3]ee13:core.conf.bakd0:d6:lengthi2814e11:pieces root32:Ô¤Ô¡<® °×X>²ئtFŠ?Rl¾2oÈîee11:deluged.logd0:d6:lengthi0eee11:deluged.pidd0:d6:lengthi11e11:pieces root32:µªŽÜx1ÍØòTI‰>‘§|ãäÜè¦ø=&
þ÷)Ò Uee13:hostlist.confd0:d6:lengthi252e11:pieces root32:CÓ(¤ÕÎñ›G4ÖYPÐ÷:<3A>b ˆlØkÂo-2mee3:ssld11:daemon.certd0:d6:lengthi977e11:pieces root32:YìG ©+Z…¹éÎ<Ê0éÎý·=XœØç<C398>7/ee11:daemon.pkeyd0:d6:lengthi1704e11:pieces root32:pé6p»–“ ï—Í1÷û/+—cÖòôÓF eee5:stated17:.safe_state_checkd0:d6:lengthi0eee14:torrents.stated0:d6:lengthi80e11:pieces root32:yP©Þ03ˆ
ª
Hkx˜â0& YcÞÏÓceee7:ui.confd0:d6:lengthi61e11:pieces root32:Â<1A>Mâ«þ³2ãG•œ´¸öa²0=Qº\Ô"­<C2AD>Ôee8:web.confd0:d6:lengthi783e11:pieces root32:š6Ie<36><C2A2><EFBFBD>*U`£ÿÃ4ªÿ(õ›>U'…¶eee12:meta versioni2e4:name11:deluge_conf12:piece lengthi16384ee12:piece layersdee

1
deluge/readme.md Normal file
View File

@ -0,0 +1 @@
https://deluge.readthedocs.io/en/latest/devguide/how-to/curl-jsonrpc.html

51
deluge/torrent_test.py Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env python3
import libtorrent as lt
import time
def create_torrent(directory, torrent_file_name):
# Create a new file storage object
fs = lt.file_storage()
# Add files from the directory to the file storage
lt.add_files(fs, directory)
# Create a new create_torrent object
t = lt.create_torrent(fs, flags=lt.create_torrent_flags_t.v2_only)
# Add tracker
# t.add_tracker("http://your-tracker.com/announce")
# Set comment or other properties (optional)
t.set_comment("Cool Test")
t.set_creator("My Torrent Creator")
# Generate the torrent
lt.set_piece_hashes(t, ".") # Second argument is the root directory for the files
torrent = t.generate()
# Write the torrent file
with open(torrent_file_name, "wb") as f:
f.write(lt.bencode(torrent))
def read_torrent_v2(file_path):
# Create a torrent_info object from the file path
info = lt.torrent_info(file_path)
# Accessing various properties of the torrent
print("Torrent Name:", info.name())
print("Number of Files:", info.num_files())
print("Total Size:", info.total_size())
# Loop through each file in the torrent
for i in range(info.num_files()):
file = info.files().file_path(i)
size = info.files().file_size(i)
print(f"File {i}: {file}, Size: {size}")
# Example usage
create_torrent("deluge_conf","my.torrent")
read_torrent_v2("existing.torrent")
read_torrent_v2("my.torrent")

1
nupower Symbolic link
View File

@ -0,0 +1 @@
/Users/despiegk1/code/git.ourworld.tf/freeflowuniverse/nu/nupower

25
shell.nix Normal file
View File

@ -0,0 +1,25 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShell {
packages = with pkgs; [
git
nushell
mc
jq
# vscode
deluge
libtorrent-rasterbar
python311Packages.libtorrent-rasterbar
python311Full
python311Packages.ipython
python311Packages.ipdb
python311Packages.rq
# dumptorrent
# udpt
# buildtorrent
];
}

4
start.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -ex
export NIXPKGS_ALLOW_UNFREE=1
nix-shell