-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cansavvy's attempts at getting fig.alt's to sync between Google slides and Rmd #116
Conversation
#' sure it does not fail on large files | ||
#' @return Downloaded file (in temporary directory) | ||
#' @export | ||
get_gs_pptx <- function(id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would just download one slide's powerpoint (which would contain its slide notes as well). But I haven't found how to do this.
Page ID
Speaker Notes
|
Oh that’s an awesome that exists! Great! |
We could use the rgoogleslides package (need authorization) to talk to the API and get the objectIds (ids of all the slides):
|
Great article on using OAuth 2.0 in R: https://blog.r-hub.io/2021/01/25/oauth-2.0/ Note to myself: So far, I've figured out how to:
|
@cansavvy Made some changes today:
|
Checks are failing because ariExtra is not on CRAN. I used the Remotes field in DESCRIPTION to depend on jhudsl/ariExtra: a618e6a#diff-9cc358405149db607ff830a16f0b4b21f7366e3c99ec00d52800acebe21b231cR47. This SO post: Remotes is not an official description field and dependencies should be publicly available for submission on CRAN, . Also, Jenny Bryan says r-lib/devtools#1717 (comment). So, it seems like we need to put ariExtra on CRAN or just copy-paste |
Yeah that seems like a good solution. Alternatively you could have But yeah making ottrpal's own version of get_slide_id makes sense to me (since its a small function).
|
Would you be able to write out code that illustrates how you test this in the context of the end use case? Basically can you give me a reprex for me to test this? |
To test this:
Give all the Google Drive and Google Slides permissions and you should be seeing this message:
|
Good point. But, the |
This is a great place to start from! But we should think about how we want this to be implemented on the user side . Setting up a Google Client Id is a lot for each user to do to just get the notes. We should probably have a Google client id that is encrypted here and a default account that we can use. Perhaps we could make a dummy Google account so that is one more level safe. I can work on this potentially if you like and then we can pair program on it together. |
I think I can do this fairly easily.
Is this what you were thinking? Is this a safe method? |
Yes that's part 1. But we'll still want to keep those credentials safe via some encryption steps and finding a way (if possible) to just provide oAuth token from that account by default. That last part is easy through GitHub secrets but we'd have to think about the set up if people want to use the function locally. In the later case, we'd probably want them to provide their own credentials. |
What you are saying is we want to use the Google Client ID and Client Secret to generate an OAuth 2.0 Token, encrypt this token somehow, and store it in the GitHub secrets of the ottrpal repo? |
Yeah programmatic access through a secrets. Here's an example of that: https://github.com/datatrail-jhu/rgoogleclassroom/blob/fbf7f2a5479d25546ea51533c769ebeaae8cbbb6/R/auth.R#L116 And then the secrets can be GitHub secrets |
Supplying authorization to get slide notes for ottrpal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We paircoded functions in auth.R
so that we can talk to the Google Slides API using encrypted credentials. extract_object_id()
lets us talk to the API and extract individual IDs of all the slides in a Google Slides deck.
Purpose/implementation Section
What changes are being implemented in this Pull Request?
This is related to jhudsl/OTTR_Template#487
What was your approach?
I was trying to have it so it would download slide notes from Google Slides and then put them in the fig.alt option for the relevant
ottrpal::get_image_from_slide()
bitThis would be good because right now people have to do copy and pasting to update fig.alts and that's an easy way to get mistakes because the slide notes can quickly become out of sync with what is in the course.
The problem I've encountered is that there is no easy URL to retrieve slide notes from. You appear to need google authorization to download the powerpoint and get slide notes that way (which is what ari does).
I have been looking for a simpler work around so we don't have to supply google auth but there may not be one. ¯_(ツ)_/¯
What GitHub issue does your pull request address?
jhudsl/OTTR_Template#487
Tell potential reviewers what kind of feedback you are soliciting.
I'm posting this so @howardbaek can see what I was starting to work on and he might find a better solution.
The dream would be, we could download one slide's notes at a time using its slide ID eg.:
If this is the slide link:
https://docs.google.com/presentation/d/1ME0NbcIBmnHJRhX3JJyCwJuuomkl_BjJp6lD5oD5WnU/edit#slide=id.gd422c5de97_0_5
then somehow we could alter this URL to get the slide notes. But so far no such luck.