init
This commit is contained in:
5
deluge/cookie_deluge.txt
Normal file
5
deluge/cookie_deluge.txt
Normal 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
10
deluge/curl.cfg
Normal 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
7
deluge/deluge_start.sh
Executable 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
BIN
deluge/existing.torrent
Normal file
Binary file not shown.
4
deluge/my.torrent
Normal file
4
deluge/my.torrent
Normal 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:<3A><>f<EFBFBD><<3C><>z<EFBFBD><7A><EFBFBD><EFBFBD>#<23>&<07>uDj<44>r<EFBFBD>t#;<3B>~N<><4E>,eee4:authd0:d6:lengthi56e11:pieces root32:)<29><><1E><11>j<EFBFBD><6A><EFBFBD><EFBFBD>&<26><>=<3D><>?<3F>p27<32>dC@w\<5C>[<5B>ee9:core.confd0:d6:lengthi2815e11:pieces root32:C<>΄V<CE84>R<EFBFBD><52><EFBFBD>z<EFBFBD>,<2C><><EFBFBD>VW<56><57>C<>İ@<40>
|
||||
3]ee13:core.conf.bakd0:d6:lengthi2814e11:pieces root32:Ԥ<><13><<3C><08><10><>X><3E>ئtF<>?Rl<52>2o<32><6F>ee11:deluged.logd0:d6:lengthi0eee11:deluged.pidd0:d6:lengthi11e11:pieces root32:<3A><><EFBFBD><EFBFBD>x1<78><31><EFBFBD>TI<54>><3E><>|<7C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=&
|
||||
<16><>)<29> Uee13:hostlist.confd0:d6:lengthi252e11:pieces root32:C<>(<28><1E><10><><EFBFBD>G4<47>YP<59><50>:<3A>b <20>l<EFBFBD>k<EFBFBD>o-2mee3:ssld11:daemon.certd0:d6:lengthi977e11:pieces root32:Y<>G<EFBFBD><47>+Z<><5A><EFBFBD><EFBFBD><<3C>0<EFBFBD><30><EFBFBD><EFBFBD>=X<><58><EFBFBD><EFBFBD><EFBFBD>7/ee11:daemon.pkeyd0:d6:lengthi1704e11:pieces root32:p<>6p<18><1F><><0C><1C><>1<EFBFBD><31>/+<01>c<EFBFBD><63><EFBFBD><EFBFBD>Feee5:stated17:.safe_state_checkd0:d6:lengthi0eee14:torrents.stated0:d6:lengthi80e11:pieces root32:yP<79><50>03<>
|
||||
<EFBFBD><01>
|
1
deluge/readme.md
Normal file
1
deluge/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
https://deluge.readthedocs.io/en/latest/devguide/how-to/curl-jsonrpc.html
|
51
deluge/torrent_test.py
Executable file
51
deluge/torrent_test.py
Executable 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")
|
||||
|
||||
|
Reference in New Issue
Block a user