[Add] My Anime List input plugin#1629
[Add] My Anime List input plugin#1629liiight merged 5 commits intoFlexget:developfrom LynxyssCZ:develop
Conversation
| 'type': 'object', | ||
| 'properties': { | ||
| 'username': {'type': 'string'}, | ||
| 'status': one_or_more({'type': 'string', 'enum': ['watching', 'completed', 'on_hold', 'dropped', 'plan_to_watch']}), |
There was a problem hiding this comment.
You could iterate over STATUS.values()
| 'properties': { | ||
| 'username': {'type': 'string'}, | ||
| 'status': one_or_more({'type': 'string', 'enum': ['watching', 'completed', 'on_hold', 'dropped', 'plan_to_watch']}), | ||
| 'type': one_or_more({'type': 'string', 'enum': ['series', 'ova', 'movie', 'ona']}) |
| entries = [] | ||
| parameters = {'u': config['username'], 'status': 'all', 'type': 'anime'} | ||
|
|
||
| if config.has_key('status'): |
There was a problem hiding this comment.
Use config.get('status'). has_key is not supported by py3
There was a problem hiding this comment.
Oh yeah, good point I totally didn't notice this part, my bad.
| list_items = tree.findall('anime') | ||
| except RequestException as e: | ||
| raise plugin.PluginError('Error finding list on url: {url}'.format(url=e.request.url)) | ||
| except ET.ParseError: |
There was a problem hiding this comment.
This better be split to two try except blocks
|
|
||
| my_tags = [] | ||
| alternate_names = [] | ||
| isExact = False |
There was a problem hiding this comment.
Just my javascripts habits resurfacing.
|
|
||
| @event('plugin.register') | ||
| def register_plugin(): | ||
| plugin.register(MyAnimeList, 'my_anime_list', api_ver=2) |
There was a problem hiding this comment.
Add the interfaces key here. Look in other plugins.
There was a problem hiding this comment.
my_anime_list feels too long. Maybe remove underscores or just mal?
There was a problem hiding this comment.
mal is a poor choice. Also doesn't look like a list plugin, so I'm not sure why interfaces should be added. The site is just called MyAnimeList.
There was a problem hiding this comment.
I gratefully stole general structure from kitsu.py since this is my first plugin. That one didn't have any interfaces in the statement, so I wasn't exactly sure about what to do with them, since I was not able to find any docs for this.
There was a problem hiding this comment.
Also, to be perfectly honest, my_anime_list feels perfectly fine to me.
| @cached('my_anime_list', persist='2 hours') | ||
| def on_task_input(self, task, config): | ||
| entries = [] | ||
| parameters = {'u': config['username'], 'status': 'all', 'type': 'anime'} |
There was a problem hiding this comment.
Shouldn't this be updated with config data? You just set values here
There was a problem hiding this comment.
Oh yeah, this part of their API is a bit stupid, since it does not do anything with the status parameter. I can technically exclude it, it just got left them there to be safe.
| entries = [] | ||
| parameters = {'u': config['username'], 'status': 'all', 'type': 'anime'} | ||
|
|
||
| selected_status = config.get('status', STATUS.values()) |
There was a problem hiding this comment.
You need to verify its a list or convert it into one since you assume it's a list later on.
| parameters = {'u': config['username'], 'status': 'all', 'type': 'anime'} | ||
|
|
||
| selected_status = config.get('status', STATUS.values()) | ||
| selected_types = config.get('type', ANIME_TYPE.values()) |
|
Thanks! Care to update wiki? |
|
I made a small wiki entry for basic usage. |
* v2.9.0 * Prepare v2.9.1.dev * Support searching for titles which contain quotes (#1618) [change] piratebay: replacing single quotes with spaces as their search engine doesn't like them * [added] subliminal: added support for .rar files * NPO parameter has changed for only showing full episodes (#1616) [change] npo_watchlist: updated to only grab broadcasts; previously it also grabbed trailers * [fix] est_released_movies: Fixed crash with movie_year of None (#1602) * [added] convert_magnet: new config option to fail entries if conversion fails, closes #1619 * Don't evaluate 'if' statements on un-needed phases for simple accept/reject actions. * v2.9.1 * Prepare v2.9.2.dev * relplace Safe by zxcvbn for password strenght testing (#1620) * [fix] sickbeard: fixed a typo that caused a crash when 'include_data: yes', fixes #1623 * v2.9.2 * Prepare v2.9.3.dev * Support for 2160p (#1625) [added] quality: added support for 2160p * [Fix][UI] improves version checking, fixes #1617 * [Fix][UI] Removing a show when in search mode, keeps the UI in search page #1559 * [Change][UI] Username is autofilled on login page * Removed incorrect files * v2.9.3 * Prepare v2.9.4.dev * [Add][UI] Config section allows editing of variables * Added warning regarding variables configuration * v2.9.4 * Prepare v2.9.5.dev * added support for Exx identifier in series parser (#1622) [change] series parser: added support for Exx identifier * [Add] My Anime List input plugin (#1629) * [Add] My Anime List input plugin * Review changes * Python 3 .values =/= list * Converting config variables to lists * Correct list conversion * v2.9.5 * Prepare v2.9.6.dev * Update app.py * Added base_url to webserver config * Made `base_url` setting a little looser so that `/` is not mandatory * Update url-interceptor.service.js * Check base_url exists before prepending / * Make sure base_url doesn't end with / * fix api in UI * Fix log page * Removed leftover prints * Fix series and movie posters not loading correctly
Motivation for changes:
The input plugin for My Anime List was missing, and other alternatives felt lacking or non-practical
Detailed changes:
Plugin usage: