eivid 1.0.0 → 1.0.4
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/README.md +1 -11
- data/app/controllers/eivid/videos_controller.rb +6 -1
- data/app/jobs/eivid/get_vimeo_urls_job.rb +9 -1
- data/app/models/eivid/owner.rb +1 -1
- data/app/models/eivid/video.rb +7 -0
- data/app/models/eivid/video_resource.rb +1 -1
- data/app/services/eivid/upload_service.rb +2 -2
- data/db/migrate/20210818121057_add_title_to_video.rb +5 -0
- data/lib/eivid/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3be70d9d3f995714108df4fb59cc7d437f02170ec3121ea58b349843873b149
|
4
|
+
data.tar.gz: '03315880246a5a57c4be6062fa6e6a3d19ba171cf16b783a9a323023265da1b4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78b739ae6ad9a47dc281a2bbbe268cc87b26d600bc183d2907d63f036e61a237ecc22e5cb275019d01c6aeaa291cb20424f6146e8c15fae4c72e00a1f6e38d4a
|
7
|
+
data.tar.gz: fbb92b8cee87d4c61eae547dffd79358245fd92c6536d7b9ff68120d06e3d8d4289bcb4dd2ed4650a14b5ef34492b62f2576bee8be57e89735de19ddc5c0d56e
|
data/README.md
CHANGED
@@ -10,18 +10,8 @@ Add the following to your application's Gemfile and run $bundle:
|
|
10
10
|
|
11
11
|
```ruby
|
12
12
|
|
13
|
-
gem 'eivid',
|
13
|
+
gem 'eivid', "1.0.0" # check the latest version on: https://rubygems.org/gems/eivid
|
14
14
|
|
15
|
-
```
|
16
|
-
Or, for development purposes, add instead:
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
local_eivid_path = "/Users/jurriaanschrofer/Documents/eivid"
|
20
|
-
if ENV["RAILS_ENV"] == 'development' && Dir.glob(local_eivid_path).any?
|
21
|
-
gem 'eivid', path: local_eivid_path
|
22
|
-
else
|
23
|
-
gem 'eivid', git: 'https://github.com/eitje-app/eivid_engine', branch: 'production'
|
24
|
-
end
|
25
15
|
```
|
26
16
|
|
27
17
|
Add the following file to your app's config/initializers directory:
|
@@ -13,7 +13,7 @@ module Eivid
|
|
13
13
|
before_action :validate_video_file, only: [:upload_video]
|
14
14
|
|
15
15
|
def upload_video
|
16
|
-
record = UploadService.upload(owner: @owner, user: @user, video_file: video_params["video_file"])
|
16
|
+
record = UploadService.upload(owner: @owner, user: @user, video_file: video_params["video_file"], video_title: video_title)
|
17
17
|
render json: record
|
18
18
|
end
|
19
19
|
|
@@ -44,5 +44,10 @@ module Eivid
|
|
44
44
|
params.permit("video_file")
|
45
45
|
end
|
46
46
|
|
47
|
+
def video_title
|
48
|
+
title = video_params["video_file"].original_filename
|
49
|
+
title.include?('.') ? title.split('.')[0..-2].join('.') : title
|
50
|
+
end
|
51
|
+
|
47
52
|
end
|
48
53
|
end
|
@@ -38,7 +38,15 @@ module Eivid
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def set_url_thumbnail
|
41
|
-
@url_thumbnail =
|
41
|
+
@url_thumbnail = find_high_res_thumbnail || find_low_res_thumbnail
|
42
|
+
end
|
43
|
+
|
44
|
+
def find_high_res_thumbnail
|
45
|
+
@response&.dig(:pictures, :sizes)&.find { |url| url[:width] == 960 && url[:height] == 540 }&.dig(:link_with_play_button)
|
46
|
+
end
|
47
|
+
|
48
|
+
def find_low_res_thumbnail
|
49
|
+
@response&.dig(:pictures, :sizes)&.find { |url| url[:width] == 640 && url[:height] == 360 }&.dig(:link_with_play_button)
|
42
50
|
end
|
43
51
|
|
44
52
|
def validate_url_presence
|
data/app/models/eivid/owner.rb
CHANGED
data/app/models/eivid/video.rb
CHANGED
@@ -5,6 +5,8 @@ module Eivid
|
|
5
5
|
belongs_to :user, optional: true
|
6
6
|
has_many :video_resources
|
7
7
|
|
8
|
+
after_commit :touch_video_resources
|
9
|
+
|
8
10
|
def owner_id # required for aliassing :owner_id
|
9
11
|
super
|
10
12
|
end
|
@@ -17,5 +19,10 @@ module Eivid
|
|
17
19
|
alias_method :"#{Eivid.owner_model}", :external_owner
|
18
20
|
scope :"of_#{Eivid.owner_model}", -> (owner_id) { where(owner_id: owner_id) }
|
19
21
|
|
22
|
+
def touch_video_resources
|
23
|
+
# has_many touch implementation
|
24
|
+
video_resources.find_each { |record| record.update(updated_at: Time.now) }
|
25
|
+
end
|
26
|
+
|
20
27
|
end
|
21
28
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Eivid::UploadService
|
2
2
|
class << self
|
3
3
|
|
4
|
-
def upload(owner:, user: nil, video_file:)
|
4
|
+
def upload(owner:, user: nil, video_file:, video_title:)
|
5
5
|
@video_file = video_file
|
6
|
-
@video_record = Eivid::Video.create(owner_id: owner.id, user_id: user&.id)
|
6
|
+
@video_record = Eivid::Video.create(owner_id: owner.id, user_id: user&.id, title: video_title)
|
7
7
|
@user = user
|
8
8
|
@file_name, @file_ext = @video_file.original_filename.split('.')
|
9
9
|
|
data/lib/eivid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eivid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurriaan Schrofer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- db/migrate/20210419122001_change_url_to_embedded_url.rb
|
112
112
|
- db/migrate/20210419122752_add_video_urls_to_videos.rb
|
113
113
|
- db/migrate/20210420120017_add_user_id_to_eivid_videos.rb
|
114
|
+
- db/migrate/20210818121057_add_title_to_video.rb
|
114
115
|
- lib/eivid.rb
|
115
116
|
- lib/eivid/engine.rb
|
116
117
|
- lib/eivid/version.rb
|