Compare commits

..

No commits in common. "dde8ff5ea1f699048f41a43bbea3ea0266f8f290" and "8aa6b5ac144a49849b9c86c9ab64b445cc3391cf" have entirely different histories.

15 changed files with 67 additions and 68 deletions

View File

@ -33,7 +33,7 @@ class VideolistingsController < ApplicationController
# Only allow a trusted parameter "white list" through.
def videolisting_params
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls, :on_s3)
params.require(:videolisting).permit(:videocode, :producttypeid, :remoteassetsarchive, :voiceoverselection, :musicselection, :clientprovidedscript, :keywords, :focus, :notes, :asseturls)
end
def not_found

View File

@ -3,38 +3,21 @@ require 'tempfile'
class AmazonCopy
def download_video videolisting
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"
file = Tempfile.new ["video_",".mp4"], "#{Rails.root}/tmp"
begin
file.write HTTParty.get(url).parsed_response.force_encoding("utf-8")
file.write HTTParty.get(videolisting.get_video_url).parsed_response.force_encoding("utf-8")
file.flush
puts "File #{videolisting.videocode} downloaded."
s3 = AWS::S3.new
obj = s3.buckets[ENV['VIDEO_BUCKET']].objects["#{prefix}/#{videocode}.mp4"]
obj = s3.buckets['digitalmarketingvideos'].objects["#{videolisting.videocode}.mp4"]
obj.write(file)
puts "File #{videolisting.videocode} uploaded."
ensure
file.close
file.unlink
end
end
handle_asynchronously :download_video
end

View File

@ -9,19 +9,11 @@ class Videolisting < ActiveRecord::Base
after_initialize :set_defaults
def get_video_url
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
"http://video2.bettervideo.com/video/pro/MP4640x360/720.#{videocode}.mp4"
end
def get_preview_url
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
"http://video2.bettervideo.com/video/pro/jpg640x360/720.#{videocode}.jpg"
end
def asseturls_array

View File

@ -17,11 +17,11 @@
<div class="row">
<div class="col-md-8">
<%= frm.input :advertisername,
label: 'Business Name',
label: 'Advertiser Name',
hint: "The name of the company." %>
<%= frm.input :listingcode,
label: 'Listing Code',
as: :hidden %>
hint: "Please provide the unique opportunity id." %>
<%= frm.input :description,
label: 'Description',
as: 'text',
@ -33,15 +33,24 @@
label: 'Website URL',
hint: "Used for script research and may be used in the video if they are including websites in the video graphics." %>
<%= frm.input :vpa,
label: 'MIS Rep' %>
label: 'Client Service 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,
label: 'MIS Rep Email' %>
<%= frm.input :emailaddress,
label: 'Client Service 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,
label: 'Email Address' %>
<%= frm.input :businessphone,
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,
label: 'Address' %>
<%= frm.input :city,
@ -51,6 +60,7 @@
collection: us_states%>
<%= frm.input :zip,
label: 'ZIP' %>
<%= frm.input :awards,
label: 'Awards',
hint: "Used in script and video research." %>

View File

@ -1,7 +1,7 @@
<div class="nested-fields videolisting_field">
<%= f.input :videocode,
label: 'Video Code',
hint: "Please provide the opportunity id." %>
hint: "Please provide the video code id." %>
<%= f.input :voiceoverselection,
label: 'Voiceover Selection',
collection: voiceoverselection_list,

View File

@ -4,7 +4,7 @@
<thead>
<tr>
<th>Listing Code (Form Hash)</th>
<th>Business</th>
<th>Advertiser</th>
<th>Sent?</th>
<th>Percent of Videos Completed</th>
<th>Address</th>

View File

@ -34,16 +34,22 @@
<% end %>
<% unless @campaign.vpa.blank? %>
<li>
<p><strong>MIS Rep</strong><br>
<p><strong>Client Services Rep</strong><br>
<%= @campaign.vpa %></p>
</li>
<% end %>
<% unless @campaign.vpa_email.blank? %>
<li>
<p><strong>MIS Rep Email</strong><br>
<p><strong>Client Services Rep Email</strong><br>
<%= @campaign.vpa_email %></p>
</li>
<% end %>
<% unless @campaign.billingcode.blank? %>
<li>
<p><strong>Billing Code</strong><br>
<%= @campaign.billingcode %></p>
</li>
<% end %>
<% unless @campaign.emailaddress.blank? %>
<li>
<p><strong>Email Address</strong><br>
@ -56,6 +62,24 @@
<%= number_to_phone @campaign.businessphone %></p>
</li>
<% 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? %>
<li>
<p><strong>Address</strong><br>

View File

@ -25,7 +25,7 @@
<div class="video-js-responsive-container">
<video class="video-js vjs-blue-skin" id="bvVideo1" preload="auto" controls>
<source src="<%= @videolisting.get_video_url %>" type="video/mp4"></source> <!-- Video URL goes here" -->
<source src="//video2.bettervideo.com/video/PRO/MP4640x360/720.<%= @videolisting.videocode %>.mp4" type="video/mp4"></source> <!-- Video URL goes here" -->
</video>
</div>

View File

@ -14,7 +14,5 @@ Vidpush::Application.routes.draw do
end
end
authenticated :user do
match "/djweb" => DelayedJobWeb, :anchor => false, via: [:get, :post]
end
match "/djweb" => DelayedJobWeb, :anchor => false, via: [:get, :post]
end

View File

@ -1,5 +0,0 @@
class AddOnS3ToVideolisting < ActiveRecord::Migration
def change
add_column :videolistings, :on_s3, :boolean, default: nil
end
end

View File

@ -1,9 +0,0 @@
class RemoveContactphoneCustomerfirstnameCustomerlastnameBillingcodeFromCampaign < ActiveRecord::Migration
def change
remove_column :campaigns, :customerfirstname
remove_column :campaigns, :customerlastname
remove_column :campaigns, :contactphone
remove_column :campaigns, :billingcode
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140707163626) do
ActiveRecord::Schema.define(version: 20140505153412) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -37,13 +37,17 @@ ActiveRecord::Schema.define(version: 20140707163626) do
create_table "campaigns", force: true do |t|
t.integer "clientid"
t.string "listingcode"
t.string "billingcode"
t.string "advertisername"
t.string "address"
t.string "city"
t.string "state"
t.string "zip"
t.string "emailaddress"
t.string "customerfirstname"
t.string "customerlastname"
t.string "businessphone"
t.string "contactphone"
t.string "websiteurl"
t.datetime "created_at"
t.datetime "updated_at"
@ -109,7 +113,6 @@ ActiveRecord::Schema.define(version: 20140707163626) do
t.integer "campaign_id"
t.string "toneofvideo"
t.boolean "published"
t.boolean "on_s3"
end
end

View File

@ -2,6 +2,7 @@ FactoryGirl.define do
factory :campaign do
# clientid 720
sequence(:billingcode) { |x| "billingcode#{x}" }
sequence(:listingcode) { |x| "listingcode#{x}" }
address "123 Anywhere Street"
advertisername "Bob's BBQ"
@ -11,6 +12,9 @@ FactoryGirl.define do
categories "Food, BBQ, Southern California, Restaurant, Cooking"
city "Some City"
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"
emailaddress "bob@bobsbbq.com"
facebookurl "facebook.com/bobsbbq"

View File

@ -9,7 +9,6 @@ FactoryGirl.define do
producttypeid 721
toneofvideo "Upbeat, targeting families but also show business functions."
voiceoverselection 3
on_s3 false
published {|x| false }
sequence(:videocode) {|x| "video#{x}" }
end

View File

@ -21,11 +21,11 @@ describe Videolisting, 'associations' do
it "can get a video url" do
video = FactoryGirl.build(:videolisting)
expect(video.get_video_url).to include("#{video.videocode}.mp4")
expect(video.get_video_url).to include("http://video2.bettervideo.com/video/pro/MP4640x360/720")
end
it "can get a preview url" do
video = FactoryGirl.build(:videolisting)
expect(video.get_preview_url).to include("#{video.videocode}.jpg")
expect(video.get_preview_url).to include("http://video2.bettervideo.com/video/pro/jpg640x360/720.")
end
end