Commit 2534ce12 by Giang Tran

In progress video

parent 8d8fd6ec
......@@ -9,16 +9,33 @@
#
def run
## Get all files
#
files = get_all_video_files_current_dir
end
puts "Start to run"
run
def generate_html(file_list)
end
# Tranverse all directory
def get_all_video_files(current_dir)
Dir.glob("#{current_dir}/*.mp4") do |video_file|
puts "working on: #{my_text_file}..."
def get_all_video_files_current_dir
puts "Tranversing folders..."
file_arr = Array.new
Dir.glob("**/*.mp4") do |video_path|
tmp_arr = video_path.split('/')
file_arr.push(course_name: tmp_arr.first, mid_path: tmp_arr[1..(tmp_arr.length - 2)].join('/'), video_file: tmp_arr.last)
puts "working on: #{video_file}..."
end
file_arr
end
# Get list of video files
......@@ -27,21 +44,28 @@ end
# Generate template
#
def generate_video_playlist_html(path, video_list)
html = <<EOT
def generate_video_playlist_html(video_list)
puts "Generate html..."
html = %Q{
<html>
<head>
<title>Playlist for #{path}</title>
</head>
<body>
<ul>
EOT
}
video_list.foreach do |item| {
li = "<li><a href="item.course_name">#{item.course_name}</a></li>"
}
video_list.each do |video_file|
html + "\n<li><a href='#{video_file}'>#{video_file}</a></li>"
end
<li></li>
html = <<EOT
return html + <<EOT
</ul>
</body>
</html>
......@@ -50,7 +74,8 @@ def generate_video_playlist_html(path, video_list)
end
def generate_video_player_html(video_path)
html = <<EOT
puts "Generate video player html..."
html = %Q{
<html>
<head>
<title>#{video_path}</title>
......@@ -64,6 +89,8 @@ def generate_video_player_html(video_path)
</script>
</body>
</html>
EOT
}
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment