-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
torznab profiles framework #371
base: main
Are you sure you want to change the base?
Conversation
internal/torznab/config.go
Outdated
|
||
type Config struct { | ||
Hostname *string | ||
Profiles map[string]map[string]string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the profile be strongly typed instead of just map[string]string
? Also can hostname be part of the profile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relates to next point. Config framework does not work well with strongly typed structure. Also need a reasonable way to feed back to user that configuration is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well throughout the rest of the application, let me know if you have a specific issue with it
e3bef16
to
093620e
Compare
internal/torznab/request.go
Outdated
Attrs []string | ||
Extended bool | ||
Limit model.NullUint | ||
Offset model.NullUint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only add Profile model.NullString
to this struct, and handle the rest in the adapter
package instead of in httpserver
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just passed through theProfile
that has been selected by gin route. have used profile for controlling logging in httpserver
With logging have assessed:
sonarr - interactive and quick search
INFO httpserver/httpserver.go:83 [192.168.1.202] t=tvsearch&extended=1&cat=5030,5040,5045,5000&imdbid=<<redact>>&season=1&ep=7&limit=100&offset=0
INFO httpserver/httpserver.go:83 [192.168.1.202] t=tvsearch&extended=1&cat=5030,5040,5045,5000&season=1&ep=7&q=<<redact>>&limit=100&offset=0
sonarr polling
INFO httpserver/httpserver.go:83 [192.168.1.202] t=search&extended=1&cat=5030,5040,5045,5000&limit=100&offset=0
radarr - interactive and quick search
INFO httpserver/httpserver.go:83 [192.168.1.202] t=movie&extended=1&cat=2030,2040,2045,2060,2000&tmdbid=<<redact>>&imdbid=<<redact>>&limit=100&offset=0
all by will by order by published_at
with exception of:
INFO httpserver/httpserver.go:83 [192.168.1.202] t=tvsearch&extended=1&cat=5030,5040,5045,5000&season=1&ep=7&q=<<redact>>&limit=100&offset=0
This can be overridden by DisableOrderByRelevance
I have not managed to generate a scenario that reproduces problem noted in issue #185 Addition of logging will help if it continues to be an problem.
Upfront admission - this addresses 2 issues and 1 PR. (Failed on objective a PR should only address one issue). #185 and #311 It will also replace PR 308. I will also close PR 369. Incorrect leachers will be a self contained PR. Links to permalinks from arrs I expect to do after this PR has been merged. (Will benefit from configuration and settings capability in this framework PR). Similarly #349 will benefit from this framework capability and hence on hold until this PR is merged.
This PR enables torznab profiles to be defined using standard bitmagnet configuration framework. Using
config.yml
profiles can be defined:The existing torznab end point has been retained. For example:
http://bitmagnet:3333/torznab/api
. It uses a default profile:An additional end point has been added.
/torznabv2/:profile/*any
. A new top level path is required due to to gin limitations that does not allowtorznab/*any
and/torznab/:profile/*any
to co-exist. It has been considered important to maintain backwards compatibility so all users are not mandated to update their URLs on release.The profiles are lazy validated on startup. (Hence separation of
Config
andSettings
structs) If a profile is defined that requests sorting by an unsupported column or using a sort order that is invalid, it will fail on startup with an appropriate log. For transparency the setup profiles (including default profile) are logged on successful validation. Within this process default profile is created if not defined in configuration.The actual changes to existing code are quite limited. Have done a minor re-factor of
httpserver.go
to better support multiple routes.