ChrisAlderson / butter-provider-anime

A Butter provider for anime shows
MIT License
2 stars 3 forks source link

formatFetch() & formatDetail() differences #2

Closed user440 closed 6 years ago

user440 commented 6 years ago

I have noticed that those 2 functions are significantly different, FormatFetch() is missing a lot of keys like runtime, episodes...... and all after which you have added into formatDetail(). The same issue appears also into "butter-provider-tvshows".

Additionally into "butter-provider-anime" there are some differences in those IFs within formatFetch() function comparing to IFs from formatDetail().

I have seen that you have introduced formatFetch() and formatDetail() because of random issue. I think that there could be easier solution specially because those 2 functions deal with the same object format (probably?) and doing the same thing. Well, previous format() function expected an array type argument (because of .foreach is an array function) but "GET /random/movie" was sending an object. So, I think that this random issue could be solved just by checking format() function argument type and in case if function argument type is not an array then convert it into an array while keeping the rest of the function the same. So there would be no need for 2 procedures doing the same thing and no maintaining 2 procedures.

ChrisAlderson commented 6 years ago

This is done intentionally, the class extends from butter-provider. Their documentation (some of which I have written, full disclosure) says a butter-provider needs to implement the fetch and detail methods (plus some others).

The fetch method only needs to get the basic data. This is because we don't want to stress out the server we are getting the data from by requesting unnecessary data. In Butter this will result in a list of thumbnails.

The detail method gets called in Butter when you click on one of those thumbnails. This is when you want more data to display like a synopsis and the links to stream.

So this has nothing to do with the random method.

ChrisAlderson commented 6 years ago

Closing this issue, because of a lack of response.