Skip to content
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

MyAnimeList Importer #734

Merged

Conversation

toyhammered
Copy link
Member

reference #710 (need to still add manga)

@@ -0,0 +1,43 @@
module DataImport
class MyAnimeList
MDL_HOST = "https://hbv3-mal-api.herokuapp.com/2.1" # 2.1 is the api version, MAYBE add graceful decay to check from v1 if it can't find?
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need a decay. We should be very clear which version we need, and since we have our own instance this isn't a problem. If anything, this number should only ever increase.

@NuckChorris
Copy link
Member

Great start

toyhammered added a commit to toyhammered/hummingbird that referenced this pull request Jul 4, 2016
end

def get_media(external_id) # anime/1234 or manga/1234
media = Mapping.lookup('myanimelist', external_id) || external_id.split('/').first.classify.constantize.new # should return Anime.new or Manga.new
Copy link
Member

Choose a reason for hiding this comment

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

This line is a bit long. I'd suggest splitting it into three: one to lookup the Mapping, one to identify the class, and one to create the new instance with a ||=

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do!

@toyhammered toyhammered force-pushed the my-anime-list-importer branch from 7faeee4 to a7d7919 Compare July 6, 2016 05:06
toyhammered added a commit to toyhammered/hummingbird that referenced this pull request Jul 6, 2016
end
end


Choose a reason for hiding this comment

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

Extra blank line detected.
Extra empty line detected at block body end.

@toyhammered toyhammered force-pushed the my-anime-list-importer branch from caebfaf to 1dbc9d5 Compare July 6, 2016 21:48
next unless node.text?
t = node.content.split(/: ?/).map { |x| x.split(' ') }
if t.length >= 2
if t[0].length <= 3 && t[1].length <= 20

Choose a reason for hiding this comment

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

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. (https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier)

Copy link
Member Author

Choose a reason for hiding this comment

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

not even touching that @NuckChorris you can deal with it

Copy link
Member

Choose a reason for hiding this comment

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

That's fair, I can handle these

# manga
when 'manga' then :manga
when 'novel' then :novel
when 'manuha' then :manuha
Copy link
Member

Choose a reason for hiding this comment

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

It's manhua not manuha. Also is there a reason why you don't just use else data['type'].downcase.to_sym for most of these cases?

Copy link
Member Author

@toyhammered toyhammered Jul 7, 2016

Choose a reason for hiding this comment

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

oops.. sorry bout that you are correct (actually when have you ever been wrong?)

Actually this is god damn brilliant lol.

@NuckChorris
Copy link
Member

@NuckChorris NuckChorris merged commit 52e2096 into hummingbird-me:the-future Jul 7, 2016
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