Conversation
…ing filters, when relevant. Also refactor. Closes #2041
| url = '{}:{}/api/{}'.format(base_url, port, endpoint) | ||
| headers = {'X-Api-Key': self.config['api_key']} | ||
| if term: | ||
| url += '?term={}'.format(term) |
There was a problem hiding this comment.
Two different ways of concatenating strings in the same line of code. Looks a bit odd, but I suppose it's irrelevant.
There was a problem hiding this comment.
I had no choice with that. I had to build url like that since the param can contain :which requests escapes and sonarr doesn't like
There was a problem hiding this comment.
I just now get what you meant. yeah, it's kinda odd but i think it's clear, so...
flexget/plugins/list/sonarr_list.py
Outdated
| else: | ||
| raise plugin.PluginError('Invalid response received from Sonarr: %s' % response.content) | ||
| rsp = requests.request(method, url, headers=headers, json=data) | ||
| rsp.raise_for_status() |
There was a problem hiding this comment.
There was a problem hiding this comment.
Dunno. Since I didn't need to use our custom session features I saw no reason using our own implementation
There was a problem hiding this comment.
It's just a wrapper. I'd rather we were consistent on the matter. You can just use this https://github.com/Flexget/Flexget/blob/develop/flexget/utils/requests.py#L253
flexget/plugins/list/sonarr_list.py
Outdated
| if show['status'] == 'ended' and not self.config.get('include_ended'): | ||
| continue | ||
| if self.config.get('include_data') and profiles_json: # Check if to retrieve quality & path | ||
| if profiles: # Check if to retrieve quality & path |
There was a problem hiding this comment.
Why not put the loop here instead?
flexget/plugins/list/sonarr_list.py
Outdated
| else: | ||
| entry['configure_series_quality'] = fg_qualities | ||
| if path: | ||
| entry['configure_series_path'] = path |
There was a problem hiding this comment.
Why not just put show.get('path') here?
Motivation for changes:
sonarr_list code was old and sucky. Also a bugfix
Detailed changes:
base_urldefault to'http://localhostand made it not requiredAddressed issues: