Moved lib/ to app/
This commit is contained in:
22
app/models/channel.rb
Normal file
22
app/models/channel.rb
Normal file
@ -0,0 +1,22 @@
|
||||
class Channel < Sequel::Model
|
||||
|
||||
one_to_many :videos
|
||||
|
||||
def ensureDirectoryStructure()
|
||||
sub_dirs = ['Archive', 'Channel Documents', 'Main', 'Shorts']
|
||||
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 openProjects()
|
||||
return self.videos_dataset.exclude(status: 'published').exclude(archived: true).all()
|
||||
end
|
||||
|
||||
end
|
32
app/models/video.rb
Normal file
32
app/models/video.rb
Normal file
@ -0,0 +1,32 @@
|
||||
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
|
Reference in New Issue
Block a user