2023-03-18 11:35:52 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'fileutils'
|
|
|
|
|
|
|
|
# Model handles YouTube channels
|
2023-03-03 13:05:01 -05:00
|
|
|
class Channel < Sequel::Model
|
|
|
|
|
|
|
|
one_to_many :videos
|
|
|
|
|
2023-03-18 11:35:52 -04:00
|
|
|
def ensure_directory_structure
|
2023-03-06 15:59:09 -05:00
|
|
|
sub_dirs = ['Archive', 'Channel Documents', 'Main', 'Shorts']
|
|
|
|
sub_dirs.each do |d|
|
|
|
|
sub_path = File.join(
|
|
|
|
@values[:directory_path],
|
|
|
|
d
|
|
|
|
)
|
2023-03-18 11:35:52 -04:00
|
|
|
FileUtils.mkdir_p(sub_path)
|
2023-03-06 15:59:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-03-18 11:35:52 -04:00
|
|
|
def open_projects
|
|
|
|
return videos_dataset.exclude(status: 'published').exclude(archived: true).all()
|
2023-03-03 14:19:20 -05:00
|
|
|
end
|
|
|
|
|
2023-03-03 13:05:01 -05:00
|
|
|
end
|