Skip to content

Instantly share code, notes, and snippets.

@ysinc88
Created May 24, 2015 14:32
Show Gist options
  • Save ysinc88/618a8c8a5e499559f166 to your computer and use it in GitHub Desktop.
Save ysinc88/618a8c8a5e499559f166 to your computer and use it in GitHub Desktop.
Execute bash script
<h1><%= @download %></h1>
<%= link_to "download", download_path(:ydit => "SB8-YY2DyHI") %>
<ul>
<% @mp3s.each do |m| %>
<li><%= m %></li>
<% end %>
</ul>
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
!#/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