#' create the final srt by collating all revision2 files of a project
#'
#' @param prj project #'
#' @export
make_final_srt <- function(prj){
prj_dir <- subs_dir(prj)
all_revs <- list.files(
path = prj_dir,
pattern = all_revs_ptrn,
full.names = TRUE)
final_maker <- function(r){# r is a path to a revision file
outfile <- sprintf("%s/%s_final.srt", prj_dir, prj)
## remove BOM by Aegisub
rm_bom <- paste(c('dos2unix', r), collapse = ' ')
system(rm_bom)
cmd <- sprintf("cat %s", paste(r, collapse = ' '))
input <- pipe(cmd)
on.exit(close(input))
final_srt <- read_srt(f = input)
## cleaning
final_srt <- lapply(final_srt, function(x) {
x$text <- rm_spaces(x$text)
x
})
## exporting
write_srt(final_srt, f = outfile)
}
final_maker(all_revs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.