medusa plugin#2282
Conversation
flexget/plugins/input/medusa.py
Outdated
| ) | ||
|
|
||
| try: | ||
| api_key = json.loads(task.requests.post( |
There was a problem hiding this comment.
you can use native requests formatting here:
| api_key = json.loads(task.requests.post( | |
| api_key = task.requests.post('{}/authenticate'.format(base_url), json=body_auth, headers=self.headers).json() |
flexget/plugins/input/medusa.py
Outdated
| authorization='Bearer ' + api_key | ||
| ) | ||
|
|
||
| series = json.loads(task.requests.get( |
There was a problem hiding this comment.
look above for optimal request syntax. Also, ideally pass url param via its own dict:
| series = json.loads(task.requests.get( | |
| params = { | |
| 'limit': 1000 | |
| } | |
| series = task.requests.get('{}/series'.format(base_url), params=params).json() |
flexget/plugins/input/medusa.py
Outdated
| schema = { | ||
| 'type': 'object', | ||
| 'properties': { | ||
| 'base_url': {'type': 'string'}, |
There was a problem hiding this comment.
you can set expected format to uri:
| 'base_url': {'type': 'string'}, | |
| 'base_url': {'type': 'string', 'format': 'uri'}, |
flexget/plugins/input/medusa.py
Outdated
|
|
||
| entries = [] | ||
| for show in series: | ||
| log.debug('processing show: {}'.format(show)) |
There was a problem hiding this comment.
let logger do its own string interpolation:
| log.debug('processing show: {}'.format(show)) | |
| log.debug('processing show: %s', show) |
|
The requested changes have been made, Thank you for those observations |
flexget/plugins/input/medusa.py
Outdated
| 'additionalProperties': False | ||
| } | ||
|
|
||
| headers = { |
There was a problem hiding this comment.
this is redundant, as it is implicitly added when you use the json keyword when sending requests
flexget/plugins/input/medusa.py
Outdated
| log.debug('processing show: %s', show) | ||
| if (show['config']['paused'] and config.get('only_monitored')) or \ | ||
| show['status'] == 'Ended' and not config.get('include_ended'): | ||
| continue |
There was a problem hiding this comment.
maybe add a debug message here?
|
Debug message added and remove the default headers |
|
Thanks! Can you please update the wiki? |
|
Yes, of course, |
Motivation for changes:
I was updating myinfrastructure with medusa, and i tried to connect with flexget via sickbear plugin, but the api of sickbear of medusa was outdated and i create a new plugin specific for medusa
Detailed changes:
I created the plugin based on old sickbear plugin, i reformat and created all the rest requests of that
Implemented feature requests:
Config usage if relevant (new plugin or updated schema):
Log and/or tests output (preferably both):
To Do:
It's recomendable to detect qualities in medusa, now i only can choose for only_monitories and ended series