-
Notifications
You must be signed in to change notification settings - Fork 18
feat: add remote path mapping for download clients #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
BlackDark
wants to merge
2
commits into
main
Choose a base branch
from
feat/remotepath
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reviewer's GuideAdds support for synchronizing remote path mappings for download clients across all *Arr types, wiring it into the main pipeline and configuration system, while refactoring unified client usage to expose specific clients directly and extending clients/tests/docs accordingly. Sequence diagram for remote path mappings sync in main pipelinesequenceDiagram
participant Pipeline as pipeline
participant Syncer as syncRemotePaths
participant Env as getEnvs
participant UC as getSpecificClient
participant Client as ArrClient
participant Server as ArrServer
Pipeline->>Syncer: syncRemotePaths(arrType, mergedConfigInstance, serverCache)
Syncer->>Syncer: validateRemotePathConfig(remote_paths)
Syncer->>UC: getSpecificClient<ArrClient>()
UC-->>Syncer: Concrete client (RadarrClient|SonarrClient|...)
Syncer->>Client: getRemotePathMappings()
Client->>Server: vXRemotepathmappingList
Server-->>Client: RemotePathMappingResource[]
Client-->>Syncer: serverMappings
Syncer->>Syncer: calculateDiff(configRemotePaths, serverMappings)
Syncer->>Env: getEnvs()
Env-->>Syncer: { DRY_RUN }
alt DRY_RUN is true
Syncer->>Syncer: compute counts (create, update, delete)
Syncer-->>Pipeline: RemotePathSyncResult (no API mutations)
else DRY_RUN is false
loop For each config in diff.toCreate
Syncer->>Client: createRemotePathMapping(mapping)
Client->>Server: vXRemotepathmappingCreate
alt Server reports already exists
Client-->>Syncer: error "RemotePath already exists"
Syncer->>Syncer: find existing mapping by host+remotePath
Syncer->>Client: updateRemotePathMapping(id, mapping)
Client->>Server: vXRemotepathmappingUpdate
else Created successfully
Client-->>Syncer: created mapping
end
end
loop For each item in diff.toUpdate
Syncer->>Client: updateRemotePathMapping(id, mapping)
Client->>Server: vXRemotepathmappingUpdate
Server-->>Client: updated mapping
Client-->>Syncer: updated mapping
end
loop For each item in diff.toDelete
Syncer->>Client: deleteRemotePathMapping(id)
Client->>Server: vXRemotepathmappingDelete
Server-->>Client: 204
Client-->>Syncer: success
end
Syncer-->>Pipeline: RemotePathSyncResult(created, updated, deleted, unchanged)
end
Updated class diagram for unified client and remote path client methodsclassDiagram
class UnifiedClient {
+api IArrClient
+UnifiedClient(type ArrType, baseUrl string, apiKey string)
+getLanguages()
+getQualityProfiles()
+createQualityProfile(profile any)
+updateQualityProfile(id string, profile any)
+deleteQualityProfile(id string)
+getCustomFormats()
+createCustomFormat(format any)
+updateCustomFormat(id string, format any)
+deleteCustomFormat(id string)
}
class RadarrClient {
+RadarrClient(baseUrl string, apiKey string)
+getDownloadClientConfig() Promise~any~
+updateDownloadClientConfig(id string, config any) Promise~any~
+getRemotePathMappings() Promise~RemotePathMappingResource[]~
+createRemotePathMapping(mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+updateRemotePathMapping(id string, mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+deleteRemotePathMapping(id string) Promise~void~
}
class SonarrClient {
+SonarrClient(baseUrl string, apiKey string)
+getDownloadClientConfig() Promise~any~
+updateDownloadClientConfig(id string, config any) Promise~any~
+getRemotePathMappings() Promise~RemotePathMappingResource[]~
+createRemotePathMapping(mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+updateRemotePathMapping(id string, mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+deleteRemotePathMapping(id string) Promise~void~
}
class LidarrClient {
+LidarrClient(baseUrl string, apiKey string)
+getDownloadClientConfig() Promise~any~
+updateDownloadClientConfig(id string, config any) Promise~any~
+getRemotePathMappings() Promise~RemotePathMappingResource[]~
+createRemotePathMapping(mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+updateRemotePathMapping(id string, mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+deleteRemotePathMapping(id string) Promise~void~
}
class ReadarrClient {
+ReadarrClient(baseUrl string, apiKey string)
+getDownloadClientConfig() Promise~any~
+updateDownloadClientConfig(id string, config any) Promise~any~
+getRemotePathMappings() Promise~RemotePathMappingResource[]~
+createRemotePathMapping(mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+updateRemotePathMapping(id string, mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+deleteRemotePathMapping(id string) Promise~void~
}
class WhisparrClient {
+WhisparrClient(baseUrl string, apiKey string)
+getDownloadClientConfig() Promise~any~
+updateDownloadClientConfig(id string, config any) Promise~any~
+getRemotePathMappings() Promise~RemotePathMappingResource[]~
+createRemotePathMapping(mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+updateRemotePathMapping(id string, mapping RemotePathMappingResource) Promise~RemotePathMappingResource~
+deleteRemotePathMapping(id string) Promise~void~
}
class getUnifiedClient {
+getUnifiedClient() UnifiedClient
}
class getSpecificClientFn {
+getSpecificClient~T~() T
}
class RemotePathMappingResource {
+id number
+host string
+remotePath string
+localPath string
}
class InputConfigRemotePath {
+host string
+remote_path string
+local_path string
}
class RemotePathSyncResult {
+created number
+updated number
+deleted number
+unchanged number
+arrType ArrType
}
UnifiedClient --> IArrClient
getUnifiedClient ..> UnifiedClient
getSpecificClientFn ..> RadarrClient
getSpecificClientFn ..> SonarrClient
getSpecificClientFn ..> LidarrClient
getSpecificClientFn ..> ReadarrClient
getSpecificClientFn ..> WhisparrClient
RadarrClient ..> RemotePathMappingResource
SonarrClient ..> RemotePathMappingResource
LidarrClient ..> RemotePathMappingResource
ReadarrClient ..> RemotePathMappingResource
WhisparrClient ..> RemotePathMappingResource
InputConfigRemotePath ..> RemotePathMappingResource
RemotePathSyncResult ..> ArrType
Flow diagram for remote path diff calculation and sync decisionsflowchart TD
A["Start syncRemotePaths"] --> B["Read remote_paths and delete_unmanaged_remote_paths from config"]
B --> C{remote_paths is undefined?}
C -->|Yes| D["Skip management and return zero counts"]
C -->|No| E{remote_paths length is 0 and delete_unmanaged_remote_paths is false?}
E -->|Yes| D
E -->|No| F["validateRemotePathConfig(remote_paths)"]
F --> G["Fetch serverMappings via client.getRemotePathMappings"]
G --> H["calculateDiff(configs, serverMappings)"]
H --> I{Any create, update or delete?}
I -->|No| J["Log already up to date, return unchanged count"]
I -->|Yes| K{DRY_RUN is true?}
K -->|Yes| L["Log planned create/update/delete counts"]
L --> M["Return RemotePathSyncResult with counts"]
K -->|No| N["Apply creates, updates, deletes"]
N --> O["On create error: check for 'already exists' and fallback to update"]
O --> P["Accumulate created, updated, deleted counts"]
P --> Q["Log success summary"]
Q --> M
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Doc preview deployed to: https://363f788b.configarr-preview.pages.dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Add configuration-driven remote path mapping synchronization for download clients across all supported *Arr applications, including validation, diffing, and dry-run support, while exposing new client APIs and wiring them into the main sync pipeline.
New Features:
Enhancements:
Documentation:
Tests: