baker icon indicating copy to clipboard operation
baker copied to clipboard

Shelf & Multiple Hpub support

Open segundoseis opened this issue 16 years ago • 196 comments

Was: more than one hpub in the same application

As a user would be great to see more than one hpub in the same application. Pre-home with hpub-thumbsnails navigation?

segundoseis avatar Nov 12 '10 18:11 segundoseis

That's a great thing, but I'm wondering if it's within the objectives of this tool, or we should just build the "framework" to be included in any other kind of app.

Still, I'd like to give some sort of basic functionality, so I'd like to hear some feedback about this topic. :)

folletto avatar Nov 12 '10 19:11 folletto

I do not know if I'm complicating this. but I imagine an author who has multiple numbers, it would be interesting not generate more than one app in the appstore. What do you think?

segundoseis avatar Nov 12 '10 19:11 segundoseis

I think that two different situations exist:

  • allowing to read "any" book (iBook)
  • allowing to create multiple numbers

Because those two I think that are similar technically, but very different from the point of view of UI and author. :)

folletto avatar Nov 12 '10 19:11 folletto

truth! mmm .. now I'm thinking that I could download a zipped hpub as @svdgraaf was preparing. :-P

segundoseis avatar Nov 12 '10 19:11 segundoseis

For those who would like to use Baker as a framework for magazines, each hpub would be a publication of the magazine. The same for a product catalog, each hpub would be a different product or section of the overall catalog.

It would be very nice if the Baker Framework could hold multiple hpub packages.

Thank you!!!

MacBoy avatar Jan 10 '11 15:01 MacBoy

I guess the main question is whether BakerFramework can/will evolve (or branch out) to a full-blown BakerReader that can hold any number of books, like iBook, kindle or Stanza.

aldriq avatar Jan 14 '11 20:01 aldriq

Good point aldriq, that's truly something that we are thinking of, the point for that is the effort to reach that point, and what does it mean for the project, because then it would be a Reader with inside the Framework. Completely doable, but still decisions to take and development (a lot) to do. We'll see how the community is going to respond, step by step I think. ;)

folletto avatar Jan 14 '11 20:01 folletto

Now that we can replace the internal "book" with an externally downloaded book, the contents can easily grow and be replaced. The HTML could have an Index page that one can link to different sections. That would be the workaround for having only one book in the app.

We still have a need for multiple books within the app.

Priority for it is lower than other features. For example, the Landscape orientation should be done first. This request has a suitable workaround already.

MacBoy avatar Jan 15 '11 02:01 MacBoy

I understand, it's definitely a medium/log-term decision. I imagine it also depends on how 'fast' the next hpub standard takes to consolidate.

aldriq avatar Jan 15 '11 16:01 aldriq

I'm planning on adding multiple hpub support to my Baker fork for a project I'm working on. Is there any planned movement on this from the Baker team, or planned updates to the hpub specification that might be of interest (the recent addition of a JSON library by @folletto seems to hint at moving toward JSON manifests)? If there are plans to support metadata in manifests that could be quite useful.

Here's what I'm thinking of building:

Keep every hpub downloaded, and the associated book:// url, with a dictionary mapping url to hpub. On a book:// url, check to see if it's already been downloaded by looking it up in the dictionary. If so, just unzip the local hpub, else download as normal.

For some people, that might be enough, but for flexibility I imagine I will also need to add the following capabilities:

  • Showing the user a list of hpubs already downloaded.
  • Allow deleting existing local hpubs
  • Allow updating local hpubs (transparently delete and then redownload if versions don't match).

I see two possible ways to handle the extra use cases:

  1. (Use Javascript/HTML as much as possible) Inject the dictionary of local hpubs into the page as a javascript variable. Either inject into every single page, or maybe only book://local pages, or maybe only a specific file defined in the application (index.html might be a good place). Add support for book://local/path/delete so that books can be deleted. Let users define whatever javascript they'd like to take the local hpub list and work with it. The injection of javascript variables seems kind of hackish, but would allow a lot of customization with just standard html/js.
  2. (Obj-C all the way) Create a new UIView accessible either by a new url like book://shelf, or maybe in place of book://local if preferred - maybe build on top of something like https://github.com/AlanQuatermain/AQGridView to give a pretty interface. This option seems less hackish, but is also a lot less flexible.

Anyone have any thoughts on which version they'd prefer, or things I might not have considered?

therabidbanana avatar May 17 '11 22:05 therabidbanana

Wonderful, let's see. :)

You're absolutely correct about the features needed in order to allow proper "download-and-storage" feature, since if we store something we also need to give a way to manage it (select, delete, update).

For that, I was thinking about a solution that involved the creation of a top navigation bar when you double tap. The bar is going to have a button "All books" and will allow you to tap on it and get a dropdown with all the downloaded book in the issue. From there, you can select one. If it was a downloaded book, on there it will also provide an update feature and a delete feature, even if it's not yet clear to me what's the best way to build it. As before, we probably have to create it, see how it works, and iterate a couple of times to get it right.

But... this doesn't mean that a HTML integration is excluded. We should still give ways from the book itself to work with book urls, but I don't expect the ability to delete/manage them, just to choose them. And for that a JS injected would be fine, let's just coordinate on the correct namespace for it. Probably creating a object called "book" is ideal, and we can append everything to it, so: book.shelf that returns an array of hashes: [{title, url}, {...}, ...].

You also got right the direction we are taking for the manifest. Again, it's more in the experimentation phase right now, so it might be that we scrap it, but we are testing something what uses a "book.json" file inside the hpub book, containing things like title, author, reference URL, pages and sheet options (orientation, size). I hope to be able to share something soon inside the example book that I'm re-building. :)

folletto avatar May 18 '11 13:05 folletto

I had considered adding a navigation bar, but thought it could get kind of cluttered showing even more on double tap, and I wasn't sure how minimalist you were hoping to keep the interface. As long as it's easy to disable, I suppose that's not an issue though.

I like the way the dropdown works in Dropbox (http://c0736882.cdn.cloudfiles.rackspacecloud.com/Dropbox%20iPad%20-%203.png). Something similar to that may be appropriate, but I have no idea how hard it is to program.

One thing I hadn't really considered - it sounds like you're imagining being able to see books in the list that haven't been downloaded yet. How do you imagine letting the application know those books exist - hardcoding the list into the app? Maybe some sort of JSON list or RSS feed pulled off of a server? My original thought was just having the local book be a simple, one-page hardcoded list of book:// urls and releasing an app update every time the list of books (or in our case, magazine issues) changed. That's probably not very scalable though. It might be better if there was a list the application could retrieve from the server - but then we'd need to work out a standardized format to use for listing books - maybe just a JSON array of manifests?

therabidbanana avatar May 18 '11 18:05 therabidbanana

Yes, I'm imagining something similar to that UI. :)

About providing view of books not downloaded yet I wasn't really thinking anything, we might leave it for a future release. I won't put too much work ahead, or we wouldn't get a good feedback from all the users. ;) The one page approach you propose however should work well, and straight out of the box: if a book references another book, it should be easy to download it and add it to the Baker reader, so you could have a "starting" page, and then any other book will be able to trigger the download of other books. :)

Btw, with these features it's probably possible to release a Baker Reader, so... that's something we were thinking of, but with your help it might get here sooner than expected. ;)

folletto avatar May 18 '11 19:05 folletto

I have a beginning implementation working in https://github.com/orangesparkleball/baker/tree/multiple-hpubs.

A navigation bar shows up on double tap with a popover for displaying the list of stored books. The implementation is still a little crude - each hpub must have a unique filename, and updates are not download if the filename is the same. There's also not any way to delete books yet.

therabidbanana avatar May 20 '11 23:05 therabidbanana

Excellent! I don't have time right now to try it out, but I'll do asap with the last master from that tree. :)

folletto avatar May 20 '11 23:05 folletto

Tested :)

Ok, my proposal would be (sorry if I'm going to say even polish things and things you might already have planned):

  • Move the button on the right, like Mail and Dropbox
  • Use the book name instead of baker in the top bar
  • Use the book name instead of the filename in the list (this probably needs the book.json manifest)
  • Polish: fix a bit the animation in order to be coherent with the status bar

I omitted things like delete and update, since we already talked about it. ;)

folletto avatar May 23 '11 22:05 folletto

Was just about to post an update on this front. :)

  • Do you mean putting this button on the left instead of the right? I was thinking we might also add a "Close book" arrow and place it on the left.
  • This is now pulled from the manifest (if one exists).
  • A bit trickier - since currently manifests are zipped inside the hpub, brings up a question below.
  • I was having trouble trying to get them to come in together in a way that didn't look haphazard. I'll play with it a bit more.

Question - does it make more sense to keep the hpubs, or the extracted versions of the hpubs? Theoretically the hpubs will take less space, but I can't imagine it's a significant enough amount to worry about. On the flipside, keeping the hpubs makes them easier to treat as discrete books so you can move books into Baker with the iTunes File Sharing system.

If we keep them around as hpubs, it's probably worth caching any manifests into a database so the system doesn't need to extract the hpub to find the manifest - although I think the zip library might have support for peeking into the zip file without extracting. Maybe that's an option. Will need to investigate.

therabidbanana avatar May 23 '11 22:05 therabidbanana

  1. Yep. Uh, what were you thinking then happens when you close a book? I would take a simpler approach: in the dropdown there's also the "master" book (the first one) so you can simply swtich back to it. (this will open the system to more flexibility in the future as well I think).
  2. Great!
  3. Yes, good point. Regarding that question, I think you detailed well the possibilities. I'd try to keep the zipped book as well, exactly for the same reasons you just explained. Then, I'd just store somewhere the manifest (or in a db) in order to use it. The only drawback is the load time for opening a book, but it's something that we could check.
  4. Maybe we can just wait the opening of the bar when the status bar is completely folded out, and then start animating in our bar. But it's just a thought, if you find a better and faster solution go for it. ;)

folletto avatar May 23 '11 22:05 folletto

The dropdown can now peek into the hpub and look for a manifest. If it finds one, it replaces the filename with the title from that manifest, otherwise it just uses filename. With this method we don't necessarily have to store manifests separately.

I think we still might want to store manifests separately - that'd allow you to delete a book but keep a reference to it so you could easily redownload it... but I imagine peeking into an hpub to find the manifest could still be useful if you downloaded a book but didn't open it (going back to the iTunes file sharing method of adding books), so it's a good first step.

therabidbanana avatar May 23 '11 23:05 therabidbanana

I agree with the approach, great.

For the filename we might think of using a hash of the URI (since that is going to be the unique identifier, like IBAN) or use a physical path that matches the URI itself (for example: book://example.org/publisher/author/book -> /books/example.org/publisher/author/book.hpub).

folletto avatar May 23 '11 23:05 folletto