Added functionality to initialize video repository

This commit is contained in:
Gregory Ballantine 2022-08-31 00:43:19 -04:00
parent a8cd5d3d54
commit 4273bfbbae
3 changed files with 31 additions and 0 deletions

18
src/repository.rb Normal file
View File

@ -0,0 +1,18 @@
require_relative 'util.rb'
class Repository
def initialize(path)
@basePath = path
# create repository base directory
createDirectory(@basePath)
# create sub-directories
subPaths = ['ingest', 'archive', 'output']
subPaths.each { |p|
createDirectory(File.join(@basePath, p))
}
end
end

7
src/util.rb Normal file
View File

@ -0,0 +1,7 @@
def createDirectory(path)
if Dir.exists?(path)
puts "Directory #{path} already exists."
else
puts "Creating directory #{path}."
end
end

View File

@ -1,7 +1,13 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative 'config.rb' require_relative 'config.rb'
require_relative 'repository.rb'
# create new configuration instance
c = Config.new('~/.config/zealot.toml') c = Config.new('~/.config/zealot.toml')
# create new repository instance
r = Repository.new(c.get('transcoder.repository'))
# print repository directory as a test
puts c.get('transcoder.repository') puts c.get('transcoder.repository')