diff --git a/R/utils_regexes.R b/R/utils_regexes.R index 08afea1..9c353d4 100644 --- a/R/utils_regexes.R +++ b/R/utils_regexes.R @@ -32,6 +32,18 @@ return(x) } +#' Extract season number from file paths +#' +#' Parses the file name component of each path and attempts to detect the season +#' number using four common naming conventions: +#' \code{S01}, \code{SEASON.2}, \code{S03E05}, and \code{2X05}. +#' Returns \code{NA} for paths where no convention matches. +#' +#' @param x a character vector of file or directory paths. +#' +#' @returns A numeric vector of season numbers, the same length as \code{x}. +#' +#' @noRd # Guess subtitle format from subtitle content when no file extension is # available, e.g. when parsing literal text. .guess_subtitle_format <- function(x) { diff --git a/README.Rmd b/README.Rmd index a5215de..9cd3d12 100644 --- a/README.Rmd +++ b/README.Rmd @@ -37,7 +37,7 @@ if (coverage >= 90) { [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![R-CMD-check](https://github.com/fkeck/subtools/actions/workflows/check-standard.yml/badge.svg)](https://github.com/fkeck/subtools/actions/workflows/check-standard.yml) -[![Code Coverage: `r coverage`%](https://img.shields.io/badge/code_coverage-`r coverage`%25-`r colour`)](https://img.shields.io/badge/code_coverage-`r coverage`%25-`r colour`) +![Code Coverage: `r coverage`%](https://img.shields.io/badge/code_coverage-`r coverage`%25-`r colour`) ### Read, write and manipulate subtitles in R @@ -48,11 +48,7 @@ Subtools is a R package to read, write and manipulate subtitles in R. This then ### Install You can install the package directly from CRAN with `install.packages("subtools")` or get the latest, in development, version with: ```{r, eval = FALSE} -remotes::install_github( - repo = "fkeck/subtools@dev", - build_manual = TRUE, - build_vignettes = TRUE -) +pak::pkg_install("fkeck/subtools@dev") ``` ```{r} diff --git a/README.md b/README.md index 3e214c3..cc6b1af 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![R-CMD-check](https://github.com/fkeck/subtools/actions/workflows/check-standard.yml/badge.svg)](https://github.com/fkeck/subtools/actions/workflows/check-standard.yml) -[![Code Coverage: -82%](https://img.shields.io/badge/code_coverage-82%25-green)](https://img.shields.io/badge/code_coverage-82%25-green) +![Code Coverage: +82%](https://img.shields.io/badge/code_coverage-82%25-green) ### Read, write and manipulate subtitles in R @@ -30,11 +30,7 @@ You can install the package directly from CRAN with version with: ``` r -remotes::install_github( - repo = "fkeck/subtools@dev", - build_manual = TRUE, - build_vignettes = TRUE -) +pak::pkg_install("fkeck/subtools@dev") ``` ``` r @@ -242,18 +238,56 @@ rushmore_sub unnest_tokens(rushmore_sub) #> # A tibble: 49 × 4 #> ID Timecode_in Timecode_out Text_content -#>