torrent-downloader-react 1.0.17__py3-none-any.whl → 1.0.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- torrent_downloader/server.py +51 -0
- torrent_downloader/static/assets/index-COG6Byoc.js +49 -0
- torrent_downloader/static/assets/{index-DVy8AvwL.css → index-CdUAChFP.css} +1 -1
- torrent_downloader/static/index.html +2 -2
- {torrent_downloader_react-1.0.17.dist-info → torrent_downloader_react-1.0.19.dist-info}/METADATA +1 -1
- torrent_downloader_react-1.0.19.dist-info/RECORD +11 -0
- torrent_downloader/static/assets/index-BWN4x5dM.js +0 -49
- torrent_downloader_react-1.0.17.dist-info/RECORD +0 -11
- {torrent_downloader_react-1.0.17.dist-info → torrent_downloader_react-1.0.19.dist-info}/WHEEL +0 -0
- {torrent_downloader_react-1.0.17.dist-info → torrent_downloader_react-1.0.19.dist-info}/entry_points.txt +0 -0
- {torrent_downloader_react-1.0.17.dist-info → torrent_downloader_react-1.0.19.dist-info}/top_level.txt +0 -0
torrent_downloader/server.py
CHANGED
@@ -75,6 +75,17 @@ DOWNLOAD_PATH = get_downloads_dir()
|
|
75
75
|
session = lt.session()
|
76
76
|
settings = session.get_settings()
|
77
77
|
settings['listen_interfaces'] = '0.0.0.0:6881'
|
78
|
+
settings['active_downloads'] = -1 # No limit
|
79
|
+
settings['active_seeds'] = -1 # No limit
|
80
|
+
settings['active_limit'] = -1 # No limit
|
81
|
+
settings['auto_manage_interval'] = 1 # Check every second
|
82
|
+
settings['active_tracker_limit'] = -1 # No limit
|
83
|
+
settings['enable_outgoing_utp'] = True
|
84
|
+
settings['enable_incoming_utp'] = True
|
85
|
+
settings['announce_to_all_tiers'] = True
|
86
|
+
settings['announce_to_all_trackers'] = True
|
87
|
+
settings['aio_threads'] = 8 # Number of async I/O threads
|
88
|
+
settings['checking_mem_usage'] = 128 # Memory usage for checking (in MB)
|
78
89
|
session.apply_settings(settings)
|
79
90
|
|
80
91
|
# Store active torrents
|
@@ -88,6 +99,7 @@ class TorrentInfo(BaseModel):
|
|
88
99
|
name: str
|
89
100
|
progress: float
|
90
101
|
download_speed: float
|
102
|
+
upload_speed: float
|
91
103
|
state: str
|
92
104
|
total_size: int
|
93
105
|
downloaded: int
|
@@ -131,12 +143,15 @@ async def list_torrents() -> List[TorrentInfo]:
|
|
131
143
|
state_str = "finished"
|
132
144
|
elif status.state == lt.torrent_status.checking_files:
|
133
145
|
state_str = "checking"
|
146
|
+
elif status.state == lt.torrent_status.paused:
|
147
|
+
state_str = "paused"
|
134
148
|
|
135
149
|
info = TorrentInfo(
|
136
150
|
id=torrent_id,
|
137
151
|
name=handle.name(),
|
138
152
|
progress=status.progress * 100,
|
139
153
|
download_speed=status.download_rate / 1024, # Convert to KB/s
|
154
|
+
upload_speed=status.upload_rate / 1024, # Convert to KB/s
|
140
155
|
state=state_str,
|
141
156
|
total_size=status.total_wanted,
|
142
157
|
downloaded=status.total_wanted_done
|
@@ -167,6 +182,42 @@ async def open_downloads():
|
|
167
182
|
raise HTTPException(status_code=500, detail="Failed to open downloads folder")
|
168
183
|
return {"message": "Downloads folder opened successfully"}
|
169
184
|
|
185
|
+
@app.post("/api/torrent/{torrent_id}/pause")
|
186
|
+
async def pause_torrent(torrent_id: str):
|
187
|
+
"""Pause a specific torrent."""
|
188
|
+
if torrent_id not in active_torrents:
|
189
|
+
raise HTTPException(status_code=404, detail="Torrent not found")
|
190
|
+
|
191
|
+
handle = active_torrents[torrent_id]
|
192
|
+
handle.pause()
|
193
|
+
# Force an immediate pause
|
194
|
+
handle.flush_cache()
|
195
|
+
return {"message": "Torrent paused successfully"}
|
196
|
+
|
197
|
+
@app.post("/api/torrent/{torrent_id}/resume")
|
198
|
+
async def resume_torrent(torrent_id: str):
|
199
|
+
"""Resume a specific torrent."""
|
200
|
+
if torrent_id not in active_torrents:
|
201
|
+
raise HTTPException(status_code=404, detail="Torrent not found")
|
202
|
+
|
203
|
+
handle = active_torrents[torrent_id]
|
204
|
+
handle.resume()
|
205
|
+
return {"message": "Torrent resumed successfully"}
|
206
|
+
|
207
|
+
@app.post("/api/torrent/pause-all")
|
208
|
+
async def pause_all_torrents():
|
209
|
+
"""Pause all active torrents."""
|
210
|
+
for handle in active_torrents.values():
|
211
|
+
handle.pause()
|
212
|
+
return {"message": "All torrents paused successfully"}
|
213
|
+
|
214
|
+
@app.post("/api/torrent/resume-all")
|
215
|
+
async def resume_all_torrents():
|
216
|
+
"""Resume all active torrents."""
|
217
|
+
for handle in active_torrents.values():
|
218
|
+
handle.resume()
|
219
|
+
return {"message": "All torrents resumed successfully"}
|
220
|
+
|
170
221
|
def main():
|
171
222
|
"""Entry point for the application."""
|
172
223
|
import uvicorn
|