Compare commits
10 Commits
8aa6b5ac14
...
dde8ff5ea1
Author | SHA1 | Date | |
---|---|---|---|
|
dde8ff5ea1 | ||
|
ccae65f27d | ||
|
e5e2d07ce9 | ||
|
8fdaba4c0e | ||
|
58c95ccca4 | ||
|
834648bd57 | ||
|
ab3b689045 | ||
|
77adf17622 | ||
|
eda5c25af2 | ||
|
784b083c05 |
|
@ -33,7 +33,7 @@ class VideolistingsController < ApplicationController
|
||||||
|
|
||||||
# Only allow a trusted parameter "white list" through.
|
# Only allow a trusted parameter "white list" through.
|
||||||
def videolisting_params
|
def videolisting_params
|
||||||
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls)
|
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls, :on_s3)
|
||||||
end
|
end
|
||||||
|
|
||||||
def not_found
|
def not_found
|
||||||
|
|
|
@ -3,21 +3,38 @@ require 'tempfile'
|
||||||
|
|
||||||
class AmazonCopy
|
class AmazonCopy
|
||||||
def download_video videolisting
|
def download_video videolisting
|
||||||
file = Tempfile.new ["video_",".mp4"], "#{Rails.root}/tmp"
|
if not videolisting.on_s3
|
||||||
|
download_file_and_upload_to_s3 videolisting.get_video_url,
|
||||||
|
videolisting.videocode,
|
||||||
|
"mp4",
|
||||||
|
"bvideos"
|
||||||
|
|
||||||
|
download_file_and_upload_to_s3 videolisting.get_preview_url,
|
||||||
|
videolisting.videocode,
|
||||||
|
"mp4",
|
||||||
|
"bvideos_preview"
|
||||||
|
|
||||||
|
videolisting.on_s3 = true
|
||||||
|
videolisting.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
handle_asynchronously :download_video
|
||||||
|
|
||||||
|
|
||||||
|
def download_file_and_upload_to_s3 url, videocode, extension, prefix
|
||||||
|
file = Tempfile.new ["video_", ".#{extension}"], "#{Rails.root}/tmp"
|
||||||
begin
|
begin
|
||||||
file.write HTTParty.get(videolisting.get_video_url).parsed_response.force_encoding("utf-8")
|
file.write HTTParty.get(url).parsed_response.force_encoding("utf-8")
|
||||||
file.flush
|
file.flush
|
||||||
puts "File #{videolisting.videocode} downloaded."
|
|
||||||
|
|
||||||
s3 = AWS::S3.new
|
s3 = AWS::S3.new
|
||||||
obj = s3.buckets['digitalmarketingvideos'].objects["#{videolisting.videocode}.mp4"]
|
obj = s3.buckets[ENV['VIDEO_BUCKET']].objects["#{prefix}/#{videocode}.mp4"]
|
||||||
obj.write(file)
|
obj.write(file)
|
||||||
puts "File #{videolisting.videocode} uploaded."
|
|
||||||
|
|
||||||
ensure
|
ensure
|
||||||
file.close
|
file.close
|
||||||
file.unlink
|
file.unlink
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
handle_asynchronously :download_video
|
|
||||||
end
|
end
|
|
@ -9,11 +9,19 @@ class Videolisting < ActiveRecord::Base
|
||||||
after_initialize :set_defaults
|
after_initialize :set_defaults
|
||||||
|
|
||||||
def get_video_url
|
def get_video_url
|
||||||
"http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4"
|
if self.on_s3 == true
|
||||||
|
"http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos/#{videocode}.mp4"
|
||||||
|
else
|
||||||
|
"http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_preview_url
|
def get_preview_url
|
||||||
"http://video2.bettervideo.com/video/pro/jpg640x360/720.#{videocode}.jpg"
|
if self.on_s3 == true
|
||||||
|
"http://s3.amazonaws.com/#{ENV['VIDEO_BUCKET']}/bvideos_preview/#{videocode}.jpg"
|
||||||
|
else
|
||||||
|
"http://video2.bettervideo.com/video/pro/jpg640x360/720.#{videocode}.jpg"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def asseturls_array
|
def asseturls_array
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<%= frm.input :advertisername,
|
<%= frm.input :advertisername,
|
||||||
label: 'Advertiser Name',
|
label: 'Business Name',
|
||||||
hint: "The name of the company." %>
|
hint: "The name of the company." %>
|
||||||
<%= frm.input :listingcode,
|
<%= frm.input :listingcode,
|
||||||
label: 'Listing Code',
|
label: 'Listing Code',
|
||||||
hint: "Please provide the unique opportunity id." %>
|
as: :hidden %>
|
||||||
<%= frm.input :description,
|
<%= frm.input :description,
|
||||||
label: 'Description',
|
label: 'Description',
|
||||||
as: 'text',
|
as: 'text',
|
||||||
|
@ -33,24 +33,15 @@
|
||||||
label: 'Website URL',
|
label: 'Website URL',
|
||||||
hint: "Used for script research and may be used in the video if they are including websites in the video graphics." %>
|
hint: "Used for script research and may be used in the video if they are including websites in the video graphics." %>
|
||||||
<%= frm.input :vpa,
|
<%= frm.input :vpa,
|
||||||
label: 'Client Service Rep',
|
label: 'MIS Rep' %>
|
||||||
hint: "This is the full name of the client services representative, as entered in the BetterVideo system associated with this order. This feature is designed for sales reps that are well known to the system. This feature is typically used for automated communication." %>
|
|
||||||
<%= frm.input :vpa_email,
|
<%= frm.input :vpa_email,
|
||||||
label: 'Client Service Rep Email',
|
label: 'MIS Rep Email' %>
|
||||||
hint: "The Email for the above Client Service Rep, (not sent to BetterVideo, just used for video completion emails)" %>
|
|
||||||
<%= frm.input :billingcode,
|
|
||||||
label: 'Billing Code',
|
|
||||||
hint: "Market or billing code. Should match a billing code in the BetterVideo system so it can be associated." %>
|
|
||||||
<%= frm.input :emailaddress,
|
<%= frm.input :emailaddress,
|
||||||
label: 'Email Address' %>
|
label: 'Email Address' %>
|
||||||
<%= frm.input :businessphone,
|
<%= frm.input :businessphone,
|
||||||
label: 'Business Phone' %>
|
label: 'Business Phone' %>
|
||||||
<%= frm.input :contactphone,
|
|
||||||
label: 'Contact Phone' %>
|
|
||||||
<%= frm.input :customerfirstname,
|
|
||||||
label: 'Customer First Name' %>
|
|
||||||
<%= frm.input :customerlastname,
|
|
||||||
label: 'Customer Last Name' %>
|
|
||||||
<%= frm.input :address,
|
<%= frm.input :address,
|
||||||
label: 'Address' %>
|
label: 'Address' %>
|
||||||
<%= frm.input :city,
|
<%= frm.input :city,
|
||||||
|
@ -60,7 +51,6 @@
|
||||||
collection: us_states%>
|
collection: us_states%>
|
||||||
<%= frm.input :zip,
|
<%= frm.input :zip,
|
||||||
label: 'ZIP' %>
|
label: 'ZIP' %>
|
||||||
|
|
||||||
<%= frm.input :awards,
|
<%= frm.input :awards,
|
||||||
label: 'Awards',
|
label: 'Awards',
|
||||||
hint: "Used in script and video research." %>
|
hint: "Used in script and video research." %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="nested-fields videolisting_field">
|
<div class="nested-fields videolisting_field">
|
||||||
<%= f.input :videocode,
|
<%= f.input :videocode,
|
||||||
label: 'Video Code',
|
label: 'Video Code',
|
||||||
hint: "Please provide the video code id." %>
|
hint: "Please provide the opportunity id." %>
|
||||||
<%= f.input :voiceoverselection,
|
<%= f.input :voiceoverselection,
|
||||||
label: 'Voiceover Selection',
|
label: 'Voiceover Selection',
|
||||||
collection: voiceoverselection_list,
|
collection: voiceoverselection_list,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Listing Code (Form Hash)</th>
|
<th>Listing Code (Form Hash)</th>
|
||||||
<th>Advertiser</th>
|
<th>Business</th>
|
||||||
<th>Sent?</th>
|
<th>Sent?</th>
|
||||||
<th>Percent of Videos Completed</th>
|
<th>Percent of Videos Completed</th>
|
||||||
<th>Address</th>
|
<th>Address</th>
|
||||||
|
|
|
@ -34,22 +34,16 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless @campaign.vpa.blank? %>
|
<% unless @campaign.vpa.blank? %>
|
||||||
<li>
|
<li>
|
||||||
<p><strong>Client Services Rep</strong><br>
|
<p><strong>MIS Rep</strong><br>
|
||||||
<%= @campaign.vpa %></p>
|
<%= @campaign.vpa %></p>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless @campaign.vpa_email.blank? %>
|
<% unless @campaign.vpa_email.blank? %>
|
||||||
<li>
|
<li>
|
||||||
<p><strong>Client Services Rep Email</strong><br>
|
<p><strong>MIS Rep Email</strong><br>
|
||||||
<%= @campaign.vpa_email %></p>
|
<%= @campaign.vpa_email %></p>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless @campaign.billingcode.blank? %>
|
|
||||||
<li>
|
|
||||||
<p><strong>Billing Code</strong><br>
|
|
||||||
<%= @campaign.billingcode %></p>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% unless @campaign.emailaddress.blank? %>
|
<% unless @campaign.emailaddress.blank? %>
|
||||||
<li>
|
<li>
|
||||||
<p><strong>Email Address</strong><br>
|
<p><strong>Email Address</strong><br>
|
||||||
|
@ -62,24 +56,6 @@
|
||||||
<%= number_to_phone @campaign.businessphone %></p>
|
<%= number_to_phone @campaign.businessphone %></p>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless @campaign.contactphone.blank? %>
|
|
||||||
<li>
|
|
||||||
<p><strong>Contact Phone</strong><br>
|
|
||||||
<%= number_to_phone @campaign.contactphone %></p>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% unless @campaign.customerfirstname.blank? %>
|
|
||||||
<li>
|
|
||||||
<p><strong>Customer First Name</strong><br>
|
|
||||||
<%= @campaign.customerfirstname %></p>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% unless @campaign.customerlastname.blank? %>
|
|
||||||
<li>
|
|
||||||
<p><strong>Customer Last Name</strong><br>
|
|
||||||
<%= @campaign.customerlastname %></p>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% unless @campaign.address.blank? %>
|
<% unless @campaign.address.blank? %>
|
||||||
<li>
|
<li>
|
||||||
<p><strong>Address</strong><br>
|
<p><strong>Address</strong><br>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
<div class="video-js-responsive-container">
|
<div class="video-js-responsive-container">
|
||||||
<video class="video-js vjs-blue-skin" id="bvVideo1" preload="auto" controls>
|
<video class="video-js vjs-blue-skin" id="bvVideo1" preload="auto" controls>
|
||||||
<source src="//video2.bettervideo.com/video/PRO/MP4640x360/720.<%= @videolisting.videocode %>.mp4" type="video/mp4"></source> <!-- Video URL goes here" -->
|
<source src="<%= @videolisting.get_video_url %>" type="video/mp4"></source> <!-- Video URL goes here" -->
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,5 +14,7 @@ Vidpush::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
match "/djweb" => DelayedJobWeb, :anchor => false, via: [:get, :post]
|
authenticated :user do
|
||||||
|
match "/djweb" => DelayedJobWeb, :anchor => false, via: [:get, :post]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
5
db/migrate/20140529180650_add_on_s3_to_videolisting.rb
Normal file
5
db/migrate/20140529180650_add_on_s3_to_videolisting.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddOnS3ToVideolisting < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :videolistings, :on_s3, :boolean, default: nil
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
class RemoveContactphoneCustomerfirstnameCustomerlastnameBillingcodeFromCampaign < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_column :campaigns, :customerfirstname
|
||||||
|
remove_column :campaigns, :customerlastname
|
||||||
|
remove_column :campaigns, :contactphone
|
||||||
|
remove_column :campaigns, :billingcode
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20140505153412) do
|
ActiveRecord::Schema.define(version: 20140707163626) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -37,17 +37,13 @@ ActiveRecord::Schema.define(version: 20140505153412) do
|
||||||
create_table "campaigns", force: true do |t|
|
create_table "campaigns", force: true do |t|
|
||||||
t.integer "clientid"
|
t.integer "clientid"
|
||||||
t.string "listingcode"
|
t.string "listingcode"
|
||||||
t.string "billingcode"
|
|
||||||
t.string "advertisername"
|
t.string "advertisername"
|
||||||
t.string "address"
|
t.string "address"
|
||||||
t.string "city"
|
t.string "city"
|
||||||
t.string "state"
|
t.string "state"
|
||||||
t.string "zip"
|
t.string "zip"
|
||||||
t.string "emailaddress"
|
t.string "emailaddress"
|
||||||
t.string "customerfirstname"
|
|
||||||
t.string "customerlastname"
|
|
||||||
t.string "businessphone"
|
t.string "businessphone"
|
||||||
t.string "contactphone"
|
|
||||||
t.string "websiteurl"
|
t.string "websiteurl"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
@ -113,6 +109,7 @@ ActiveRecord::Schema.define(version: 20140505153412) do
|
||||||
t.integer "campaign_id"
|
t.integer "campaign_id"
|
||||||
t.string "toneofvideo"
|
t.string "toneofvideo"
|
||||||
t.boolean "published"
|
t.boolean "published"
|
||||||
|
t.boolean "on_s3"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,6 @@ FactoryGirl.define do
|
||||||
|
|
||||||
factory :campaign do
|
factory :campaign do
|
||||||
# clientid 720
|
# clientid 720
|
||||||
sequence(:billingcode) { |x| "billingcode#{x}" }
|
|
||||||
sequence(:listingcode) { |x| "listingcode#{x}" }
|
sequence(:listingcode) { |x| "listingcode#{x}" }
|
||||||
address "123 Anywhere Street"
|
address "123 Anywhere Street"
|
||||||
advertisername "Bob's BBQ"
|
advertisername "Bob's BBQ"
|
||||||
|
@ -12,9 +11,6 @@ FactoryGirl.define do
|
||||||
categories "Food, BBQ, Southern California, Restaurant, Cooking"
|
categories "Food, BBQ, Southern California, Restaurant, Cooking"
|
||||||
city "Some City"
|
city "Some City"
|
||||||
companycolors "Brown, Red"
|
companycolors "Brown, Red"
|
||||||
contactphone "5555551212"
|
|
||||||
customerfirstname "Bob"
|
|
||||||
customerlastname "De Bbq"
|
|
||||||
description "Bob's BBQ is the best BBQ in the Some City area of Southern Cali"
|
description "Bob's BBQ is the best BBQ in the Some City area of Southern Cali"
|
||||||
emailaddress "bob@bobsbbq.com"
|
emailaddress "bob@bobsbbq.com"
|
||||||
facebookurl "facebook.com/bobsbbq"
|
facebookurl "facebook.com/bobsbbq"
|
||||||
|
|
|
@ -9,6 +9,7 @@ FactoryGirl.define do
|
||||||
producttypeid 721
|
producttypeid 721
|
||||||
toneofvideo "Upbeat, targeting families but also show business functions."
|
toneofvideo "Upbeat, targeting families but also show business functions."
|
||||||
voiceoverselection 3
|
voiceoverselection 3
|
||||||
|
on_s3 false
|
||||||
published {|x| false }
|
published {|x| false }
|
||||||
sequence(:videocode) {|x| "video#{x}" }
|
sequence(:videocode) {|x| "video#{x}" }
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,11 +21,11 @@ describe Videolisting, 'associations' do
|
||||||
|
|
||||||
it "can get a video url" do
|
it "can get a video url" do
|
||||||
video = FactoryGirl.build(:videolisting)
|
video = FactoryGirl.build(:videolisting)
|
||||||
expect(video.get_video_url).to include("http://video2.bettervideo.com/video/pro/MP4640x360/720")
|
expect(video.get_video_url).to include("#{video.videocode}.mp4")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can get a preview url" do
|
it "can get a preview url" do
|
||||||
video = FactoryGirl.build(:videolisting)
|
video = FactoryGirl.build(:videolisting)
|
||||||
expect(video.get_preview_url).to include("http://video2.bettervideo.com/video/pro/jpg640x360/720.")
|
expect(video.get_preview_url).to include("#{video.videocode}.jpg")
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user