Added functionality to create directory structure for channels and videos
This commit is contained in:
		| @@ -2,6 +2,19 @@ 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 0 | ||||
|   end | ||||
|   | ||||
| @@ -4,6 +4,19 @@ 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 | ||||
|   | ||||
| @@ -24,7 +24,9 @@ namespace '/channel' do | ||||
|       description: params[:channel_description] | ||||
|     ) | ||||
|  | ||||
|     # create supporting directory structure | ||||
|     Dir.mkdir(channel.directory_path) | ||||
|     channel.ensureDirectoryStructure() | ||||
|  | ||||
|     redirect "/channel/#{channel.id}" | ||||
|   end | ||||
|   | ||||
| @@ -25,6 +25,7 @@ namespace '/video' do | ||||
|     video_serial = params[:video_serial].to_s.rjust(4, '0') | ||||
|     video_path = File.join( | ||||
|       channel.directory_path, | ||||
|       'Main', | ||||
|       "##{video_serial} - #{params[:video_name]}" | ||||
|     ) | ||||
|  | ||||
| @@ -37,7 +38,9 @@ namespace '/video' do | ||||
|       script: "# Introduction\n\n# Body\n\n# Conclusions" | ||||
|     ) | ||||
|  | ||||
|     # create supporting directory structure | ||||
|     Dir.mkdir(video_path) | ||||
|     video.ensureDirectoryStructure() | ||||
|  | ||||
|     redirect "/video/#{video.id}" | ||||
|   end | ||||
| @@ -72,6 +75,7 @@ namespace '/video' do | ||||
|     video_serial = params[:video_serial].to_s.rjust(4, '0') | ||||
|     video_path = File.join( | ||||
|       channel.directory_path, | ||||
|       'Main', | ||||
|       "##{video_serial} - #{params[:video_name]}" | ||||
|     ) | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <div class="row"> | ||||
|   <div class="twelve columns"> | ||||
|     <h1>Hardware Inventory List</h1> | ||||
|     <h1>Channel List</h1> | ||||
|   </div> | ||||
| </div> | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <div class="row"> | ||||
|   <div class="twelve columns"> | ||||
|     <h1>Hardware Inventory List</h1> | ||||
|     <h1>Video List</h1> | ||||
|   </div> | ||||
| </div> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user