R/fct_helpers.R

Defines functions sendCustomMessage serialise_file_input

serialise_file_input = function(){
  yt_path = list.files(pattern = '.mp4')
  # yt_path_cleaned = gsub("[[:punct:]]", "", yt_path) %>% gsub(' ', '_', .) %>% tolower()
  yt_path_cleaned = 'pre_precessing.mp4'
  file.rename(yt_path, yt_path_cleaned)
  system(glue::glue('ffmpeg -i {yt_path_cleaned} preview_test.mp3'))
  #system(glue::glue('ffmpeg -i {yt_path_cleaned} -vn -acodec pcm_s16le -ar 44100 -ac 2 preview_test.wav'))
  file.copy('preview_test.mp3', 'inst/app/www/preview_test.mp3', overwrite = TRUE)
  unlink(c(yt_path_cleaned, 'preview_test.mp3'))
}


sendCustomMessage = function(type, message) {
  data <- list()
  data[[type]] <- message
  private$sendMessage(custom = data)
}
myownelixir2/soundutilsdev documentation built on Dec. 5, 2020, 6:26 a.m.