kupiakos / LapisMirror

Mirrors images from various sites, and exports them to mirrors like imgur. Plugin-based.
MIT License
21 stars 6 forks source link

Plugin: e621 / e926 #29

Closed Shugabuga closed 8 years ago

Shugabuga commented 8 years ago

This pull requests resolves issue #20 by adding a plugin to add support for e621 and e926, which are both booru-based sites for furries. It does the following:

This plugin is active on /u/TheMirrorPool and can be seen in action here.

kupiakos commented 8 years ago

Sorry to be a hardass, but life's a lot easier if PEP 8 is followed. If you don't have an easy way to check this (you should if you plan to develop more Python), you can use this to check online.

In addition, I plan to enforce testing in the future, but that's not until version 2 (still in progress, sigh).

Generally, one should also try to use the imperative case for git commits. You can also add Resolves #20 in the commit message to automatically close the issue when it's merged.

Lastly, don't forget to add e926/e621 as entries in the README.

Shugabuga commented 8 years ago

It's fine. I forgot some lines I added for debugging and I'm just not the most familiar with the PEP 8 code styling rules. I'll add the commits to fix these things over time (give me a week or so, I am busy at the moment).

kupiakos commented 8 years ago

Might want to pull from the most recent version of the repository.

Shugabuga commented 8 years ago

So I just pushed another commit that made everything PEP8-compliant (besides the character limit) and added the required README entries (and I put the Derpibooru one I forgot from my last commit).

kupiakos commented 8 years ago

The Derpibooru was added in 1c0f7d6 by myself.

Shugabuga commented 8 years ago

I pushed the commit for documentation's sake, but don't merge it yet. I want to do some testing and possibly change a few more things so it uses str.format. Thanks for your help, by the way!

I'll name my last commit "Resolves #20" when I think everything is done.

kupiakos commented 8 years ago

Glad to help. I figured setting the bar a little higher for the merge would help everybody involved, even if it may take a little more time. It's always good to learn!

Shugabuga commented 8 years ago

I've just tested the bot with the current version of the plugin and it works!

Ready to merge if it's fine with you.

kupiakos commented 8 years ago

Does it also work with e621 posts that aren't in e926? It looks like it may only use the e926 API, but I'm not sure how intertwined the two are.

Shugabuga commented 8 years ago

e621 and e926 share the same API, and my testing suggests that the e926 API will work on e621-exclusive images. In fact, the API documentation on e926 refers to the API as if it were e621. Likely similar to sfw.furaffinity.net: same site, same database, different filtering options.

So in short, they are the same API, so there should be no issues.

Also, kinda of a sidenote: I choose to refer to e621 as e926 in the mirroring text because r/zootopia actually doesn't permit posting from e621 as it is extremely NSFW.

kupiakos commented 8 years ago

Can you have it so it refers to whichever site was posted? So if someone posted on e621 (which in theory LapisMirror should work directly with), it references e621 instead of e926?

Shugabuga commented 8 years ago

I can give that a shot, yes. Give me a bit of time, though.

Shugabuga commented 8 years ago

That didn't take long. It now says e621 or e926, depending on where the link you posted is from. Tested and works!

Also changed the endpoint a bit, just in case.

kupiakos commented 8 years ago

It's all in. Good job!

Shugabuga commented 8 years ago

You remember when I said I have a way to trace the original post URL from a CDN URL?

Well, I did it again (somehow).

Supposedly e926 uses an MD5sum that can be reversed by their API to get the original post, and this can be useful for getting the original post from the CDN image, which allows us to use the API normally from there.

It looks like I'll being doing an update on this plugin too. I'll just wrap them up into one big PR since the feature set update parallels each other (literally the same update but with two different websites and two different API endpoints).

Expect an update to take a week or two, I am busy with my studies too. 😃

kupiakos commented 8 years ago

I'd prefer two separate PRs if that's OK.

On Sun, Sep 11, 2016 at 8:58 PM, Shugabuga notifications@github.com wrote:

You remember when I said I have a way to trace the original post URL from a CDN URL?

Well, I did it again (somehow).

Supposedly e926 uses an MD5sum that can be reversed by their API to get the original post, and this can be useful for getting the original post from the CDN image, which allows us to use the API normally from there.

It looks like I'll being doing an update on this plugin too. I'll just wrap them up into one big PR since the feature set update parallels each other (literally the same update but with two different websites and two different API endpoints).

Expect an update to take a week or two, I am busy with my studies too. 😃

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/kupiakos/LapisMirror/pull/29#issuecomment-246232775, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKAoF4UoR1kaE7iRw9zO4yM0vvrbJDJks5qpL_BgaJpZM4JkwqK .

Shugabuga commented 8 years ago

That'll be fine. Will do!

Shugabuga commented 8 years ago

PR #35 is done!