knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
## load libraries
library(didactr)
library(git2r)
course_url = "https://github.com/muschellij2/cds_testclass"
tfile = tempfile()
tfile = path.expand(tfile)
dir.create(tfile, recursive = TRUE)
local_path = file.path(tfile, basename(course_url))
clone(course_url, 
      local_path = local_path, 
      credentials = cred_token())
course_dir = local_path
course_title = "Test CDS class"

##TO ADD generate lenpub structure
##TO ADD create_manuscript(".md")


auth_file = "../tests/testthat/googlesheets_token.rds"
if (file.exists(auth_file)) {
  didactr_auth(token_file = auth_file)
} else {
  x = didactr_auth()
}
check_didactr_auth()
## check course structure
## fill in missing directories
paths <- check_structure(course_dir)

## get current status of course
course_status <- check_course(course_dir)
head(course_status$course_summary)

## download PDFs and PNGs
## put them where they belong
course_status <- create_images(course_status, 
                               extra.opts = "-density 400 -quality 200",
                               use_gs_ids = TRUE)
head(course_status$course_summary)
## Create Videos
## tell R what AWS keys to use
aws.signature::use_credentials(profile="polly")
course_status <- create_videos(
  course_status
)
head(course_status$course_summary)

Upload Videos to YouTube

The following section is for uploading videos to YouTube. This uploading is done through tuber See https://github.com/soodoku/tuber#using-tuber for setting up the credentials for YouTube.

## Upload Videos & Update YouTube log
course_status <- vids_to_youtube(course_status, course_title=course_title)

## to take a look at youtube videos
youtube_uploads <- readRDS(file.path(paths$met_path, "youtube_uploads.rds"))
head(youtube_uploads)

Once the videos are uploaded you can upload the following links using:

## Update Youtube Link in Manuscript file
course_status <- update_youtube_link(course_status)

## get current status of course
head(course_status$course_summary)

## TO ADD: check_quiz


muschellij2/didactr documentation built on March 17, 2021, 12:45 p.m.