2023-03-04 11:14:54 -05:00
|
|
|
require 'kramdown'
|
2023-03-07 10:01:34 -05:00
|
|
|
require 'pandoc-ruby'
|
2023-03-04 11:14:54 -05:00
|
|
|
|
2023-03-03 13:05:01 -05:00
|
|
|
class Video < Sequel::Model
|
|
|
|
|
2023-03-03 14:19:20 -05:00
|
|
|
many_to_one :channel
|
2023-03-03 13:05:01 -05:00
|
|
|
|
2023-03-06 15:59:09 -05:00
|
|
|
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
|
|
|
|
|
2023-03-07 10:01:34 -05:00
|
|
|
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
|
|
|
|
|
2023-03-03 13:05:01 -05:00
|
|
|
end
|