#enumerate('path/')
, which turned out to work. There also isn't really a good way to access the filesystem short of using their API, so when we ran into trouble we weren't sure if our problem was in the file write code or the code we were inputting to read the filenames back to see if they were written. There is no native file browser in Firefox OS. Two new objects were added to app.js, a BookDownloadManager, which handles the downloading of chapter and book audio files, and a BookPlayerPageGenerator, which sets up the book.html user interface.
One thing I don't like about the code in this stage is how much object generation is done just in the body of app.js. For example,
BookPlayerPageGenerator
needs to know about three elements on the page, and right now we are creating the instance and setting up the selectors right in the body of the file, which adds clutter. App.js is getting really big, so we really need to look into splitting it into smaller files. I'm not sure how this works with jQuery Mobile though.Here's a picture that shows today's progress.
You can see on the console there (under the not well formed errors, which are the most vague and unhelpful error messages ever), that the downloaded chapter gets written to 'librifox/book-id/chapter-index.mp3'.
jQuery Mobile's built in sliders were terrible to use as progress bars because they are designed to be interactive, and we don't want the user sliding them around while a file is downloading. I ended up making my own progress bar that's just a
div
nested inside another div
, which requires way less setup code than what we would need to do for jQuery mobile sliders.None of this code has tests written yet, so that's something we will work on tomorrow.
One thing I was unsure of when writing the 'generator' objects is how to handle the args hash being undefined. Right now I have the line
var args = args || {};
, which sets the args to an empty object if it's excluded. I'm thinking that it might be better not to do that at all, because the object won't function correctly without those arguments, and it's probably better to fail explicitly right at the point it tries to set variables from the args, rather than later on when the code tries to use them and finds them to be undefined.
Your last question here is a really good one. Be sure to ask Sensei Kevin! ;-)
ReplyDeleteI just came across this: http://firefoxosguide.com/firefox-os/top-5-file-manager-apps-firefox-os-marketplace.html/
ReplyDeleteI don't know if you've already seen it or if any of these apps can be of use to you.