From be0fd2fbd993555812bd94860eb1f915fc058983 Mon Sep 17 00:00:00 2001 From: gmillot <gael.millot@pasteur.fr> Date: Fri, 13 Jan 2023 14:17:25 +0100 Subject: [PATCH] release v1.2: README and subtitle_time_shift.R files improved --- README.md | 7 ++++++- subtitle_time_shift.R | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 59e2695..0a7609b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Shift the time of .srt subtitle files ### Using a R GUI (graphic user interface, i.e., R or RStudio windows) -1) Open the subtitle_time_shift.R file and set the parameters (2 first lines) +1) Open the subtitle_time_shift.R file and set the parameters (in the "Parameters set by users" section) 2) Open R or RStudio @@ -92,6 +92,11 @@ Not yet published ## WHAT'S NEW IN +### v1.2 + +README and subtitle_time_shift.R files improved. + + ### v1.1 README file improved. diff --git a/subtitle_time_shift.R b/subtitle_time_shift.R index dd03f7a..16f9b42 100644 --- a/subtitle_time_shift.R +++ b/subtitle_time_shift.R @@ -1,7 +1,42 @@ +#!/usr/bin/env Rscript + +######################################################################### +## ## +## subtitle_time_shift.R ## +## ## +## Gael A. Millot ## +## Bioinformatics and Biostatistics Hub ## +## Institut Pasteur Paris ## +## ## +######################################################################### + + +################################ From + +# https://gitlab.pasteur.fr/gmillot/subtitle_time_shift + +################################ End From + + + +################################ Aim + +# Shift the time of .srt subtitle files + +################################ End Aim + + + +################################ Parameters set by users shift <- -1 # in seconds in.path <- "C:/Users/Gael/Documents/Git_projects/subtitle_time_shift/dataset/movie.srt" # absolute path of the input file +################################ End Parameters set by users + + + +################################ Main code a <- read.table(in.path, sep = "\t", check.names = FALSE, quote = "", comment.char = "", blank.lines.skip = FALSE) out.path <- paste0(sub(x = in.path, pattern = "\\.srt$", replacement = ""), "_shift.srt") @@ -17,5 +52,5 @@ f <- a f[tempo.log, ] <- sapply(X = e, FUN = function(x = X){paste0(x, collapse = " --> ")}) write.table(f, file = out.path, row.names = FALSE, col.names = FALSE, append = FALSE, quote = FALSE, sep = "\t") - +################################ End Main code -- GitLab