openam / calibrephp

Calibre HTML and OPDS web server based on CakePHP
http://openam.github.io/calibrephp
MIT License
39 stars 14 forks source link

Enhancement Request: Add own links to Share #9

Open ShadowEO opened 9 years ago

ShadowEO commented 9 years ago

I have an enhancement request and a question about the book view component.

My enhancement request is that I'd like to add an extra action to either the share or download buttons, the reasoning is below in my question as well.

I'm working on a separate webapp that uses Google Apps to push a ePub to Google Play Books (or at least I hope it will.)

However I'm not sure where I can add the button at. I was going to create a quick hack to the display function for downloads however I'm not sure how one would go about doing so (I'm looking through the code right now for places I can stick this link in.)

Basically what I believe would work would be a dirty hack, my application receives the book number from CalibrePHP and then file_get_contents() the download link, it then uploads it to the user's GDrive account and from there to Google Play Books. Would I be able to use file_get_contents on the links generated to do so?

joserojas1 commented 9 years ago

http://www.9lessons.info/2014/06/web-pdf-viewer.html

ShadowEO commented 9 years ago

I've found what I needed. I have created a small webapp that uses CalibrePHP to push ePubs and PDFs to Google Play Books. It's more of a working proof-of-concept than a finished idea, however I should be able to make it available at some point soon along with the patches for the files in CalibrePHP that I changed to link it in. I have one more annoying bug to squash which is a problem with redirecting or showing output after logging into Google. It does not store any authentication information except in local cookies as well.

You can find the repository for this here: https://bitbucket.org/ShadowEO/googlesync

I'll be working on getting the patch for the menu up as soon as I can.

As for Joserojas1, My initial request was how to add links to either the download or share menus so that I could add Google Play Books cloudloading integration.

joserojas1 commented 9 years ago

Greetings ShadowEO did it include the option to download or view shared books with google play book ?

ShadowEO commented 9 years ago

I added a link into the helper page that generates the download button links. That sufficed for me and I was able to add a link to my script that uploads the epub or PDF to Google Drive and from there to Google Play. I had to reformat the device that had CalibrePHP on it so I can't currently work on adding it for a pull request but once I'm able to work on it again I'd be more than happy to try and add the functionality straight into CalibrePHP but it may be a while, I haven't had time to do much and I don't know the innards of the CakePHP development framework yet.

My solution is still a little finicky on the first login to Google but after the first login it seems to work fine. I can't seem to get that redirect after the login to work well, it either redirects to a blank page for uploading or back to the previous CalibrePHP page (which is the intended behavior).

I'm replying using the email right now, but I think I put a link to my repo which I believe has a small bit of instructions for adding a link to the download button, but it's been a while so I'm not entirely sure. This issue can be closed whenever the repo owner deems necessary as my original problem is resolved.

openam commented 9 years ago

@ShadowEO I've been thinking of making my library a little more locked down, i.e. requiring login. This would work great with the Google oauth, and then you could have these options to share the book to your google play books.