Skip to content

[Add] My Anime List input plugin#1629

Merged
liiight merged 5 commits intoFlexget:developfrom
LynxyssCZ:develop
Jan 15, 2017
Merged

[Add] My Anime List input plugin#1629
liiight merged 5 commits intoFlexget:developfrom
LynxyssCZ:develop

Conversation

@LynxyssCZ
Copy link
Copy Markdown
Contributor

Motivation for changes:

The input plugin for My Anime List was missing, and other alternatives felt lacking or non-practical

Detailed changes:

  • Added My Anime List input plugin for use with configure_series

Plugin usage:

    configure_series:
      from:
        my_anime_list:
          username: <<username>>
          status:
            - watching
            - plan_to_watch

'type': 'object',
'properties': {
'username': {'type': 'string'},
'status': one_or_more({'type': 'string', 'enum': ['watching', 'completed', 'on_hold', 'dropped', 'plan_to_watch']}),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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']})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ANIME_TYPE.values()

entries = []
parameters = {'u': config['username'], 'status': 'all', 'type': 'anime'}

if config.has_key('status'):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use config.get('status'). has_key is not supported by py3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This better be split to two try except blocks


my_tags = []
alternate_names = []
isExact = False
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid camel case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just my javascripts habits resurfacing.


@event('plugin.register')
def register_plugin():
plugin.register(MyAnimeList, 'my_anime_list', api_ver=2)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the interfaces key here. Look in other plugins.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my_anime_list feels too long. Maybe remove underscores or just mal?

Copy link
Copy Markdown
Contributor

@cvium cvium Jan 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be updated with config data? You just set values here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@liiight liiight merged commit 527f39b into Flexget:develop Jan 15, 2017
@liiight
Copy link
Copy Markdown
Member

liiight commented Jan 15, 2017

Thanks! Care to update wiki?

@LynxyssCZ
Copy link
Copy Markdown
Contributor Author

I made a small wiki entry for basic usage.

liiight pushed a commit that referenced this pull request Jan 20, 2017
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants