Skip to contents

Says as which format read_movie() reads a file, without reading it: by its extension, or by its content for a file under another extension and for the extension .txt, which two formats share and many files that are no recordings carry. Use it to pick the recordings out of a folder.

Usage

recording_format(path)

Arguments

path

File paths.

Value

Character vector with one entry per path: the format as the argument format of read_movie() takes it (an extension without its dot, or "atari_gc" or "atari_head"), and NA for a file that read_movie() does not read as a recording, for a folder and for a path that does not exist. A ZIP archive that holds recordings is no recording itself and gives NA; see movie_members().

Examples

files <- list.files(system.file("extdata", package = "replayr"), full.names = TRUE)
data.frame(file = basename(files), format = recording_format(files))
#>                file format
#> 1         README.md   <NA>
#> 2      bk2-variants   <NA>
#> 3         computers   <NA>
#> 4          expanded   <NA>
#> 5  fbm-layouts.json   <NA>
#> 6            legacy   <NA>
#> 7  mar-layouts.json   <NA>
#> 8             paper   <NA>
#> 9        sample.bk2    bk2
#> 10       sample.dtm    dtm
#> 11       sample.fcm    fcm
#> 12       sample.fm2    fm2
#> 13       sample.gmv    gmv
#> 14       sample.lmp    lmp
#> 15      sample.lsmv   lsmv
#> 16       sample.m64    m64
#> 17       sample.pjm    pjm
#> 18       sample.pxm    pxm
#> 19       sample.smv    smv
#> 20       sample.vbm    vbm
#> 21         semantic   <NA>
#> 22           tables   <NA>
# Of the text files, the tables of the two Atari data sets are recordings.
texts <- list.files(system.file("extdata", package = "replayr"), "[.]txt$",
  recursive = TRUE, full.names = TRUE)
data.frame(file = basename(texts), format = recording_format(texts))
#>                        file     format
#> 1                README.txt       <NA>
#> 2                README.txt       <NA>
#> 3       motion-examples.txt       <NA>
#> 4                README.txt       <NA>
#> 5 atari-grand-challenge.txt   atari_gc
#> 6            atari-head.txt atari_head