stage-manager/app/models/channel.rb

26 lines
508 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'fileutils'
# Model handles YouTube channels
class Channel < Sequel::Model
one_to_many :videos
def ensure_directory_structure
sub_dirs = ['Archive', 'Channel Documents', 'Main', 'Shorts']
sub_dirs.each do |d|
sub_path = File.join(
@values[:directory_path],
d
)
FileUtils.mkdir_p(sub_path)
end
end
def open_projects
return videos_dataset.exclude(status: 'published').exclude(archived: true).all()
end
end