R/metadataPPP.R

#' Extract Metadata
#'
#' Creates a CSV file with selected metadata columns in. SourceFile, AmbientTemperature, MoonPhase, DateTimeOriginal, and Keywords are returned in the csv file.
#'
#' @param inDir character. The directory where your images are saved.
#' @param outDir character. The directory where you want your metadata saved.
#' @param name character. The name you want for your new metadata file.
#'
#' @author Philip Faure, \email{philip.faure13@gmail.com}
#' @keywords metadata
#'
#' @export
#'
#' @examples
#' metadataPPP(inDir  = "/Users/philipfaure/Photos",
#'             outDir = "/Users/philipfaure/Metadata",
#'             name   = "my_metadata")

metadataPPP <- function (inDir, outDir, name)
{
  time <- Sys.time()
  if (Sys.info()[["sysname"]] == "Windows") {
    message("Patience you must have my young padawan...")
    shell(paste("exiftool -r -HierarchicalSubject -Keywords -AmbientTemperature -MoonPhase -SourceFile -DateTimeOriginal -csv ", inDir, " > ",
                outDir, "/", name, ".csv",
                sep = ""))
  }
  else {    message("Patience you must have my young padawan...")
    system(paste("exiftool -r -HierarchicalSubject -Keywords -AmbientTemperature -MoonPhase -SourceFile -DateTimeOriginal -csv ", inDir, " > ",
                 outDir, "/", name, ".csv",
                 sep = ""))
  }
  comp.time <- difftime(Sys.time(), time)
  comp.time

message("Philip needs a stimulant of the central nervous system.")
message("i.e. Coffee..")
message("C8•H10•N4•O2")
message("==============================")
message("https://github.com/PhilipFaure")
message("==============================")
}
PhilipFaure/metadataTools documentation built on Dec. 11, 2022, 9:09 p.m.