Commit 2534ce12 by Giang Tran

In progress video

parent 8d8fd6ec
...@@ -9,16 +9,33 @@ ...@@ -9,16 +9,33 @@
# #
def run def run
## Get all files
#
files = get_all_video_files_current_dir
end end
puts "Start to run"
run
def generate_html(file_list) def generate_html(file_list)
end
# Tranverse all directory # Tranverse all directory
def get_all_video_files(current_dir) def get_all_video_files_current_dir
Dir.glob("#{current_dir}/*.mp4") do |video_file| puts "Tranversing folders..."
puts "working on: #{my_text_file}..." 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 end
file_arr
end end
# Get list of video files # Get list of video files
...@@ -27,21 +44,28 @@ end ...@@ -27,21 +44,28 @@ end
# Generate template # Generate template
def generate_video_playlist_html(video_list)
puts "Generate html..."
# html = %Q{
def generate_video_playlist_html(path, video_list)
html = <<EOT
<html> <html>
<head> <head>
<title>Playlist for #{path}</title> <title>Playlist for #{path}</title>
</head> </head>
<body> <body>
<ul> <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> </ul>
</body> </body>
</html> </html>
...@@ -50,7 +74,8 @@ def generate_video_playlist_html(path, video_list) ...@@ -50,7 +74,8 @@ def generate_video_playlist_html(path, video_list)
end end
def generate_video_player_html(video_path) def generate_video_player_html(video_path)
html = <<EOT puts "Generate video player html..."
html = %Q{
<html> <html>
<head> <head>
<title>#{video_path}</title> <title>#{video_path}</title>
...@@ -64,6 +89,8 @@ def generate_video_player_html(video_path) ...@@ -64,6 +89,8 @@ def generate_video_player_html(video_path)
</script> </script>
</body> </body>
</html> </html>
EOT }
end 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