stage-manager/app/models/video.rb

33 lines
713 B
Ruby
Raw Normal View History

2023-03-04 11:14:54 -05:00
require 'kramdown'
require 'pandoc-ruby'
2023-03-04 11:14:54 -05:00
class Video < Sequel::Model
many_to_one :channel
def ensureDirectoryStructure()
sub_dirs = ['Audio', 'B-Roll', 'Clips', 'Images', 'Export']
sub_dirs.each do |d|
sub_path = File.join(
@values[:directory_path],
d
)
unless Dir.exist?(sub_path)
Dir.mkdir(sub_path)
end
end
end
2023-03-04 11:14:54 -05:00
def parseScript()
return Kramdown::Document.new(@values[:script]).to_html
end
def importScript()
scripts = Dir.glob("#{@values[:directory_path]}/*Script.docx")
script_content = PandocRuby.convert([scripts[0].dump()], from: :docx, to: :markdown)
@values[:script] = script_content
self.save()
end
end