|
|
View Full Version : BookSwap autorun book-file manager
llasram 03-07-2008, 02:25 AM Let’s call this an alpha release, but I’ve written a dead-simple filemanager for the Reader. It uses the same DOM/ECMAscript autorun functionality discovered and applied by igorsk, obelix, et al.
It provides the following capabilities:
Copy files between the Reader internal memory & SD card.
Move files between the internal memory & SD card.
Delete files from the internal memory & SD card.
With the following caveats:
I couldn’t manage to find any filesystem listing/transversal functions, although I imagine they’re probably there somewhere. This version thus limits itself to simple operations on the files found and cached by the Reader UI.
I haven’t figured out how to cause the Reader UI to re-scan the internal memory. This means the Reader won’t notice such changes until the next time you either reset it or just plug it in via USB. BookSwap re-scans memory on quit if any changes were made. This causes BookSwap to re-run, but quitting again will quit w/o the re-scan.
I haven’t tested this with a memory stick. It might work.
I have tested it with a both a PRS-500 and 505. On my 500 I can copy files off the SD card but copying to the card fails. However my 500 is damaged, so this may just be an artifact of the damage.
To install, just extract the attached archive into the root of an SD card.
Moderator: WARNING! Does not wotk with books you have in a collection
gwynevans 03-07-2008, 04:48 AM Nice - As you say, there are caveats but never-the-less, very nice!
--
Re 2: A full shutdown & restart also re-reads the internal memory, just in case you'd prefer ro avoid a reset.
Do you have any pointers to what functions, etc, have been discovered? Just wondering if there was any way of sorting the list of files somehow, for instance...
--
Just to say what I did - I was able to move a book to a SD card, reset it via USB to check it had gone, then copy it back from SD to Internal, reset it via shutdown/restart and read it again without the SD card.
llasram 03-07-2008, 11:40 AM Re 2: A full shutdown & restart also re-reads the internal memory, just in case you'd prefer ro avoid a reset.
Good catch! I added an option to the main-menu to shutdown the Reader instead of just quit BookSwap and it works great. But unfortunately I didn’t bring the changes with me to work this morning and left my USB cable at home. I’ll upload a new version when I get home tonight.
Unrelatedly, I’ve noticed that I put this thread in the PRS-505–only category. As BookSwap does work on the PRS-500 it should probably go one level up... Am I just not seeing the interface to do that, or does one need to have moderator privileges to move threads around?
llasram 03-07-2008, 02:05 PM Do you have any pointers to what functions, etc, have been discovered?
Like obelix pointed out in the thread for his Sudoku game, it's been pretty slap-and-dash. If you grab the contents of the Reader's /opt directory you'll get the whole UI. From there (for me anyway) it's been a matter of looking at the functions used in the existing XML files and running 'strings' on the binary files looking for likely candidates. I wrote a recursive object-dumper which was how I found the UI cache. I'll see about cleaning that up a bit and posting it.
It might be nice to start documenting some of this in the mobileread wiki. On the other hand, perhaps that hasn't been done so far because that gets pretty close to documenting the DRM-related functions...
Just wondering if there was any way of sorting the list of files somehow, for instance...
That would probably be possible, but I'd really like move to using the filesystem instead of the UI cache. Then users could arrange files into directories, making sorting less of an issue.
llasram 03-08-2008, 01:20 AM Uploaded version 0.1.1. Just modified the initial post to keep everything in the same place.
Changes:
Implement real memory re-scanning.
moneytoo 03-09-2008, 01:44 PM Very nice and working. :)
I really missed some delete function on the Reader.
gwynevans 03-09-2008, 04:09 PM Uploaded version 0.1.1.
My mods to 0.1.1.1 that you might want to have a look to see if there's anything useful, but most are 'personal preference' things...
Changes I tried are:
Changed "Quit" to "Quit with Restart" and added a "Quit" (without restart)
Added a 'List Books' (but it really needs as no-op function as you get an exception if you choose a book, as I reused ChooseFile).
Changed to display 'book.author + " - " + book.title rather than just title. (Personal pref, as it then matches the format I use for my filenames.)
Changed default location for SD cards to "Sony Reader/database/books/" (but no checks for missing folders) (Again, personal prefs)
Changed to use smaller, non-bold fonts for the label contents (more visible chars)
Added a 'books.sort()' (See comment below)
Added a version string in the XML
Added doFirst/doLast support for jumping by 10 pages (i.e. hold down next/prev)
--
Edit: Updated attatchment (to a 0.1.1.1-B version) as I realised what was wrong with my sorting & manged to add a routine to sort by Author, then Title. (This suits me, as I have my files as "<author> - <title>.lrf", but may not suit others, but it's at least there to change if wanted).
Moderator: WARNING! Does not wotk with books you have in a collection
keith 03-16-2008, 06:41 PM Using version 0.1.1.1-B I don't seem to be able to copy from Memory Stick or SD card to internal memory. I get the message:
Copying file...
From:b:/Sony Reader/database/books/Sony Reader/...
To:/Data/Author - title.lrf
Failed :-(
The from line is presumably truncated..
Version 0.1.1 does work with SD card and Memory Stick
gwynevans 03-16-2008, 07:12 PM My (4) fix was bad - The line 290 in autorun.js should be reverted to
'path': record.path,
rather than
'path': record.path + "Sony Reader/database/books",
Moderator: WARNING! Does not wotk with books you have in a collection
keith 03-16-2008, 08:52 PM Version 0.1.1.1-C works. Files are copied to the root of the SD card / internal memory.
vinniet 03-25-2008, 08:41 PM Does this program have a problem with deleting books that are part of Collections?
I tried copying files from my SD card to the internal memory with both version 0.1.1.1 and 0.1.1.1-C but I couldn't make the 505 refresh the list after quitting. The new copied file that should be shown on the book list doesn't appear in it. Even taking the SD card out doesn't refresh the list.
How is it supposed to copy a file correctly? or how do I refresh the list?
Thanks
Ok, now I've got it! After taking the card out, I went to the main menu and back to the book list and voilà! the list was all refreshed.
Thanks for a great hack!!
JSWolf 03-26-2008, 08:21 PM Does this program have a problem with deleting books that are part of Collections?
Good question. I'd like to also know if it can copy books that are part of a collection without messing up the collection.
llasram 03-26-2008, 10:50 PM Good question. I'd like to also know if it can copy books that are part of a collection without messing up the collection.
Copying books which are part of collections shouldn't be a problem, but deleting them will probably make the Reader veeeeery unhappy. That might be hard to fix.
Wow, I haven't been paying attention here -- more interest than I initially thought :-). I'll get off my ass this weekend and move this over to the mobileread dev site, give it a real project, and try to make some coherent combination of some changes I made and gwynevans'.
Also, I did figure out how to do directory traversal ('Iterator' is the function, 'iterator' is the prototype... not sure why I didn't notice that earlier...) which has me considering upending the entire interface. So instead of choosing an operation, one could navigate to a file first, then choose an operation to perform on it. And perhaps one such operation could be "Read," providing the beginnings of a hierarchical interface for accessing the content?
gwynevans 03-27-2008, 05:26 AM Copying books which are part of collections shouldn't be a problem, but deleting them will probably make the Reader veeeeery unhappy. That might be hard to fix.
Actually, I think that the reader will cope happily enough with having books in collections being deleted out from under it, although I've only recall having done that via direct access to the internal memory via USB device, not via the file manager.
I suspect that trying to insert a book into a collection when copying it, however, isn't going to be practical, just in case that's what anyone's hoping for...
JSWolf 03-27-2008, 07:00 AM I did test out deleting a book when the 505 was connected to the computer and the book was part of a collection. It borked the collection when I just plain deleted the book.
Now can this be fixed so collections do work?
gwynevans 03-27-2008, 10:03 AM Oh err - you're right... I just re-tried it (i.e. just deleting via USB, leaving aside the app here) & the reader didn't do what I thought it did, which was to tidy up the removed book properly. It does remove the 'book' entry from the media.xml file, but it doesn't scan the collections in the same file and remove the entry that linked to it from them...
> can this be fixed ...
While it's llasram who's been doing the 'heavy lifting', not me, I'd doubt it. While the functionality is going to exist on the reader, I'm not sure if it's going to be able to find out how to access it from outside Sony (or whoever they got to actually code the 'OS') for them.
JSWolf 03-28-2008, 10:23 AM So basically this code is well useless to me as I do use collections to organize my content. It's just like the original delete hack for the 500 that didn't also work with collections.
gwynevans 03-28-2008, 10:49 AM Well, strictly, it's the 505's USB device functionality that's making it useless to you, not the code here - this code might be one method to delete a book, but the issue you refer to also appears when just deleting the book via the USB device.
That also assumes that you need to delete books off your device before copying new ones on, whereas this allows you to carry literally GBs of books (if you can find that many!) to select & copy onto the reader without needing access to a PC.
By the way, have you gone through all the posts in the forums that refer to using the USB device and added the "Moderator: WARNING! Does not wotk with books you have in a collection" note to them too? Hamlet (Quote Act III, Sc. II) might apply...
|