Add comprehensive PR description template

This commit is contained in:
Claude 2025-11-13 00:38:48 +00:00
parent 6e4eb7f5ec
commit 3180263f3c
No known key found for this signature in database

162
PULL_REQUEST_TEMPLATE.md Normal file
View file

@ -0,0 +1,162 @@
# Add Pre-Import Feature for qBittorrent Download Client
## Summary
Adds a "Pre-Import" option to the qBittorrent download client that enables downloading torrents directly to their final movie destination folder, eliminating the need to move files between download and media directories.
## Motivation
### The Problem
Currently, Radarr follows this workflow:
1. Download torrent to download directory (e.g., `~/downloads/qbittorrent/complete/`)
2. After completion, move file to media library (e.g., `~/movies/My Movie (2024)/`)
When the download directory and media library are on different physical drives, this causes:
- **Unnecessary I/O operations**: Full file copy + delete instead of a simple move
- **Disk wear**: Excessive write operations on SSDs
- **Delays**: Large movie files take time to copy between drives
- **Wasted space**: Temporary double storage during the move
### The Solution
The Pre-Import feature leverages qBittorrent's `savepath` parameter to download directly to the final destination:
1. Download torrent directly to `~/movies/My Movie (2024)/`
2. No move operation needed
3. Torrent seeds immediately from final location
## Changes
### Core Implementation
- **QBittorrentSettings.cs**: Added `PreImportToDestination` checkbox setting
- **IQBittorrentProxy**: Extended interface with optional `savePath` parameter
- **QBittorrentProxyV1 & V2**: Implemented `savepath` form parameter support
- **QBittorrent.cs**: Added logic to calculate and pass movie destination path
- **en.json**: Added UI localization strings
### Testing
- **8 comprehensive unit tests** covering:
- Feature enabled/disabled scenarios
- Both magnet links and torrent files
- Edge cases (null movie, null/empty paths)
- Backward compatibility
### Documentation
- Inline code comments explaining feature purpose
- Clear documentation of when `savePath` is set
- Help text in UI explaining requirements and benefits
## Benefits
### Primary Benefits
**Eliminates cross-drive file moves** - No more copying large files between physical drives
**Reduces I/O and disk wear** - Especially beneficial for SSD longevity
**Faster seeding availability** - Torrents seed immediately from final location
**Backward compatible** - Disabled by default, existing behavior unchanged
### Advanced Use Case
When combined with Sequential Download + First and Last First, users can **stream movies while they're still downloading** since the file is already in the media library folder.
## Technical Details
### API Compatibility
- ✅ Works with qBittorrent API v1 (older versions)
- ✅ Works with qBittorrent API v2 (current versions)
- ✅ Uses standard `savepath` parameter supported by qBittorrent
### Safety & Validation
- ✅ Only sets `savepath` when explicitly enabled by user
- ✅ Validates movie path is not null or empty before passing
- ✅ Falls back to normal behavior if movie data is unavailable
- ✅ Maintains null-safety throughout
### Code Quality
- ✅ Follows existing Radarr patterns and conventions
- ✅ Minimal code changes (clean diff)
- ✅ No breaking changes to interfaces
- ✅ Optional parameter maintains backward compatibility
- ✅ Comprehensive unit test coverage
## Usage Instructions
### Setup
1. Navigate to **Settings → Download Clients → qBittorrent**
2. Enable the **"Pre-Import"** checkbox
3. Ensure qBittorrent has write permissions to your movie library folders
### Requirements
- Movie must exist in Radarr's database before downloading
- qBittorrent needs filesystem permissions to create directories in movie library
- Movie root folder must be accessible by qBittorrent
### Optional: Configure qBittorrent
Users can optionally enable **"Append .!qB extension to incomplete files"** in qBittorrent:
- ✅ **With suffix**: Radarr waits for complete download before importing (safer)
- ⚠️ **Without suffix**: Enables streaming while downloading (advanced use case)
## Testing Performed
### Unit Tests
- ✅ All 8 new tests pass
- ✅ Existing qBittorrent tests unaffected
- ✅ Tests verify correct `savePath` behavior in all scenarios
### Manual Testing Checklist
- [ ] Feature disabled: Torrents download to category folder (normal behavior)
- [ ] Feature enabled: Torrents download to movie destination folder
- [ ] Both magnet links and .torrent files work correctly
- [ ] Import process handles files already in correct location
- [ ] Torrents seed successfully from final destination
- [ ] Works with qBittorrent API v1
- [ ] Works with qBittorrent API v2
- [ ] Permissions errors are handled gracefully
## Screenshots
_TODO: Add screenshots of:_
- [ ] New "Pre-Import" checkbox in qBittorrent settings
- [ ] qBittorrent showing download in movie folder
- [ ] Successful import without file move
## Compatibility
- **qBittorrent**: All versions supporting `savepath` parameter (v3.2.0+)
- **Radarr**: v6.x (current develop branch)
- **Operating Systems**: All (Windows, Linux, macOS)
## Migration/Upgrade Notes
- No database migrations required
- No configuration changes needed
- Feature is disabled by default
- Existing downloads are unaffected
## Related Issues
_Link any related GitHub issues here_
## Additional Notes
### For Reviewers
- The implementation is minimal and focused
- All changes are within the qBittorrent client scope
- No changes to core import logic needed (it already handles files in correct location)
- Tests ensure feature doesn't affect existing behavior when disabled
### Future Enhancements (Out of Scope)
- [ ] Add UI warning if qBittorrent lacks permissions
- [ ] Add automatic directory creation test
- [ ] Add setting to automatically enable incomplete file suffix in qBittorrent
---
## Checklist
- [x] Code follows Radarr's coding standards
- [x] Commit messages are meaningful
- [x] Feature branch (not develop)
- [x] Unit tests added
- [x] No linting errors
- [x] Inline documentation added
- [x] UI strings added to localization
- [x] Backward compatible
- [x] One feature per PR
- [ ] Manual testing completed (to be done by maintainers)