torrent-downloader-react 1.1.4__py3-none-any.whl → 1.1.6__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 +18 -2
- torrent_downloader/static/assets/{index-DpeprjRI.css → index-BKZnulWN.css} +1 -1
- torrent_downloader/static/assets/index-lPeprbEH.js +49 -0
- torrent_downloader/static/index.html +2 -2
- {torrent_downloader_react-1.1.4.dist-info → torrent_downloader_react-1.1.6.dist-info}/METADATA +1 -1
- torrent_downloader_react-1.1.6.dist-info/RECORD +11 -0
- torrent_downloader/static/assets/index-BAUKkMK0.js +0 -49
- torrent_downloader_react-1.1.4.dist-info/RECORD +0 -11
- {torrent_downloader_react-1.1.4.dist-info → torrent_downloader_react-1.1.6.dist-info}/WHEEL +0 -0
- {torrent_downloader_react-1.1.4.dist-info → torrent_downloader_react-1.1.6.dist-info}/entry_points.txt +0 -0
- {torrent_downloader_react-1.1.4.dist-info → torrent_downloader_react-1.1.6.dist-info}/top_level.txt +0 -0
torrent_downloader/server.py
CHANGED
@@ -98,8 +98,18 @@ class TorrentInfo(BaseModel):
|
|
98
98
|
async def add_torrent(request: TorrentRequest):
|
99
99
|
try:
|
100
100
|
# Add the torrent
|
101
|
-
|
101
|
+
try:
|
102
|
+
params = lt.parse_magnet_uri(request.magnet_link)
|
103
|
+
except Exception as e:
|
104
|
+
raise HTTPException(status_code=400, detail=f"Invalid magnet link format: {str(e)}")
|
105
|
+
|
102
106
|
params.save_path = str(DOWNLOAD_PATH)
|
107
|
+
|
108
|
+
# Check if torrent already exists with this hash
|
109
|
+
torrent_hash = str(params.info_hash)
|
110
|
+
if torrent_hash in active_torrents:
|
111
|
+
raise HTTPException(status_code=409, detail="A duplicate torrent is already being downloaded")
|
112
|
+
|
103
113
|
handle = session.add_torrent(params)
|
104
114
|
|
105
115
|
# Wait for metadata
|
@@ -113,7 +123,13 @@ async def add_torrent(request: TorrentRequest):
|
|
113
123
|
torrent_id = str(handle.info_hash())
|
114
124
|
active_torrents[torrent_id] = handle
|
115
125
|
|
116
|
-
|
126
|
+
# Get the torrent name for the response
|
127
|
+
torrent_name = handle.status().name
|
128
|
+
|
129
|
+
return {"id": torrent_id, "message": f"Torrent '{torrent_name}' added successfully"}
|
130
|
+
except HTTPException:
|
131
|
+
# Re-raise HTTP exceptions to preserve status codes
|
132
|
+
raise
|
117
133
|
except Exception as e:
|
118
134
|
raise HTTPException(status_code=400, detail=str(e))
|
119
135
|
|
@@ -1 +1 @@
|
|
1
|
-
:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#213547;background-color:#fff;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*{box-sizing:border-box;margin:0;padding:0}body{margin:0;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: dark){:root{color:#ffffffde;background-color:#242424}.torrent-item{background-color:#2a2a2a!important;border-color:#404040!important}.torrent-info h3{color:#e2e8f0!important}.torrent-info p{color:#94a3b8!important}.progress-bar{background-color:#404040!important}input{background-color:#2a2a2a;color:#fff;border-color:#404040!important}input::placeholder{color:#94a3b8}}:root{--text-primary: #1e293b;--text-secondary: #64748b;--border-color: #e2e8f0;--background-primary: #ffffff;--background-secondary: #f8fafc}@media (prefers-color-scheme: dark){:root{--text-primary: #e2e8f0;--text-secondary: #94a3b8;--border-color: #334155;--background-primary: #0f172a;--background-secondary: #1e293b}}#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}.container{max-width:1200px;margin:0 auto;padding:2rem}header{display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem}header h1{margin:0;font-size:2rem;color:var(--text-primary)}.error-message{background-color:#fee2e2;border:1px solid #fecaca;color:#dc2626;padding:1rem;border-radius:4px;margin-bottom:1rem}.input-section{display:flex;gap:1rem;margin-bottom:2rem}.input-section input{flex:1;padding:.75rem;border:1px solid #ccc;border-radius:4px;font-size:1rem}button{padding:.75rem 1.5rem;background-color:#2563eb;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:1rem;transition:background-color .2s}button:hover:not(:disabled){background-color:#1d4ed8}button:disabled{background-color:#93c5fd;cursor:not-allowed}.remove-button{background-color:#dc2626;padding:.5rem 1rem;font-size:.875rem}.remove-button:hover:not(:disabled){background-color:#b91c1c}.torrents-list{display:flex;flex-direction:column;gap:1rem}.torrent-item{background-color:var(--background-secondary);border:1px solid var(--border-color);border-radius:8px;padding:1rem}.torrent-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.torrent-info{margin-bottom:1rem}.torrent-info h3{margin:0 0 .5rem;color:var(--text-primary)}.torrent-info p{margin:.25rem 0;color:var(--text-secondary)}.progress-bar{width:100%;height:8px;background-color:#e2e8f0;border-radius:4px;overflow:hidden}.progress{height:100%;background-color:#2563eb;transition:width .3s ease}@media (prefers-color-scheme: dark){.error-message{background-color:#450a0a;border-color:#7f1d1d;color:#fecaca}}.header-buttons{display:flex;gap:1rem}.torrent-actions{display:flex;gap:.5rem}
|
1
|
+
:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#213547;background-color:#fff;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*{box-sizing:border-box;margin:0;padding:0}body{margin:0;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: dark){:root{color:#ffffffde;background-color:#242424}.torrent-item{background-color:#2a2a2a!important;border-color:#404040!important}.torrent-info h3{color:#e2e8f0!important}.torrent-info p{color:#94a3b8!important}.progress-bar{background-color:#404040!important}input{background-color:#2a2a2a;color:#fff;border-color:#404040!important}input::placeholder{color:#94a3b8}}:root{--text-primary: #1e293b;--text-secondary: #64748b;--border-color: #e2e8f0;--background-primary: #ffffff;--background-secondary: #f8fafc}@media (prefers-color-scheme: dark){:root{--text-primary: #e2e8f0;--text-secondary: #94a3b8;--border-color: #334155;--background-primary: #0f172a;--background-secondary: #1e293b}}#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}.container{max-width:1200px;margin:0 auto;padding:2rem}header{display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem}header h1{margin:0;font-size:2rem;color:var(--text-primary)}.error-message{background-color:#fee2e2;border:1px solid #fecaca;color:#dc2626;padding:1rem;border-radius:4px;margin-bottom:1rem}.input-section{display:flex;gap:1rem;margin-bottom:2rem}.input-section input{flex:1;padding:.75rem;border:1px solid #ccc;border-radius:4px;font-size:1rem}button{padding:.75rem 1.5rem;background-color:#2563eb;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:1rem;transition:background-color .2s}button:hover:not(:disabled){background-color:#1d4ed8}button:disabled{background-color:#93c5fd;cursor:not-allowed}.remove-button{background-color:#dc2626;padding:.5rem 1rem;font-size:.875rem}.remove-button:hover:not(:disabled){background-color:#b91c1c}.torrents-list{display:flex;flex-direction:column;gap:1rem}.torrent-item{background-color:var(--background-secondary);border:1px solid var(--border-color);border-radius:8px;padding:1rem}.torrent-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.torrent-info{margin-bottom:1rem}.torrent-info h3{margin:0 0 .5rem;color:var(--text-primary)}.torrent-info p{margin:.25rem 0;color:var(--text-secondary)}.progress-bar{width:100%;height:8px;background-color:#e2e8f0;border-radius:4px;overflow:hidden}.progress{height:100%;background-color:#2563eb;transition:width .3s ease}@media (prefers-color-scheme: dark){.error-message{background-color:#450a0a;border-color:#7f1d1d;color:#fecaca}}.header-buttons{display:flex;gap:1rem}.torrent-actions{display:flex;gap:.5rem}.torrent-status-message{margin:1rem 0;padding:1rem;border-radius:8px;display:flex;align-items:center;justify-content:center;transition:all .3s ease;animation:fadeIn .3s ease-in}@keyframes fadeIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.torrent-status-message.loading{background-color:#2563eb20;border:1px solid #2563eb;color:#2563eb}.torrent-status-message.success{background-color:#16a34a20;border:1px solid #16a34a;color:#16a34a}.torrent-status-message.error{background-color:#dc262620;border:1px solid #dc2626;color:#dc2626}.status-content{display:flex;align-items:center;gap:1rem}.loading-spinner{width:20px;height:20px;border:3px solid #2563eb40;border-top:3px solid #2563eb;border-radius:50%;animation:spin 1s linear infinite}.status-icon{width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:50%;font-weight:700}.success-icon{background-color:#16a34a;color:#fff}.error-icon{background-color:#dc2626;color:#fff}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-color-scheme: dark){.torrent-status-message.loading{background-color:#1e3a8a40;border-color:#3b82f6;color:#93c5fd}.torrent-status-message.success{background-color:#14532d40;border-color:#22c55e;color:#86efac}.torrent-status-message.error{background-color:#7f1d1d40;border-color:#ef4444;color:#fca5a5}.loading-spinner{border-color:#93c5fd40;border-top-color:#3b82f6}}
|