Commit Graph
10 Commits
Author SHA1 Message Date
Stephon ParkerandCaliBrain 5e04b6bfb8 Add Download Queue Management & Concurrent Downloads (#231)
## Summary

This PR completely overhauls the download system to support concurrent
downloads, cancellation, and advanced queue
management. No more waiting for stuck downloads to block the entire
queue!

  ## New Features

  ###  **Concurrent Downloads**
  - **3 simultaneous downloads** by default (configurable)
- ThreadPoolExecutor-based architecture replaces single-threaded
bottleneck
  - Downloads no longer block each other

  ###  **Download Cancellation**
  - **Cancel button** for active/queued downloads
  - Clean cancellation with partial file cleanup
  - Thread-safe cancellation flags

  ### **Queue Priority & Reordering**
  - **Priority-based queue** (lower number = higher priority)
  - **Editable priority inputs** in UI for queued items
  - **Bulk reordering** API support

  ## UI Enhancements

- **Enhanced status table** with Priority, Progress, and Actions columns
  - **Progress bars** for active downloads
  - **Cancel buttons** for downloads
- **Queue management controls**: Refresh, Clear Completed, Active
Counter
  - **Real-time updates** every 60 seconds

## Implementation

  ### New Architecture
  - `queue.PriorityQueue` replaces simple `set()` for proper ordering
  - `concurrent.futures.ThreadPoolExecutor` handles worker threads
  - `threading.Event` flags enable clean cancellation
  - Thread-safe operations with proper locking

  ### New API Endpoints
  DELETE /api/download/{id}/cancel     # Cancel downloads
PUT /api/queue/{id}/priority # Set priorityPOST /api/queue/reorder #
Bulk reorder
  GET /api/downloads/active          # Active tracking
  DELETE /api/queue/clear            # Clear completed

  ### New Environment Variables
  ```bash
  MAX_CONCURRENT_DOWNLOADS=3          # Worker thread count
  DOWNLOAD_PROGRESS_UPDATE_INTERVAL=5  # Progress frequency
  ```

### Fully backward compatible - existing functionality unchanged

### Fixes

  - Resolves: Downloads blocking when one gets stuck
  - Resolves: No way to cancel problematic downloads
  - Resolves: No queue management or prioritization
  
  #183

---------

Co-authored-by: CaliBrain <calibrain@l4n.xyz>
2025-08-25 13:28:35 -04:00
Martijn Ruijzendaal f9fb6c13b5 Add option to select formats (#193)
In response to #184, and for my own desperate need for PDFs, I
implemented this change.

The UI needs some tweaking, the functionality looks complete.

Before this pull request is merged, I'm modifying my docker compose as
follows to use the version that includes format options:

```diff
services:
  calibre-web-automated-book-downloader:
-    image: ghcr.io/calibrain/calibre-web-automated-book-downloader:latest
+    build:
+      context: https://github.com/mruijzendaal/calibre-web-automated-book-downloader.git
```

@calibrain Could you adjust the UI such that this fits better with the
rest of the application? I'm not well-versed with UIKit. Thanks in
advance for considering this pull request!
2025-07-14 15:31:18 -04:00
CaliBrain 0ba7031a83 Fix download + add test + fix book move (#140) 2025-04-16 11:18:03 -04:00
CaliBrain c2e7acd473 Use a tmp name while downloading files (#99)
Should help with #98
2025-03-20 00:56:54 -04:00
CaliBrainandmik593 3a92c5de78 CF BYPASS (#24)
The Calibre dependency was due to the script testing for validity of the
downloaded file, as often they would be corrupted from aa. But CWA is
already doing that, so we are just having redundant code here.

For the cloudflarebypasser, I basically run my own version now, instead
of depending on an external library, this way we have better control for
debugging and on the docker image.

Fixes #18, #33, #27, #48, #65, #78, #86, #88, #89

---------

Co-authored-by: mik593 <91991279+mik593@users.noreply.github.com>
2025-03-16 02:25:15 -04:00
mik593 7f56c6b832 feat: support search filters (#55)
Still a WIP but an initial attempt of search filters. #7 

Currently supporting: 

- ISBN
- Author
- Title
- Language
- Sort
- Content


first attempt at some sort of UI for it 👇

![image](https://github.com/user-attachments/assets/7237ae96-7e97-4db0-98da-06c3171aca3b)

smaller/mobile

![image](https://github.com/user-attachments/assets/ba20de0e-deb1-4aa1-9c5f-27cf473670e6)
2025-01-22 16:51:06 -05:00
CaliBrain b534664534 Fix status not getting removed properly (#51) 2025-01-10 12:57:42 -05:00
CaliBrain b8a7247538 [FIX] Refactor code to fix typing (#23)
This also fixes some bug with the CF bypasser and the file checker
2024-12-22 22:11:35 -05:00
CaliBrain 7597054649 Fix #20 : Network error when using alternative download streams (#22) 2024-12-22 19:25:03 -05:00
CaliBrain 18b146af64 Innitial Release 2024-12-16 22:48:26 +00:00