Added Rubocop to project; corrected style errors
This commit is contained in:
@ -1,22 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'fileutils'
|
||||
|
||||
# Model handles YouTube channels
|
||||
class Channel < Sequel::Model
|
||||
|
||||
one_to_many :videos
|
||||
|
||||
def ensureDirectoryStructure()
|
||||
def ensure_directory_structure
|
||||
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
|
||||
FileUtils.mkdir_p(sub_path)
|
||||
end
|
||||
end
|
||||
|
||||
def openProjects()
|
||||
return self.videos_dataset.exclude(status: 'published').exclude(archived: true).all()
|
||||
def open_projects
|
||||
return videos_dataset.exclude(status: 'published').exclude(archived: true).all()
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,32 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'fileutils'
|
||||
require 'kramdown'
|
||||
require 'pandoc-ruby'
|
||||
|
||||
# Model handles Video projects
|
||||
class Video < Sequel::Model
|
||||
|
||||
many_to_one :channel
|
||||
|
||||
def ensureDirectoryStructure()
|
||||
sub_dirs = ['Audio', 'B-Roll', 'Clips', 'Images', 'Export']
|
||||
def ensure_directory_structure
|
||||
sub_dirs = %w[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
|
||||
FileUtils.mkdir_p(sub_path)
|
||||
end
|
||||
end
|
||||
|
||||
def parseScript()
|
||||
return Kramdown::Document.new(@values[:script]).to_html
|
||||
def parse_script
|
||||
Kramdown::Document.new(@values[:script]).to_html
|
||||
end
|
||||
|
||||
def importScript()
|
||||
def import_script
|
||||
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()
|
||||
# save changes to the model
|
||||
save_changes()
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user