Separated the repository initialization into a separate sub-command
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2022-09-15 10:04:39 -04:00
parent 076947ebf9
commit 4d77a0e2bc
6 changed files with 100 additions and 26 deletions

View File

@ -14,6 +14,7 @@ type Repository struct {
outputPath string
}
// Repository struct constructor
func NewRepository(path string) *Repository {
r := new(Repository)
r.basePath = path
@ -21,13 +22,6 @@ func NewRepository(path string) *Repository {
r.archivePath = filepath.Join(path, "archive")
r.outputPath = filepath.Join(path, "output")
// make sure repository base directory exists
create_repo_dir(r.basePath)
// make sure the folder structure is setup
create_repo_dir(r.ingestPath)
create_repo_dir(r.archivePath)
create_repo_dir(r.archivePath)
return r
}
@ -39,6 +33,16 @@ func (r *Repository) GetOutputPath() string {
return r.outputPath
}
// Initializes the video repository by ensuring the directories are available
func (r *Repository) Setup() {
// make sure repository base directory exists
create_repo_dir(r.basePath)
// make sure the folder structure is setup
create_repo_dir(r.ingestPath)
create_repo_dir(r.archivePath)
create_repo_dir(r.archivePath)
}
func (r *Repository) SearchIngest() []os.FileInfo {
log.Printf("Searching ingest directory for files to transcode...")