33 lines
713 B
Ruby
33 lines
713 B
Ruby
require 'kramdown'
|
|
require 'pandoc-ruby'
|
|
|
|
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
|
|
|
|
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
|