# 00 SpotifyAdds Setup.r
.description = 
"This file has the parameters that can vary from one run to the next. 
Double check these values before each run."

# --------------------------------------------------------------- #
{

    ## Whether or not to refresh
    if (!exists("refresh") || isTRUE(refresh)) {
        utilSource()
        fresh(save=FALSE, utils=TRUE, dt=TRUE)    
    }
    else if(exists("refresh") && !isTRUE(refresh)) {
        message("Did *not* run fresh() since `refresh` is flagged off.")
    }


    loadFromLastBackUp <- FALSE
    RELEASE.DATES      <- FALSE  # TRUE ## Whether to also pull release dates from infinitDB
    failOnUPCsMissing.Spotify.wrt.DB <- FALSE
    # Whether to save after each import of a dataset. (ie, after each QRY)
    saveAfterEachDataIngest <- FALSE  
    removeTablesAfterMerge  <- FALSE

    verbose    <- TRUE
    onlyUS     <- FALSE

    ## ---   PARAMETERS FOR DB.all.count   ----- ##
    monthsUsing  <- 5:11   # I am not sure if this is still used
    showDBoutput <- TRUE
    
    maxReleaseDate  <- as.Date("2013-11-01")  # this is for Section 04.C 
    minReleaseDate  <- as.Date("2013-02-01")  # this is for Section 04.C 
    ## ---   PARAMETERS FOR DB.all.count   ----- ##

  
    ## ---   Time Stamp Format   ----- ##
    frmt.monthday_time <- "%m%d_%H%M"
    qry_timestamp <- timeStamp(frmt=frmt.monthday_time)

    ## Date Info
    origin = as.Date("1970-01-01")



    # re-source utils file
    source("~/git/misc/rscripts/utilsRS.r")
    utilSource()
    pkgs <- c("data.table", "Hmisc", "lubridate")
    suppressPackageStartupMessages( lib(pkgs, update=FALSE, quietly=TRUE) )

    projName <- "SpotifyAdds"
    subProj  <- "MAIN"
    wrkDir   <- "~/git/orch"
    setScience(wrkDir=wrkDir, projName=projName, subl=FALSE, loadImage=loadFromLastBackUp, testDirs=TRUE)

    ## Load in support Functions
    sourceEntireFolder(as.path(srcDir, "supportFiles", verbose=TRUE))

    SpotifyAdds.databackupfile <- as.path(srcDir, "data_to_src", "SpotifyAdds", ext=".RDS")

    fileBackUps <- c()


#    source(as.path(gsub("ES$","", srcDir), "createPlots.r"))   
#    source(as.path(srcDir, "Funcs.r"))


}
# --------------------------------------------------------------- #
