lgoss007 / BookmarkExtractor

Extracts bookmarks (highlights, annotations and contexts) from iBooks data
54 stars 6 forks source link

identify book of note, depending on the way the book got into iBooks #3

Open urms opened 12 years ago

urms commented 12 years ago

Hi Lucas,

I found your project working on the same goal, while trying to understand, how the iBooksData2.plist is connected to the Books.plist.

Trying your solution I got the same issue as I have while still learning all this:

I purchased and downloaded ePub books directly on my iPad via O'Reilly and cannot programmatically identify the book a note belongs to.

BookmarkExtractor shows "Unknown: " (it actually shows the key, see below)

Screenshot with Books.plist

This is the entry of my iBooksData2.plist file for the Book shown in the screenshot above:

<dict>
                <key>annotation</key>
                <string>nice question!
if the part imagined or created the whole, is the part still a part of it's creations or is it growing and becoming the whole of itself and it's creation?</string>
                <key>bookDatabaseKey</key>
                <string>BDB9C1823D87F1114DBE60972EF0EB20</string>
                <key>date</key>
                <integer>1341301122</integer>
                <key>deletedFlag</key>
                <false/>
                <key>highlightColor</key>
                <integer>2</integer>
                <key>lastModification</key>
                <integer>1341301238</integer>
                <key>locationBPlist</key>
                <data>
                YnBsaXN0MDDWAQIDBAUGBwgMIDAxWWVuZE9mZnNldFVz
                dXBlcllzdGFydFBhdGhXZW5kUGF0aFVjbGFzc1tzdGFy
                dE9mZnNldCJBUAAA0gkFCgtXb3JkaW5hbBAIWkJLTG9j
                YXRpb26mDRQYGh0f0w4PEBESE1ljbGFzc05hbWVVaW5k
                ZXhXdGFnTmFtZVdjaGFwdGVyEAFTZGl20w4PEBUWF1hl
                cGlncmFwaBACU2RpdtIPEBIZUXDTDg8QGxYcWGVtcGhh
                c2lzVHNwYW7SDxASHlJlbdEPEqYhJCcqLC/TDg8QIhIj
                V2NoYXB0ZXJTZGl20w4PECUWJlhlcGlncmFwaFNkaXbT
                Dg8QKBYpW2F0dHJpYnV0aW9uU2RpdtIPEBIrVHNwYW7T
                Dg8QLRYuW2F0dHJpYnV0aW9uVHNwYW7RDxJeQktFcHVi
                TG9jYXRpb24iAAAAAAAIABUAHwAlAC8ANwA9AEkATgBT
                AFsAXQBoAG8AdgCAAIYAjgCWAJgAnACjAKwArgCyALcA
                uQDAAMkAzgDTANYA2QDgAOcA7wDzAPoBAwEHAQ4BGgEe
                ASMBKAEvATsBQAFDAVIAAAAAAAACAQAAAAAAAAAyAAAA
                AAAAAAAAAAAAAAABVw==
                </data>
                <key>ordinal</key>
                <integer>8</integer>
                <key>serverSyncUniqueId</key>
                <string>823EB3B7-2673-4712-879F-33F1215F025B</string>
                <key>text</key>
                <string>How can a part know the whole?"

—Blaise Pascal</string>
                <key>textualContext</key>
                <string>"How can a part know the whole?"  —Blaise Pascal</string>
                <key>type</key>
                <integer>3</integer>
            </dict>

This is the entry of my Books.plist file for the Book shown in the screenshot above:

        <dict>
            <key>Name</key><string>Search Patterns</string>
            <key>Artist</key><string>Peter Morville</string>
            <key>Album</key><string>Search Patterns</string>
            <key>Genre</key><string>COMPUTERS / Web / Search Engines</string>
            <key>Sort Artist</key><string>Peter Morville</string>
            <key>Persistent ID</key><string>E4EAAB37E1FA462C</string>
            <key>Has Artwork</key><true/>
            <key>Kind</key><string>unknown</string>
            <key>Is Protected</key><false/>
            <key>Release Date</key><date>2010-01-14T12:00:00Z</date>
            <key>Path</key><string>Purchases/8789065E-5572-4BBA-A9BD-B64623F11958.epub</string>
            <key>Extension</key><string>epub</string>
            <key>MIME Type</key><string>application/epub+zip</string>
        </dict>

Now there is an additional pist file on the iOS file system called Purchases.plist, which iExplorer (previousy known as iPhoneExplorer) could neither save to my OS X, nor open it or display it's content within iExplorer.

DiskAid however was able to do so, so instead of the Books.plist I used the Purchases.plist (/Books/Purchases/Purchases.plist) with BookmarkExtractor, here is the dictionary snippet of the book:

        <dict>
            <key>Artist</key>
            <string>Jeffery Callender</string>
            <key>Inserted-By-iBooks</key>
            <true/>
            <key>Name</key>
            <string>Search Patterns</string>
            <key>Package Hash</key>
            <string>BDB9C1823D87F1114DBE60972EF0EB20</string>
            <key>Path</key>
            <string>8789065E-5572-4BBA-A9BD-B64623F11958.epub</string>
            <key>Persistent ID</key>
            <string>E4EAAB37E1FA462C</string>
            <key>Persistent ID Generated On Device</key>
            <true/>
            <key>s</key>
            <string>0</string>
        </dict>

resulting in a correct identification, so it already works if one knows about this special plist-file :)

Screenshot with Puchases.plist

Now I have not a single clue how Objective-C works ... but I hope this helps to improve your wonderful app.

Cheers, Ulf

lgoss007 commented 12 years ago

Interesting, don't know why Apple doesn't keep it all in the books plist. I'll have to see if I can get a purchases.plist file to do some testing on.