Skip to content

Instantly share code, notes, and snippets.

@uribo
Created July 27, 2022 03:36
Show Gist options
  • Save uribo/be8c0e49a946d5f50b2555303e9f6a59 to your computer and use it in GitHub Desktop.
Save uribo/be8c0e49a946d5f50b2555303e9f6a59 to your computer and use it in GitHub Desktop.
apple_book_name_fix <- function(data) {
purrr::set_names(data,
stringr::str_to_lower(
stringr::str_remove(names(data), "^Z")
))
}
apple_book_markers <- function() {
con <- DBI::dbConnect(RSQLite::SQLite(),
"~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/AEAnnotation_v10312011_1727_local.sqlite",
synchronous = NULL)
df <-
tibble::as_tibble(dbReadTable(con, 'ZAEANNOTATION')) |>
apple_book_name_fix() |>
dplyr::filter(!is.na(annotationselectedtext)) |>
dplyr::select(annotationstyle, annotationtype, annotationassetid, annotationselectedtext, futureproofing5)
DBI::dbDisconnect(con)
df
}
apple_book_list <- function() {
con <- DBI::dbConnect(RSQLite::SQLite(),
"~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/BKLibrary-1-091020131601.sqlite",
synchronous = NULL)
df <-
tibble::as_tibble(dbReadTable(con, 'ZBKLIBRARYASSET')) |>
apple_book_name_fix() |>
dplyr::filter(!is.na(title))
DBI::dbDisconnect(con)
df
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment