Created
May 24, 2015 14:32
-
-
Save ysinc88/618a8c8a5e499559f166 to your computer and use it in GitHub Desktop.
Execute bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><%= @download %></h1> | |
<%= link_to "download", download_path(:ydit => "SB8-YY2DyHI") %> | |
<ul> | |
<% @mp3s.each do |m| %> | |
<li><%= m %></li> | |
<% end %> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WelcomeController < ApplicationController | |
def index | |
dir="app/assets/mp3/" | |
@mp3s = Dir.entries(dir).reject{|entry| entry == "." || entry == ".."} | |
if @downloads | |
puts @download | |
end | |
v = params[:ytid] | |
@download = !%x[scripts/ytdown.sh v] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!#/bin/bash | |
youtube-dl -x --audio-format mp3 --embed-thumbnail -o '/var/www/html/ytdown/app/assets/mp3/%(title)s.%(ext)s' https://www.youtube.com/watch?v=$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment