wco_models 3.1.0.219 → 3.1.0.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wco/newsvideos_newspartials.scss +31 -0
- data/app/controllers/wco/api/newspartials_controller.rb +52 -0
- data/app/controllers/wco/api/videos_controller.rb +28 -0
- data/app/controllers/wco/api_controller.rb +10 -0
- data/app/controllers/wco/leadsets_controller.rb +0 -4
- data/app/controllers/wco/newspartials_controller.rb +95 -0
- data/app/controllers/wco/newsvideos_controller.rb +102 -0
- data/app/controllers/wco/reports_controller.rb +4 -0
- data/app/helpers/wco/application_helper.rb +4 -0
- data/app/models/wco/newspartial.rb +76 -0
- data/app/models/wco/newsvideo.rb +41 -0
- data/app/models/wco/profile.rb +1 -1
- data/app/models/wco/tag.rb +6 -3
- data/app/models/wco/video.rb +4 -2
- data/app/views/wco/_main_header.haml +1 -0
- data/app/views/wco/leadsets/_form.haml +7 -7
- data/app/views/wco/leadsets/show.haml +0 -6
- data/app/views/wco/newspartials/_form.haml +20 -0
- data/app/views/wco/newspartials/_show_in_newsvideo.haml +31 -0
- data/app/views/wco/newspartials/index.haml-trash +6 -0
- data/app/views/wco/newspartials/new.haml +4 -0
- data/app/views/wco/newsvideos/_form.haml +28 -0
- data/app/views/wco/newsvideos/_header_mini.haml +8 -0
- data/app/views/wco/newsvideos/edit.haml +2 -0
- data/app/views/wco/newsvideos/index.haml +6 -0
- data/app/views/wco/newsvideos/new.haml +4 -0
- data/app/views/wco/newsvideos/show.haml +10 -0
- data/app/views/wco/reports/_form.haml +4 -0
- data/app/views/wco/reports/edit.haml +1 -1
- data/app/views/wco/reports/show.haml +18 -0
- data/app/views/wco/videos/show.haml +2 -1
- data/config/routes.rb +13 -0
- metadata +19 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f69322c6f97753488603d03b7438b7855f404df3b30dfc195c9b67ab4d2bc9c
|
|
4
|
+
data.tar.gz: e075c71ede3d49b95c7163f2224c58aee5879db95c226a215ad730c27331e68e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a82bb730896e49d3ba7402d9fee427a08c89060784c4b2506517303aae8f7ecbbb2e2cee94dbd11c1caf4cb3df5c721c20bf40b628527ce309904d6c1cece5d
|
|
7
|
+
data.tar.gz: 10849ffee5a49bfcbfae302eb76cbaace4913ae472a41f817a9ef570968999636102225a5c2728354dfd1e697b79696c9f6a7b964abe29818e18c0a13d246beb
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
.Timeline {
|
|
3
|
+
border: 1px solid blue;
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
.full-text {
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 300px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.main {
|
|
12
|
+
width: 200px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
.ts { /* timestamp */
|
|
17
|
+
position: absolute;
|
|
18
|
+
.word {
|
|
19
|
+
border: 1px solid cyan;
|
|
20
|
+
left: 100px;
|
|
21
|
+
position: absolute;
|
|
22
|
+
}
|
|
23
|
+
.wtime {
|
|
24
|
+
border: 1px solid yellow;
|
|
25
|
+
left: 20px;
|
|
26
|
+
position: absolute;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
class Wco::Api::NewspartialsController < Wco::ApiController
|
|
3
|
+
|
|
4
|
+
skip_before_action :decode_jwt
|
|
5
|
+
skip_before_action :verify_authenticity_token
|
|
6
|
+
before_action :decode_simple_api_key
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def add_config
|
|
10
|
+
puts! params, 'api newspartials#add_config params'
|
|
11
|
+
|
|
12
|
+
@newspartial = Wco::Newspartial.find params[:id]
|
|
13
|
+
authorize! :create, @newspartial
|
|
14
|
+
|
|
15
|
+
raw_payload = request.raw_post
|
|
16
|
+
# parsed_payload = JSON.parse(raw_payload)
|
|
17
|
+
@newspartial.config_json = raw_payload
|
|
18
|
+
|
|
19
|
+
if @newspartial.save
|
|
20
|
+
puts! @newspartial, 'added config to a newspartial.'
|
|
21
|
+
flash[:notice] = 'Success'
|
|
22
|
+
render json: { status: :ok, message: 'added config to a newspartial.' }
|
|
23
|
+
else
|
|
24
|
+
flash[:alert] = 'No luck'
|
|
25
|
+
render json: { status: :not_ok, message: "Could not add config to newspartial: #{@newspartial.errors.full_messages.join(', ')}." }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def create
|
|
31
|
+
puts! params, 'api newspartials#create params'
|
|
32
|
+
|
|
33
|
+
@newspartial = Wco::Newspartial.new params[:newspartial].permit!
|
|
34
|
+
@newspartial.author = Wco::Profile.find_by email: current_user.email
|
|
35
|
+
authorize! :create, @newspartial
|
|
36
|
+
|
|
37
|
+
if @newspartial.save
|
|
38
|
+
puts! @newspartial, 'Created a newspartial.'
|
|
39
|
+
flash[:notice] = 'Success'
|
|
40
|
+
render json: { status: :ok, message: @newspartial.attributes }
|
|
41
|
+
else
|
|
42
|
+
flash[:alert] = 'No luck'
|
|
43
|
+
render json: { status: :not_ok, message: "Could not create a newspartial: #{@newspartial.errors.full_messages.join(', ')}." }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def show_config
|
|
48
|
+
@newspartial = Wco::Newspartial.find params[:id]
|
|
49
|
+
render json: @newspartial.speech_json
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
class Wco::Api::VideosController < Wco::ApiController
|
|
3
|
+
|
|
4
|
+
skip_before_action :decode_jwt
|
|
5
|
+
skip_before_action :verify_authenticity_token, only: [:create]
|
|
6
|
+
before_action :decode_simple_api_key
|
|
7
|
+
|
|
8
|
+
def create
|
|
9
|
+
# puts! params, 'api videos#create params'
|
|
10
|
+
|
|
11
|
+
@video = Wco::Video.new({ name: params[:name],
|
|
12
|
+
thumb: params[:thumb],
|
|
13
|
+
video: params[:video],
|
|
14
|
+
newspartial_id: params[:newspartial_id],
|
|
15
|
+
})
|
|
16
|
+
authorize! :create, @video
|
|
17
|
+
|
|
18
|
+
if @video.save
|
|
19
|
+
puts! @video, 'Created @video.'
|
|
20
|
+
flash[:notice] = 'Success'
|
|
21
|
+
render json: { status: :ok, message: @video.attributes }
|
|
22
|
+
else
|
|
23
|
+
flash[:alert] = 'No luck'
|
|
24
|
+
render json: { status: :not_ok, message: 'Could not create video.' }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -16,4 +16,14 @@ class Wco::ApiController < ActionController::Base
|
|
|
16
16
|
sign_in user
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def decode_simple_api_key
|
|
20
|
+
if params[:api_key] === SIMPLE_API_KEY &&
|
|
21
|
+
params[:api_secret] === SIMPLE_API_SECRET
|
|
22
|
+
user = User.find_by({ email: 'piousbox@gmail.com' })
|
|
23
|
+
sign_in user
|
|
24
|
+
else
|
|
25
|
+
throw :unauthorized
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
19
29
|
end
|
|
@@ -63,10 +63,6 @@ class Wco::LeadsetsController < Wco::ApplicationController
|
|
|
63
63
|
@leads = @leadset.leads.page( params[:leads_page] ).per( current_profile.per_page )
|
|
64
64
|
@subscriptions = @leadset.subscriptions
|
|
65
65
|
@invoices = @leadset.invoices
|
|
66
|
-
|
|
67
|
-
@prices = @leadset.appliance_tmpls
|
|
68
|
-
## _TODO: can remove
|
|
69
|
-
@all_prices = Wco::Price.all
|
|
70
66
|
end
|
|
71
67
|
|
|
72
68
|
def update
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
class Wco::NewspartialsController < Wco::ApplicationController
|
|
3
|
+
|
|
4
|
+
before_action :set_lists
|
|
5
|
+
|
|
6
|
+
def create
|
|
7
|
+
params[:newspartial][:tag_ids]&.delete ''
|
|
8
|
+
|
|
9
|
+
@newspartial = Wco::Newspartial.new params[:newspartial].permit!
|
|
10
|
+
authorize! :create, @newspartial
|
|
11
|
+
|
|
12
|
+
if @newspartial.save
|
|
13
|
+
flash_notice "created newspartial"
|
|
14
|
+
else
|
|
15
|
+
flash_alert "Cannot create newspartial: #{@newspartial.errors.messages}"
|
|
16
|
+
end
|
|
17
|
+
redirect_to controller: 'newsvideos', id: @newspartial.newsvideo_id, action: 'show'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def destroy
|
|
21
|
+
@newspartial = Wco::Newspartial.find params[:id]
|
|
22
|
+
authorize! :destroy, @newspartial
|
|
23
|
+
if @newspartial.destroy
|
|
24
|
+
flash_notice 'ok'
|
|
25
|
+
else
|
|
26
|
+
flash_alert 'No luck.'
|
|
27
|
+
end
|
|
28
|
+
redirect_to action: 'index'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def edit
|
|
32
|
+
@newspartial = Wco::Newspartial.unscoped.find params[:id]
|
|
33
|
+
authorize! :edit, @newspartial
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def generate_speech
|
|
37
|
+
@newspartial = Wco::Newspartial.unscoped.find params[:id]
|
|
38
|
+
authorize! :show, @newspartial
|
|
39
|
+
@newspartial.generate_speech
|
|
40
|
+
redirect_to controller: 'newsvideos', id: @newspartial.newsvideo_id, action: 'show'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def generate_video
|
|
44
|
+
@newspartial = Wco::Newspartial.unscoped.find params[:id]
|
|
45
|
+
authorize! :show, @newspartial
|
|
46
|
+
@newspartial.generate_video
|
|
47
|
+
redirect_to controller: 'newsvideos', id: @newspartial.newsvideo_id, action: 'show'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def index
|
|
51
|
+
authorize! :index, Wco::Newspartial
|
|
52
|
+
@newspartials = Wco::Newspartial.all
|
|
53
|
+
if params[:deleted]
|
|
54
|
+
@newspartials = Wco::Newspartial.unscoped.where( :deleted_at.ne => nil )
|
|
55
|
+
end
|
|
56
|
+
@newspartials = @newspartials.page( params[:newspartials_page] ).per( current_profile.per_page )
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def new
|
|
60
|
+
authorize! :new, Wco::Newspartial
|
|
61
|
+
@newspartial = Wco::Newspartial.new
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def show
|
|
65
|
+
@newspartial = Wco::Newspartial.unscoped.find params[:id]
|
|
66
|
+
authorize! :show, @newspartial
|
|
67
|
+
|
|
68
|
+
# @config = JSON.parse( @newspartial.config_json )
|
|
69
|
+
# @duration_ms = @config['vtimes'].last.to_i + @config['vdurations'].last.to_i
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def update
|
|
73
|
+
params[:newspartial][:tag_ids]&.delete ''
|
|
74
|
+
|
|
75
|
+
@newspartial = Wco::Newspartial.unscoped.find params[:id]
|
|
76
|
+
authorize! :update, @newspartial
|
|
77
|
+
if @newspartial.update params[:newspartial].permit!
|
|
78
|
+
flash_notice "updated newspartial"
|
|
79
|
+
else
|
|
80
|
+
flash_alert "Cannot update newspartial: #{@newspartial.errors.messages}"
|
|
81
|
+
end
|
|
82
|
+
redirect_to action: 'index'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
##
|
|
86
|
+
## private
|
|
87
|
+
##
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def set_lists
|
|
91
|
+
@tags_list = Wco::Tag.list
|
|
92
|
+
@newsvideos_list = Wco::Newsvideo.list
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
require 'net/ssh'
|
|
2
|
+
|
|
3
|
+
class Wco::NewsvideosController < Wco::ApplicationController
|
|
4
|
+
|
|
5
|
+
before_action :set_lists
|
|
6
|
+
|
|
7
|
+
def create
|
|
8
|
+
params[:newsvideo][:tag_ids]&.delete ''
|
|
9
|
+
|
|
10
|
+
@newsvideo = Wco::Newsvideo.new params[:newsvideo].permit!
|
|
11
|
+
authorize! :create, @newsvideo
|
|
12
|
+
@newsvideo.author = current_profile
|
|
13
|
+
if @newsvideo.save
|
|
14
|
+
flash_notice "created newsvideo"
|
|
15
|
+
else
|
|
16
|
+
flash_alert "Cannot create newsvideo: #{@newsvideo.errors.messages}"
|
|
17
|
+
end
|
|
18
|
+
redirect_to action: 'index'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def destroy
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def edit
|
|
25
|
+
@newsvideo = Wco::Newsvideo.unscoped.find params[:id]
|
|
26
|
+
authorize! :edit, @newsvideo
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def generate_illustration
|
|
30
|
+
@newsvideo = Wco::Newsvideo.unscoped.find params[:id]
|
|
31
|
+
authorize! :edit, @newsvideo
|
|
32
|
+
|
|
33
|
+
cmd = " cd /opt/projects/simple_ai_1/src/Stability ; \
|
|
34
|
+
wget --user-agent='Mozilla/5.0' -O input.png #{params[:image_url]} ";
|
|
35
|
+
|
|
36
|
+
cmd_1 = " . zenv_stability/bin/activate ; \
|
|
37
|
+
rm -rf out ; \
|
|
38
|
+
python scripts/minimal_run.py ";
|
|
39
|
+
|
|
40
|
+
cmd_2 = " ffmpeg -framerate 7 -i out/frames/frame_%04d.png -c:v libx264 -pix_fmt yuv420p out/output.mp4 ; \
|
|
41
|
+
|
|
42
|
+
curl -v -X POST '#{WCO_ORIGIN_2}/wco/api/videos/?api_key=#{SIMPLE_API_KEY}&api_secret=#{SIMPLE_API_SECRET}' \
|
|
43
|
+
-H 'Accept: application/json' \
|
|
44
|
+
-F 'video=@out/output.mp4' \
|
|
45
|
+
-F 'thumb=@out/frames/frame_0000.png' \
|
|
46
|
+
-F 'name=#{@newsvideo.title}' \
|
|
47
|
+
-D 'newsvideo_id=#{params[:id]}' ";
|
|
48
|
+
|
|
49
|
+
out = `ssh pc-ai " whoami ; pwd ; #{cmd} ; #{cmd_1} ; #{cmd_2} ; "`
|
|
50
|
+
puts! out, 'out'
|
|
51
|
+
|
|
52
|
+
render json: { status: :ok } ## _TODO: remove
|
|
53
|
+
# redirect_to action: 'show', newsvideo_id: params[:id]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def index
|
|
57
|
+
authorize! :index, Wco::Newsvideo
|
|
58
|
+
@newsvideos = Wco::Newsvideo.all
|
|
59
|
+
if params[:deleted]
|
|
60
|
+
@newsvideos = Wco::Newsvideo.unscoped.where( :deleted_at.ne => nil )
|
|
61
|
+
end
|
|
62
|
+
@newsvideos = @newsvideos.page( params[:newsvideos_page] ).per( current_profile.per_page )
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def new
|
|
66
|
+
@newsvideo = Wco::Newsvideo.new
|
|
67
|
+
authorize! :create, @newsvideo
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def show
|
|
71
|
+
@newsvideo = Wco::Newsvideo.unscoped.find params[:id]
|
|
72
|
+
authorize! :show, @newsvideo
|
|
73
|
+
@newspartials = Wco::Newspartial.where( newsvideo_id: @newsvideo.id.to_s).includes(:video)
|
|
74
|
+
|
|
75
|
+
# @config = JSON.parse( @newsvideo.config_json )
|
|
76
|
+
# @duration_ms = @config['vtimes'].last.to_i + @config['vdurations'].last.to_i
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def update
|
|
81
|
+
params[:newsvideo][:tag_ids]&.delete ''
|
|
82
|
+
|
|
83
|
+
@newsvideo = Wco::Newsvideo.unscoped.find params[:id]
|
|
84
|
+
authorize! :update, @newsvideo
|
|
85
|
+
if @newsvideo.update params[:newsvideo].permit!
|
|
86
|
+
flash_notice "updated newsvideo"
|
|
87
|
+
else
|
|
88
|
+
flash_alert "Cannot update newsvideo: #{@newsvideo.errors.messages}"
|
|
89
|
+
end
|
|
90
|
+
redirect_to action: 'index'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
##
|
|
94
|
+
## private
|
|
95
|
+
##
|
|
96
|
+
private
|
|
97
|
+
|
|
98
|
+
def set_lists
|
|
99
|
+
@tags_list = Wco::Tag.list
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
@@ -50,6 +50,9 @@ class Wco::ReportsController < Wco::ApplicationController
|
|
|
50
50
|
def show
|
|
51
51
|
@report = Wco::Report.unscoped.find params[:id]
|
|
52
52
|
authorize! :show, @report
|
|
53
|
+
|
|
54
|
+
# @config = JSON.parse( @report.config_json )
|
|
55
|
+
# @duration_ms = @config['vtimes'].last.to_i + @config['vdurations'].last.to_i
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
def update
|
|
@@ -72,6 +75,7 @@ class Wco::ReportsController < Wco::ApplicationController
|
|
|
72
75
|
|
|
73
76
|
def set_lists
|
|
74
77
|
@tags_list = Wco::Tag.list
|
|
78
|
+
@newsvideos_list = Wco::Newsvideo.list
|
|
75
79
|
end
|
|
76
80
|
|
|
77
81
|
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
class Wco::Newspartial
|
|
3
|
+
include Mongoid::Document
|
|
4
|
+
include Mongoid::Timestamps
|
|
5
|
+
include Mongoid::Paranoia
|
|
6
|
+
include Wco::Utils
|
|
7
|
+
store_in collection: 'wco_newspartials'
|
|
8
|
+
|
|
9
|
+
PAGE_PARAM_NAME = 'newspartials_page'
|
|
10
|
+
|
|
11
|
+
field :title
|
|
12
|
+
# validates :title, presence: true, uniqueness: true
|
|
13
|
+
index({ title: 1 }, { unique: true })
|
|
14
|
+
|
|
15
|
+
field :body
|
|
16
|
+
field :config_json, type: :string, default: '{}'
|
|
17
|
+
field :speech_json, type: :string, default: '{}' # the smaller config, excludes audio wav
|
|
18
|
+
|
|
19
|
+
belongs_to :newsvideo
|
|
20
|
+
has_one :video
|
|
21
|
+
|
|
22
|
+
def config
|
|
23
|
+
@config ||= JSON.parse self[:config_json]
|
|
24
|
+
end
|
|
25
|
+
def duration_ms
|
|
26
|
+
duration = config['vtimes'].last.to_i + config['vdurations'].last.to_i rescue 0
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def generate_speech
|
|
30
|
+
out = HTTParty.post( "#{HEAD_TTS_ORIGIN}/v1/synthesize",
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type' => 'application/json',
|
|
33
|
+
'Accept' => 'application/json',
|
|
34
|
+
}, body: {
|
|
35
|
+
input: body,
|
|
36
|
+
voice: "af_bella",
|
|
37
|
+
language: "en-us",
|
|
38
|
+
audioEncoding: "wav",
|
|
39
|
+
}.to_json
|
|
40
|
+
);
|
|
41
|
+
out = out.body
|
|
42
|
+
puts! out, 'out'
|
|
43
|
+
|
|
44
|
+
self[:config_json] = out
|
|
45
|
+
|
|
46
|
+
tmp = JSON.parse( out )
|
|
47
|
+
tmp.delete('audio')
|
|
48
|
+
self[:speech_json] = tmp.to_json
|
|
49
|
+
|
|
50
|
+
self.save
|
|
51
|
+
return out
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def generate_video
|
|
55
|
+
cmd = "cd #{ISHLIB3JS_ROOT} ;
|
|
56
|
+
node ./src/talking_head/example_puppeteer_wired.js \
|
|
57
|
+
--api_key=#{SIMPLE_API_KEY} \
|
|
58
|
+
--api_secret=#{SIMPLE_API_SECRET} \
|
|
59
|
+
--wco_origin=#{WCO_ORIGIN} \
|
|
60
|
+
--newspartial_id=#{self[:id]} ";
|
|
61
|
+
|
|
62
|
+
puts! cmd, 'cmd'
|
|
63
|
+
begin
|
|
64
|
+
out = `#{cmd}`
|
|
65
|
+
rescue err
|
|
66
|
+
puts! err, 'err'
|
|
67
|
+
end
|
|
68
|
+
puts! out, 'out'
|
|
69
|
+
return out
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def video
|
|
73
|
+
Wco::Video.where( newspartial_id: self[:id] ).first
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class Wco::Newsvideo
|
|
4
|
+
include Mongoid::Document
|
|
5
|
+
include Mongoid::Timestamps
|
|
6
|
+
include Mongoid::Paranoia
|
|
7
|
+
include Wco::Utils
|
|
8
|
+
store_in collection: 'wco_newsvideos'
|
|
9
|
+
|
|
10
|
+
PAGE_PARAM_NAME = 'newsvideos_page'
|
|
11
|
+
|
|
12
|
+
field :title
|
|
13
|
+
validates :title, presence: true, uniqueness: true
|
|
14
|
+
index({ title: 1 }, { unique: true })
|
|
15
|
+
def name ; title ; end
|
|
16
|
+
def to_s
|
|
17
|
+
title
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
field :slug
|
|
21
|
+
validates :slug, presence: true, uniqueness: true
|
|
22
|
+
index({ :slug => 1 }, { :unique => true })
|
|
23
|
+
before_validation :set_slug, on: :create
|
|
24
|
+
|
|
25
|
+
field :body
|
|
26
|
+
field :config_json, type: :string
|
|
27
|
+
|
|
28
|
+
field :x, :type => Float
|
|
29
|
+
field :y, :type => Float
|
|
30
|
+
field :z, :type => Float
|
|
31
|
+
|
|
32
|
+
# has_one :image_thumb
|
|
33
|
+
# has_one :image_hero
|
|
34
|
+
|
|
35
|
+
belongs_to :author, class_name: 'Wco::Profile'
|
|
36
|
+
|
|
37
|
+
has_and_belongs_to_many :tags
|
|
38
|
+
has_many :newspartials
|
|
39
|
+
has_many :videos
|
|
40
|
+
|
|
41
|
+
end
|
data/app/models/wco/profile.rb
CHANGED
|
@@ -18,7 +18,7 @@ class Wco::Profile
|
|
|
18
18
|
field :schwab_refresh_token, type: :string
|
|
19
19
|
field :schwab_id_token, type: :string
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
has_many :newsvideos, class_name: 'Wco::Newsvideo'
|
|
22
22
|
has_many :reports, class_name: 'Wco::Report'
|
|
23
23
|
has_many :stocks, class_name: 'Iro::Stock'
|
|
24
24
|
|
data/app/models/wco/tag.rb
CHANGED
|
@@ -16,14 +16,17 @@ class Wco::Tag
|
|
|
16
16
|
has_many :email_filters, class_name: 'WcoEmail::EmailFilter', inverse_of: :tag
|
|
17
17
|
|
|
18
18
|
has_and_belongs_to_many :conversations, class_name: 'WcoEmail::Conversation', index: true
|
|
19
|
-
has_and_belongs_to_many :
|
|
19
|
+
has_and_belongs_to_many :galleries
|
|
20
20
|
has_and_belongs_to_many :headlines # , class_name: 'Headline'
|
|
21
21
|
has_and_belongs_to_many :leads, index: true # , class_name: 'Lead'
|
|
22
22
|
has_and_belongs_to_many :leadsets # , class_name: 'Leadset'
|
|
23
|
-
has_and_belongs_to_many :
|
|
23
|
+
has_and_belongs_to_many :logs
|
|
24
|
+
has_and_belongs_to_many :message_stubs, class_name: 'WcoEmail::MessageStub'
|
|
25
|
+
has_and_belongs_to_many :newsvideos
|
|
24
26
|
has_and_belongs_to_many :reports
|
|
25
27
|
has_and_belongs_to_many :videos
|
|
26
|
-
|
|
28
|
+
|
|
29
|
+
|
|
27
30
|
|
|
28
31
|
INBOX = 'inbox'
|
|
29
32
|
def self.inbox
|
data/app/models/wco/video.rb
CHANGED
|
@@ -34,7 +34,9 @@ class Wco::Video
|
|
|
34
34
|
# belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :videos
|
|
35
35
|
# has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_videos
|
|
36
36
|
|
|
37
|
-
belongs_to :lead,
|
|
37
|
+
belongs_to :lead, optional: true
|
|
38
|
+
belongs_to :newspartial, optional: true
|
|
39
|
+
belongs_to :newsvideo, optional: true
|
|
38
40
|
|
|
39
41
|
has_and_belongs_to_many :tags
|
|
40
42
|
|
|
@@ -46,7 +48,7 @@ class Wco::Video
|
|
|
46
48
|
:s3_credentials => ::S3_CREDENTIALS,
|
|
47
49
|
:path => "videos/:style/:id/:filename",
|
|
48
50
|
:s3_protocol => 'https',
|
|
49
|
-
:s3_permissions => 'public-read',
|
|
51
|
+
# :s3_permissions => 'public-read',
|
|
50
52
|
:validate_media_type => false,
|
|
51
53
|
s3_region: ::S3_CREDENTIALS[:region]
|
|
52
54
|
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
%label Stripe customer_id
|
|
42
42
|
= f.text_field :customer_id
|
|
43
43
|
|
|
44
|
-
.field
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
-# .field
|
|
45
|
+
-# %label appliance tmpl prices
|
|
46
|
+
-# .d-flex.flex-wrap
|
|
47
|
+
-# - @appliance_tmpl_prices_list.each do |price|
|
|
48
|
+
-# .descr
|
|
49
|
+
-# = check_box_tag 'leadset[appliance_tmpl_ids][]', price.id, leadset.appliance_tmpls.include?(price)
|
|
50
|
+
-# %label= price.product&.name
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
.actions
|
|
@@ -26,12 +26,6 @@
|
|
|
26
26
|
|
|
27
27
|
%hr
|
|
28
28
|
.row
|
|
29
|
-
-# appliance templates (prices)
|
|
30
|
-
.col-md-6.border-right
|
|
31
|
-
.header
|
|
32
|
-
%h5.title Appliance Tmpls (prices) (#{@leadset.appliance_tmpls.length})
|
|
33
|
-
= render 'wco/prices/form_table'
|
|
34
|
-
|
|
35
29
|
-# environments
|
|
36
30
|
.col-md-6
|
|
37
31
|
- if defined?( wco_hosting )
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
.newspartials--form
|
|
3
|
+
= form_for newspartial do |f|
|
|
4
|
+
.actions
|
|
5
|
+
= f.submit
|
|
6
|
+
|
|
7
|
+
.field.flex-row
|
|
8
|
+
%label Title
|
|
9
|
+
= f.text_field :title, class: 'w-100'
|
|
10
|
+
|
|
11
|
+
.field
|
|
12
|
+
%label Body
|
|
13
|
+
= f.text_area :body, class: 'tinymce'
|
|
14
|
+
|
|
15
|
+
.field
|
|
16
|
+
%label Newsvideo:
|
|
17
|
+
= f.select :newsvideo_id, options_for_select(@newsvideos_list, selected: newspartial.newsvideo_id || params[:newsvideo_id] ), {}, {}
|
|
18
|
+
|
|
19
|
+
.actions
|
|
20
|
+
= f.submit
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
- height_ms = 100.0/1000
|
|
3
|
+
|
|
4
|
+
.newspartials--show-in-newsvideo
|
|
5
|
+
|
|
6
|
+
.a
|
|
7
|
+
= link_to '[~]', edit_newspartial_path(newspartial)
|
|
8
|
+
Newspartial `#{link_to newspartial.title, newspartial_path(newspartial)}`
|
|
9
|
+
%span{ class: 'gray' } #{newspartial.id}
|
|
10
|
+
= link_to '[api]', api_newspartial_config_path(newspartial, format: :json, api_key: SIMPLE_API_KEY, api_secret: SIMPLE_API_SECRET ), target: :_blank
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
.Timeline{ style: "height: #{newspartial.duration_ms*height_ms}px; min-height: 100px;" }
|
|
14
|
+
.main
|
|
15
|
+
- newspartial.config['wtimes']&.each_with_index do |wtime, idx|
|
|
16
|
+
|
|
17
|
+
%div.ts{ style: "top: #{wtime.to_f*height_ms}px"}
|
|
18
|
+
.wtime= wtime
|
|
19
|
+
.word= newspartial.config['words'][idx]
|
|
20
|
+
|
|
21
|
+
.full-text
|
|
22
|
+
= newspartial.body
|
|
23
|
+
.d-inline-block= button_to 'Generate visemes', newspartial_generate_speech_path(newspartial)
|
|
24
|
+
.d-inline-block= button_to 'Generate video', newspartial_generate_video_path(newspartial)
|
|
25
|
+
|
|
26
|
+
.a= newspartial.config_json[0...100]
|
|
27
|
+
.a= newspartial.speech_json[0...100]
|
|
28
|
+
.a
|
|
29
|
+
Video:
|
|
30
|
+
- if newspartial.video
|
|
31
|
+
= image_tag newspartial.video.thumb.url(:thumb), class: 'thumb'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
.newsvideos--form
|
|
3
|
+
= form_for newsvideo do |f|
|
|
4
|
+
.actions
|
|
5
|
+
= f.submit
|
|
6
|
+
|
|
7
|
+
.field.flex-row
|
|
8
|
+
%label Title
|
|
9
|
+
= f.text_field :title, class: 'w-100'
|
|
10
|
+
.field.flex-row
|
|
11
|
+
%label Slug
|
|
12
|
+
= f.text_field :slug, class: 'w-100'
|
|
13
|
+
|
|
14
|
+
.field
|
|
15
|
+
%label deleted_at
|
|
16
|
+
= f.text_field :deleted_at
|
|
17
|
+
|
|
18
|
+
.field
|
|
19
|
+
%label Body
|
|
20
|
+
= f.text_area :body, class: 'tinymce'
|
|
21
|
+
|
|
22
|
+
.field
|
|
23
|
+
%label Tags (#{newsvideo.tags.length}):
|
|
24
|
+
-# = render '/wco/tags/index', tags: newsvideo.tags
|
|
25
|
+
= f.select :tag_ids, options_for_select(@tags_list, selected: newsvideo.tag_ids), {}, { multiple: true, class: 'select2' }
|
|
26
|
+
|
|
27
|
+
.actions
|
|
28
|
+
= f.submit
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
.newsvideos-show.maxwidth
|
|
3
|
+
%h5.text-center Newsvideo `#{@newsvideo.title}` #{link_to '[~]', edit_newsvideo_path(@newsvideo)}
|
|
4
|
+
.descr= @newsvideo.body
|
|
5
|
+
%hr
|
|
6
|
+
.text-center
|
|
7
|
+
Newspartials #{link_to '[+]', new_newspartial_path(newsvideo_id: @newsvideo.id) }
|
|
8
|
+
= link_to '[+ illustration]', pexels_search_path(newsvideo_id: @newsvideo.id), target: :_blank
|
|
9
|
+
- @newspartials.each do |newspartial|
|
|
10
|
+
= render 'wco/newspartials/show_in_newsvideo', newspartial: newspartial
|
|
@@ -24,5 +24,9 @@
|
|
|
24
24
|
-# = render '/wco/tags/index', tags: report.tags
|
|
25
25
|
= f.select :tag_ids, options_for_select(@tags_list, selected: report.tag_ids), {}, { multiple: true, class: 'select2' }
|
|
26
26
|
|
|
27
|
+
.field
|
|
28
|
+
%label Newsvideo:
|
|
29
|
+
= f.select :newsvideo_id, options_for_select(@newsvideos_list, selected: report.newsvideo_id), {}, {}
|
|
30
|
+
|
|
27
31
|
.actions
|
|
28
32
|
= f.submit
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
|
|
2
|
+
- height_ms = 100.0/1000
|
|
3
|
+
|
|
2
4
|
.reports-show.maxwidth
|
|
3
5
|
%h5
|
|
4
6
|
= link_to '[~]', edit_report_path(@report)
|
|
@@ -10,3 +12,19 @@
|
|
|
10
12
|
= render 'wco/tags/index_chips', tags: @report.tags
|
|
11
13
|
|
|
12
14
|
.descr= raw @report.body
|
|
15
|
+
|
|
16
|
+
.Timeline{ style: "height: #{@duration_ms*height_ms}px" }
|
|
17
|
+
.main
|
|
18
|
+
- @config['wtimes'].each_with_index do |wtime, idx|
|
|
19
|
+
|
|
20
|
+
%div.ts{ style: "top: #{wtime.to_f*height_ms}px"}
|
|
21
|
+
.wtime= wtime
|
|
22
|
+
.word= @config['words'][idx]
|
|
23
|
+
|
|
24
|
+
.reports-show.maxwidth
|
|
25
|
+
%hr
|
|
26
|
+
%label config_json
|
|
27
|
+
.descr
|
|
28
|
+
= @report.config_json
|
|
29
|
+
|
|
30
|
+
|
data/config/routes.rb
CHANGED
|
@@ -8,7 +8,13 @@ Wco::Engine.routes.draw do
|
|
|
8
8
|
get 'obf', to: 'obfuscated_redirects#show' ## testing only.
|
|
9
9
|
get 'obf/:id', to: 'obfuscared_redirects#show'
|
|
10
10
|
|
|
11
|
+
post 'reports', to: 'reports#create'
|
|
12
|
+
patch 'reports/:id/add-config', to: 'reports#add_config'
|
|
13
|
+
get 'newspartials/:id/config', to: 'newspartials#show_config', as: :newspartial_config
|
|
14
|
+
|
|
11
15
|
get 'tags', to: 'tags#index'
|
|
16
|
+
|
|
17
|
+
post 'videos', to: 'videos#create'
|
|
12
18
|
end
|
|
13
19
|
|
|
14
20
|
get 'application/tinymce', to: 'application#tinymce'
|
|
@@ -41,6 +47,13 @@ Wco::Engine.routes.draw do
|
|
|
41
47
|
delete 'logs/bulkop', to: 'logs#bulkop', as: :logs_bulkop
|
|
42
48
|
resources :logs
|
|
43
49
|
|
|
50
|
+
match 'newspartials/:id/generate-speech', to: 'newspartials#generate_speech', as: :newspartial_generate_speech, via: [ :get, :post ]
|
|
51
|
+
match 'newspartials/:id/generate-video', to: 'newspartials#generate_video', as: :newspartial_generate_video, via: [ :get, :post ]
|
|
52
|
+
resources :newspartials
|
|
53
|
+
|
|
54
|
+
match 'newsvideos/:id/generate-illustration', to: 'newsvideos#generate_illustration', as: :newsvideo_generate_illustration, via: [ :get, :post ]
|
|
55
|
+
resources :newsvideos
|
|
56
|
+
|
|
44
57
|
resources :obfuscated_redirects
|
|
45
58
|
|
|
46
59
|
post 'office_action_templates', to: 'office_action_templates#update'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wco_models
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.1.0.
|
|
4
|
+
version: 3.1.0.223
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor Pudeyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ahoy_matey
|
|
@@ -422,14 +422,17 @@ files:
|
|
|
422
422
|
- app/assets/stylesheets/wco/galleries.scss
|
|
423
423
|
- app/assets/stylesheets/wco/leads_leadsets.scss
|
|
424
424
|
- app/assets/stylesheets/wco/main.scss
|
|
425
|
+
- app/assets/stylesheets/wco/newsvideos_newspartials.scss
|
|
425
426
|
- app/assets/stylesheets/wco/office_action_templates.scss
|
|
426
427
|
- app/assets/stylesheets/wco/pagination.scss
|
|
427
428
|
- app/assets/stylesheets/wco/photos.scss
|
|
428
429
|
- app/assets/stylesheets/wco/sitemaps.scss
|
|
429
430
|
- app/assets/stylesheets/wco/videos.scss
|
|
430
431
|
- app/controllers/wco/api/leads_controller.rb
|
|
432
|
+
- app/controllers/wco/api/newspartials_controller.rb
|
|
431
433
|
- app/controllers/wco/api/obfuscated_redirects_controller.rb
|
|
432
434
|
- app/controllers/wco/api/tags_controller.rb
|
|
435
|
+
- app/controllers/wco/api/videos_controller.rb
|
|
433
436
|
- app/controllers/wco/api_controller.rb
|
|
434
437
|
- app/controllers/wco/application_controller.rb
|
|
435
438
|
- app/controllers/wco/galleries_controller.rb
|
|
@@ -438,6 +441,8 @@ files:
|
|
|
438
441
|
- app/controllers/wco/leads_controller.rb
|
|
439
442
|
- app/controllers/wco/leadsets_controller.rb
|
|
440
443
|
- app/controllers/wco/logs_controller.rb
|
|
444
|
+
- app/controllers/wco/newspartials_controller.rb
|
|
445
|
+
- app/controllers/wco/newsvideos_controller.rb
|
|
441
446
|
- app/controllers/wco/obfuscated_redirects_controller.rb
|
|
442
447
|
- app/controllers/wco/office_action_templates_controller.rb
|
|
443
448
|
- app/controllers/wco/office_actions_controller.rb
|
|
@@ -481,6 +486,8 @@ files:
|
|
|
481
486
|
- app/models/wco/leadset_appliance_tmpl.rb
|
|
482
487
|
- app/models/wco/log.rb
|
|
483
488
|
- app/models/wco/newsitem.rb
|
|
489
|
+
- app/models/wco/newspartial.rb
|
|
490
|
+
- app/models/wco/newsvideo.rb
|
|
484
491
|
- app/models/wco/obfuscated_redirect.rb
|
|
485
492
|
- app/models/wco/office_action.rb
|
|
486
493
|
- app/models/wco/office_action_template.rb
|
|
@@ -593,6 +600,16 @@ files:
|
|
|
593
600
|
- app/views/wco/logs/_index.haml
|
|
594
601
|
- app/views/wco/logs/edit.haml
|
|
595
602
|
- app/views/wco/logs/new.haml
|
|
603
|
+
- app/views/wco/newspartials/_form.haml
|
|
604
|
+
- app/views/wco/newspartials/_show_in_newsvideo.haml
|
|
605
|
+
- app/views/wco/newspartials/index.haml-trash
|
|
606
|
+
- app/views/wco/newspartials/new.haml
|
|
607
|
+
- app/views/wco/newsvideos/_form.haml
|
|
608
|
+
- app/views/wco/newsvideos/_header_mini.haml
|
|
609
|
+
- app/views/wco/newsvideos/edit.haml
|
|
610
|
+
- app/views/wco/newsvideos/index.haml
|
|
611
|
+
- app/views/wco/newsvideos/new.haml
|
|
612
|
+
- app/views/wco/newsvideos/show.haml
|
|
596
613
|
- app/views/wco/obfuscated_redirects/_form.haml
|
|
597
614
|
- app/views/wco/obfuscated_redirects/_header.haml
|
|
598
615
|
- app/views/wco/obfuscated_redirects/edit.haml
|