Libation icon indicating copy to clipboard operation
Libation copied to clipboard

Bookmarks/Clips

Open gabriel-vanca opened this issue 2 years ago • 9 comments

Would it be possible to make bookmarks/clips available? Perhaps they can be downloaded too when the book is downloaded.

gabriel-vanca avatar Aug 06 '22 17:08 gabriel-vanca

I think it's possible to download bookmarks and clips through the API, but the question is what file format would they be saved in and how would you use them? Bookmarks and clips are designed to work with the Audible audiobook player. I suppose clips could be just that, pieces of the audiobooks stored as individual mp4 or mp3 files. But I don't know about bookmarks. How would you like to see bookmarks saved to a file?

Mbucari avatar Aug 07 '22 01:08 Mbucari

I'm thinking of either:

  • having the bookmark (by which I mean both the time-stamp and the annotation text) imported into Readwise
  • having the bookmark and the short audio clip (unlikely to be more than 3 minutes) imported into Notion (or OneNote)

gabriel-vanca avatar Aug 07 '22 02:08 gabriel-vanca

Bookmark timestamps and annotation text are easy: just put them in a CSV which you can then import into pretty much any software ever created. For the accompanying audio file, maybe:

  1. Save the 3-ish second clip into same folders as a CSV
  2. At a third column in the CSV with the audio files name

Sound good?

Mbucari avatar Aug 07 '22 02:08 Mbucari

Going back to the clips, I'm not crazy about having to split chunks of the audio out into their own files. Starting with what we have right now, that would just be a lot of changes to the audio processing routines. It would be a lot of work and I don't have confidence I'd get it right on the first try.

So instead of that, what about .cue files? One .cue file per clip, or all clips in a single Bookmarks.cue file?

In fact, bookmarks could be done in pretty much the same way. One .cue file for all of your bookmarks.

Mbucari avatar Aug 07 '22 02:08 Mbucari

Save the 3-ish second clip into same folders as a CSV At a third column in the CSV with the audio files name

I often write the Audible annotations on my smartphone, and often very quickly while travelling or gym-ing, so definitely not in the mood to switch between Audible and a spreadsheet/CSV editor.

Going back to the clips, I'm not crazy about having to split chunks of the audio out into their own files.

I rather imagined that the bookmark clips would be separate from the main audiobook files. Effectively duplicates of small parts of the audiobook. So no chance of breaking anything :)

So instead of that, what about .cue files?

Can't use the .cue in Notion/OneNote/Readwise.

gabriel-vanca avatar Aug 07 '22 02:08 gabriel-vanca

I don't use the bookmark features myself and I don't know how audible stores them. It sounds like you want small portions of the main audio file. Depending on how they're stored in your account, sounds to me like the output of a book + some time markers (which might be manageable by a cue file). Am I close? If not, where am I off?

rmcrackan avatar Aug 07 '22 03:08 rmcrackan

Yes, that's right: timestamp + annotation text + small clip files (fully separate from the main audio book).

Not sure .cue would help though as cue doesn't work with those apps, nor can it be linked to annotations.

Right now the only solution to do what I need is a bizzare workaround involving Kindle: https://help.readwise.io/article/29-can-i-extract-audible-clippings-somehow

gabriel-vanca avatar Aug 07 '22 03:08 gabriel-vanca

@mkb79 What do you know about bookmarks? I see this. However, that doesn't look like bookmarks from an account.

rmcrackan avatar Aug 07 '22 14:08 rmcrackan

@rmcrackan This will give you the bookmarks, clips and annotations for the given asin and the authenticated user. Here is the implementation for audible-cli.

mkb79 avatar Aug 07 '22 15:08 mkb79

So I've been trying to figure this out with help from @mkb79 over here, and it's frustrating. It appears that the Audible app doesn't sync clips and bookmarks to the server reliably. Additionally, I can't seem to retrieve clips from the api. I can set them in the api and they show up on my phone, but I can't query them.

Mbucari avatar Jan 02 '23 18:01 Mbucari

@Mbucari Yikes. That thread with mkb79 looks like no fun.

Unless you're really intent on cracking this particular nut, I'm fine with closing this as a nice-to-have which would require a disproportionate amount of effort. Your call. I'll back you either way.

rmcrackan avatar Jan 02 '23 19:01 rmcrackan

@rmcrackan leave it for now. My obsessive personality won't allow me to give up this quickly, and @mkb79 says he'll try with his US account tomorrow.

Mbucari avatar Jan 02 '23 19:01 Mbucari

@rmcrackan We might have this figured out. My existing auth tokens didn't grant me access to view clips. I registered a new device, and the new token showed me clips. @mkb79 says this is a relatively new feature and old auth files may not have access to clips. Can you do me a favor and try to retrieve clips from an audiobook on your account using audible-cli (if your COVID brain will allow)? You'll need to create a clip for an audiobook in the mobile app, then run this command

audible api -i 4 -p key=[ASIN] -p type=AUDI https://cde-ta-g7g.amazon.com/FionaCDEServiceEngine/sidecar

You should get results like this:

{
    "md5": "XXX",
    "payload": {
        "acr": null,
        "guid": "_LATEST_",
        "key": "[ASIN]",
        "type": "AUDI",
        "records": [
            {
                "lastModificationTime": "2023-01-02 21:05:01.0",
                "annotationId": "XXX",
                "startPosition": "2000000",
                "type": "audible.clip",
                "endPosition": "2025000",
                "creationTime": "2023-01-02 21:05:01.0",
                "metadata": {
                    "note": "Test Clip notice",
                    "c_version": "10748071"
                }
            },
            {
                "lastModificationTime": "2023-01-02 21:05:02.0",
                "annotationId": "XXX",
                "startPosition": "2000000",
                "type": "audible.bookmark",
                "creationTime": "2023-01-02 21:05:02.0"
            },
            {
                "startPosition": "2025000",
                "type": "audible.last_heard",
                "creationTime": "2023-01-04 03:03:33.0"
            }
        ]
    }
}

If you see a record with "type": "audible.clip", your token has access to that data.

Mbucari avatar Jan 04 '23 16:01 Mbucari

@Mbucari

>audible api -i 4 -p key=B084RPCT73 -p type=AUDI https://cde-ta-g7g.amazon.com/FionaCDEServiceEngine/sidecar
{
    "md5": "[redacted]",
    "payload": {
        "key": "[redacted -- 10 chars]",
        "guid": "_LATEST_",
        "type": "AUDI",
        "acr": null,
        "records": [
            {
                "creationTime": "2023-01-04 20:15:44.0",
                "type": "audible.last_heard",
                "startPosition": "10018042"
            },
            {
                "endPosition": "10019671",
                "creationTime": "2023-01-04 20:15:44.0",
                "metadata": {
                    "c_version": "13997221"
                },
                "lastModificationTime": "2023-01-04 20:15:44.0",
                "type": "audible.clip",
                "startPosition": "9981942",
                "annotationId": "[redacted -- 14 chars]"
            },
            {
                "creationTime": "2023-01-04 20:15:45.0",
                "lastModificationTime": "2023-01-04 20:15:45.0",
                "type": "audible.bookmark",
                "startPosition": "9981942",
                "annotationId": "[redacted -- 14 chars]"
            }
        ]
    }
}

rmcrackan avatar Jan 04 '23 20:01 rmcrackan

Nice! Now that I know the problem was just with my auth, this feature is nearly complete in the AudibleApi lib. Then it's a matter of figuring out what the Libation feature will look like. Let's have a race: can I complete this feature before you and your family recover lol

Mbucari avatar Jan 04 '23 20:01 Mbucari

You have a head start. Me and my wife were symptomatic on Jan 1 (happy new year!) and all kids started yesterday, thus resetting the clock

rmcrackan avatar Jan 04 '23 21:01 rmcrackan

All right @gabriel-vanca , here's what I've got.

Every book has a new menu item: MenuItem

Which opens a new window:

Window

And lets yoy delete records and export them to xklsx, csv, and json.

Here's the CSV
Type,Created,Start,AnnotationId,LastModified,End,Text,Title
Clip,1/5/2023 11:50:47 PM -07:00,01:23:20,XXX,1/5/2023 11:50:47 PM -07:00,01:23:50,clip 1 note,clip 1 title
Clip,1/5/2023 11:50:47 PM -07:00,01:40:00,XXX,1/5/2023 11:50:47 PM -07:00,01:40:30,clip 3 note,clip 3 title
Note,1/5/2023 11:50:47 PM -07:00,11:40:00,XXX,1/5/2023 11:50:47 PM -07:00,11:43:20,Standalone note 2
Note,1/5/2023 11:50:47 PM -07:00,01:23:20,XXX,1/5/2023 11:50:47 PM -07:00,01:23:20,clip 1 note
Note,1/5/2023 11:50:47 PM -07:00,01:40:00,XXX,1/5/2023 11:50:47 PM -07:00,01:40:00,clip 3 note
Note,1/5/2023 11:50:47 PM -07:00,19:10:00,XXX,1/5/2023 11:50:47 PM -07:00,19:25:00,Standalone note 1
Bookmark,1/5/2023 11:50:47 PM -07:00,01:23:20,XXX,1/5/2023 11:50:47 PM -07:00
Bookmark,1/5/2023 11:50:47 PM -07:00,01:40:00,XXX,1/5/2023 11:50:47 PM -07:00
Bookmark,1/5/2023 11:50:47 PM -07:00,16:40:00,XXX,1/5/2023 11:50:47 PM -07:00
Bookmark,1/5/2023 11:50:47 PM -07:00,19:26:40,XXX,1/5/2023 11:50:47 PM -07:00
LastHeard,1/5/2023 11:50:47 PM -07:00,02:07:34.3210000
And here's the Json
{
  "title": "Harry Potter and the Half-Blood Prince, Book 6",
  "asin": "B017V4NOZ0",
  "exportTime": "2023-01-05T23:57:06.2021725-07:00",
  "records": [
    {
      "Type": "Note",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "11:40:00",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00",
      "End": "11:43:20",
      "Text": "Standalone note 2"
    },
    {
      "Type": "Bookmark",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "01:23:20",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00"
    },
    {
      "Type": "Note",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "01:23:20",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00",
      "End": "01:23:20",
      "Text": "clip 1 note"
    },
    {
      "Type": "Clip",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "01:23:20",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00",
      "End": "01:23:50",
      "Text": "clip 1 note",
      "Title": "clip 1 title"
    },
    {
      "Type": "Clip",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "01:40:00",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00",
      "End": "01:40:30",
      "Text": "clip 3 note",
      "Title": "clip 3 title"
    },
    {
      "Type": "Bookmark",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "01:40:00",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00"
    },
    {
      "Type": "Note",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "01:40:00",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00",
      "End": "01:40:00",
      "Text": "clip 3 note"
    },
    {
      "Type": "Bookmark",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "16:40:00",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00"
    },
    {
      "Type": "Note",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "19:10:00",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00",
      "End": "19:25:00",
      "Text": "Standalone note 1"
    },
    {
      "Type": "Bookmark",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "19:26:40",
      "AnnotationId": "XXX",
      "LastModified": "2023-01-05T23:50:47-07:00"
    },
    {
      "Type": "LastHeard",
      "Created": "2023-01-05T23:50:47-07:00",
      "Start": "02:07:34.3210000"
    }
  ]
}

I plan to add a cli command for these as well (similar to the export library command). You said you also wanted a setting to download this data with the books too, right?

Mbucari avatar Jan 06 '23 07:01 Mbucari

Good work. Yes, that would be great.

gabriel-vanca avatar Jan 06 '23 11:01 gabriel-vanca

Included in latest: v8.8.1

rmcrackan avatar Jan 09 '23 18:01 rmcrackan

@gabriel-vanca If you try this feature and are able to see bookmarks and notes but not clips, delete your account and re-add it. It looks like older auth files (approaching one year old) do not have access to the "clips" records.

Mbucari avatar Jan 09 '23 18:01 Mbucari