Skip to content

Commit

Permalink
bug fixes to allow for NAs when files not present ; allow line in scr…
Browse files Browse the repository at this point in the history
…ipt file to have a space
  • Loading branch information
ShanEllis committed Jun 19, 2018
1 parent d37a5e8 commit 31f9928
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/check_course.R
Expand Up @@ -209,7 +209,7 @@ check_course = function(course_dir = ".", save_metrics = TRUE,
# get script path and number of paragraphs
get_para <- function(x){
para = readLines(x, warn = FALSE)
para = para[ !para %in% ""]
para = para[ !para %in% c(""," ")]
return(length(para))
}

Expand Down
10 changes: 5 additions & 5 deletions R/create_images.R
Expand Up @@ -18,14 +18,14 @@ create_images <- function(course_status = NULL, ...) {
## OR mod_time_gs > mod_time_pngs
sapply(df$id,
function(x) {
if((is.na(df$pdf[df$id==x]) & !is.na(x))|(df$gs_more_recent[df$id==x])){
message(paste0("Converting PDFs for: ", df$lesson[df$id==x]))
out_dir = file.path(paths$img_path, df$lesson[df$id==x])
if(is.na(x)){}else if((is.na(df$pdf[which(df$id==x)]) & !is.na(x))|(df$gs_more_recent[which(df$id==x)])){
message(paste0("Converting PDFs for: ", df$lesson[which(df$id==x)]))
out_dir = file.path(paths$img_path, df$lesson[which(df$id==x)])
res = gs_convert(id = x, PPTX = FALSE,
out_dir = out_dir,
output_type = "png", ...)
filename = paste0(df$course_info[df$id==x],".pdf")
file.copy(res$pdf, to=file.path(paths$img_path,df$lesson[df$id==x],filename),
filename = paste0(df$course_info[which(df$id==x)],".pdf")
file.copy(res$pdf, to=file.path(paths$img_path,df$lesson[which(df$id==x)],filename),
overwrite=TRUE)
}})
ret = check_course(course_dir = course_status$course_dir,
Expand Down
2 changes: 1 addition & 1 deletion R/create_videos.R
Expand Up @@ -42,7 +42,7 @@ create_videos <- function(course_status = NULL,
}

para = readLines(file.path(paths$scr_path, paste0(x, '_script.md')), warn = FALSE)
para = para[ !para %in% ""]
para = para[ !para %in% c("", " ")]

if(length(para) == length(files)){
message(paste0("generating video for: ", x))
Expand Down

0 comments on commit 31f9928

Please sign in to comment.