eikon 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfc5f4e26e72909f6f59029c9acfdd6e352ac7ec04f31b88ede2da6228dfecb4
4
- data.tar.gz: 43b93efe48bfa4e598cc1b902a099d68c02a583515c173f0eb0d1e8fa578f4dd
3
+ metadata.gz: 24e03b53236236989ffb235048a5a27c45b060e7be16fd417f3f9cb33f7bf630
4
+ data.tar.gz: 768aca67bb323962f93b1e488035e86b6261099d507ae6e20dfb162c5547acef
5
5
  SHA512:
6
- metadata.gz: acec6e8fe0926c409ed27ffdb8be8e8dca096e9d673ece9b206412363ea045ba9f4a9fdeccfba4ebc311012fc2b5c2f36d8f10b4aac49bf6b0844bc289c748c9
7
- data.tar.gz: 3c45290cce3a222048414426f898ac5df6ef83e75784bebb10b252ead8347101b21ec7f7ac652412dfd6db8542c8797f8b07be675b2d1680cb8ee0e4b5f48e29
6
+ metadata.gz: 30e2055cdee287fd90491cdda63bed5d16621b900e90e67ecab6dc33628510a2f84a2b4bb13b26ed2834888b522358be9f38279ded9d5c8a1a949f6c848bab90
7
+ data.tar.gz: 71524ce43256b89eb92ff0a75ed05b2fe4620b2bd1a6b137fab397774056ef3529f55564ca8b2e1366d208f37d14496db0b66a11ffdd681a89f547c553ffc22f
data/Gemfile.lock CHANGED
@@ -9,20 +9,20 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (7.0.2.3)
13
- actionview (= 7.0.2.3)
14
- activesupport (= 7.0.2.3)
12
+ actionpack (7.0.4)
13
+ actionview (= 7.0.4)
14
+ activesupport (= 7.0.4)
15
15
  rack (~> 2.0, >= 2.2.0)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (7.0.2.3)
20
- activesupport (= 7.0.2.3)
19
+ actionview (7.0.4)
20
+ activesupport (= 7.0.4)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activesupport (7.0.2.3)
25
+ activesupport (7.0.4)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
@@ -35,75 +35,78 @@ GEM
35
35
  concurrent-ruby (1.1.10)
36
36
  crass (1.0.6)
37
37
  diff-lcs (1.5.0)
38
- erubi (1.10.0)
38
+ erubi (1.11.0)
39
39
  ffi (1.15.5)
40
- i18n (1.10.0)
40
+ i18n (1.12.0)
41
41
  concurrent-ruby (~> 1.0)
42
- loofah (2.16.0)
42
+ json (2.6.2)
43
+ loofah (2.19.0)
43
44
  crass (~> 1.0.2)
44
45
  nokogiri (>= 1.5.9)
45
46
  method_source (1.0.0)
46
47
  mini_portile2 (2.8.0)
47
- minitest (5.15.0)
48
- nokogiri (1.13.4)
48
+ minitest (5.16.3)
49
+ netrc (0.11.0)
50
+ nokogiri (1.13.9)
49
51
  mini_portile2 (~> 2.8.0)
50
52
  racc (~> 1.4)
51
53
  parallel (1.22.1)
52
- parser (3.1.2.0)
54
+ parser (3.1.2.1)
53
55
  ast (~> 2.4.1)
54
56
  pry (0.13.1)
55
57
  coderay (~> 1.1)
56
58
  method_source (~> 1.0)
57
59
  racc (1.6.0)
58
- rack (2.2.3)
59
- rack-test (1.1.0)
60
- rack (>= 1.0, < 3)
60
+ rack (2.2.4)
61
+ rack-test (2.0.2)
62
+ rack (>= 1.3)
61
63
  rails-dom-testing (2.0.3)
62
64
  activesupport (>= 4.2.0)
63
65
  nokogiri (>= 1.6)
64
- rails-html-sanitizer (1.4.2)
66
+ rails-html-sanitizer (1.4.3)
65
67
  loofah (~> 2.3)
66
- railties (7.0.2.3)
67
- actionpack (= 7.0.2.3)
68
- activesupport (= 7.0.2.3)
68
+ railties (7.0.4)
69
+ actionpack (= 7.0.4)
70
+ activesupport (= 7.0.4)
69
71
  method_source
70
72
  rake (>= 12.2)
71
73
  thor (~> 1.0)
72
74
  zeitwerk (~> 2.5)
73
75
  rainbow (3.1.1)
74
76
  rake (12.3.3)
75
- rbi (0.0.14)
77
+ rbi (0.0.16)
76
78
  ast
77
79
  parser (>= 2.6.4.0)
78
80
  sorbet-runtime (>= 0.5.9204)
79
81
  unparser
80
- regexp_parser (2.3.0)
82
+ regexp_parser (2.6.0)
81
83
  rexml (3.2.5)
82
- rubocop (1.27.0)
84
+ rubocop (1.38.0)
85
+ json (~> 2.3)
83
86
  parallel (~> 1.10)
84
- parser (>= 3.1.0.0)
87
+ parser (>= 3.1.2.1)
85
88
  rainbow (>= 2.2.2, < 4.0)
86
89
  regexp_parser (>= 1.8, < 3.0)
87
- rexml
88
- rubocop-ast (>= 1.16.0, < 2.0)
90
+ rexml (>= 3.2.5, < 4.0)
91
+ rubocop-ast (>= 1.23.0, < 2.0)
89
92
  ruby-progressbar (~> 1.7)
90
93
  unicode-display_width (>= 1.4.0, < 3.0)
91
- rubocop-ast (1.17.0)
94
+ rubocop-ast (1.23.0)
92
95
  parser (>= 3.1.1.0)
93
- rubocop-minitest (0.19.1)
96
+ rubocop-minitest (0.23.1)
94
97
  rubocop (>= 0.90, < 2.0)
95
- rubocop-packaging (0.5.1)
96
- rubocop (>= 0.89, < 2.0)
97
- rubocop-performance (1.13.3)
98
+ rubocop-packaging (0.5.2)
99
+ rubocop (>= 1.33, < 2.0)
100
+ rubocop-performance (1.15.0)
98
101
  rubocop (>= 1.7.0, < 2.0)
99
102
  rubocop-ast (>= 0.4.0)
100
- rubocop-rails (2.14.2)
103
+ rubocop-rails (2.17.2)
101
104
  activesupport (>= 4.2.0)
102
105
  rack (>= 1.1)
103
- rubocop (>= 1.7.0, < 2.0)
104
- rubocop-rails_config (1.9.2)
106
+ rubocop (>= 1.33.0, < 2.0)
107
+ rubocop-rails_config (1.11.3)
105
108
  railties (>= 5.0)
106
- rubocop (>= 1.25.1)
109
+ rubocop (>= 1.29.0)
107
110
  rubocop-ast (>= 1.0.1)
108
111
  rubocop-minitest (~> 0.15)
109
112
  rubocop-packaging (~> 0.5)
@@ -116,51 +119,52 @@ GEM
116
119
  byebug (>= 9.1, < 12.0)
117
120
  pry (~> 0.13.0)
118
121
  tty-screen (~> 0.8.1)
119
- sorbet (0.5.9905)
120
- sorbet-static (= 0.5.9905)
121
- sorbet-runtime (0.5.9905)
122
- sorbet-static (0.5.9905-universal-darwin-14)
123
- sorbet-static (0.5.9905-universal-darwin-15)
124
- sorbet-static (0.5.9905-universal-darwin-16)
125
- sorbet-static (0.5.9905-universal-darwin-17)
126
- sorbet-static (0.5.9905-universal-darwin-18)
127
- sorbet-static (0.5.9905-universal-darwin-19)
128
- sorbet-static (0.5.9905-universal-darwin-20)
129
- sorbet-static (0.5.9905-universal-darwin-21)
130
- sorbet-static (0.5.9905-x86_64-linux)
131
- sorbet-static-and-runtime (0.5.9905)
132
- sorbet (= 0.5.9905)
133
- sorbet-runtime (= 0.5.9905)
134
- spoom (1.1.11)
122
+ sorbet (0.5.10549)
123
+ sorbet-static (= 0.5.10549)
124
+ sorbet-runtime (0.5.10549)
125
+ sorbet-static (0.5.10549-universal-darwin-14)
126
+ sorbet-static (0.5.10549-universal-darwin-15)
127
+ sorbet-static (0.5.10549-universal-darwin-16)
128
+ sorbet-static (0.5.10549-universal-darwin-17)
129
+ sorbet-static (0.5.10549-universal-darwin-18)
130
+ sorbet-static (0.5.10549-universal-darwin-19)
131
+ sorbet-static (0.5.10549-universal-darwin-20)
132
+ sorbet-static (0.5.10549-universal-darwin-21)
133
+ sorbet-static (0.5.10549-universal-darwin-22)
134
+ sorbet-static (0.5.10549-x86_64-linux)
135
+ sorbet-static-and-runtime (0.5.10549)
136
+ sorbet (= 0.5.10549)
137
+ sorbet-runtime (= 0.5.10549)
138
+ spoom (1.1.12)
135
139
  sorbet (>= 0.5.9204)
136
140
  sorbet-runtime (>= 0.5.9204)
137
141
  thor (>= 0.19.2)
138
- tapioca (0.7.1)
142
+ tapioca (0.10.3)
139
143
  bundler (>= 1.17.3)
140
- pry (>= 0.12.2)
141
- rbi (~> 0.0.0, >= 0.0.14)
142
- sorbet-runtime (>= 0.5.9204)
143
- sorbet-static (>= 0.5.9204)
144
- spoom (~> 1.1.0, >= 1.1.4)
144
+ netrc (>= 0.11.0)
145
+ parallel (>= 1.21.0)
146
+ rbi (~> 0.0.0, >= 0.0.16)
147
+ sorbet-static-and-runtime (>= 0.5.9892)
148
+ spoom (~> 1.1.0, >= 1.1.11)
145
149
  thor (>= 1.2.0)
146
150
  yard-sorbet
147
151
  terrapin (0.6.0)
148
152
  climate_control (>= 0.0.3, < 1.0)
149
153
  thor (1.2.1)
150
154
  tty-screen (0.8.1)
151
- tzinfo (2.0.4)
155
+ tzinfo (2.0.5)
152
156
  concurrent-ruby (~> 1.0)
153
- unicode-display_width (2.1.0)
157
+ unicode-display_width (2.3.0)
154
158
  unparser (0.6.5)
155
159
  diff-lcs (~> 1.3)
156
160
  parser (>= 3.1.0)
157
161
  webrick (1.7.0)
158
- yard (0.9.27)
162
+ yard (0.9.28)
159
163
  webrick (~> 1.7.0)
160
- yard-sorbet (0.6.1)
164
+ yard-sorbet (0.7.0)
161
165
  sorbet-runtime (>= 0.5)
162
166
  yard (>= 0.9)
163
- zeitwerk (2.5.4)
167
+ zeitwerk (2.6.6)
164
168
 
165
169
  PLATFORMS
166
170
  ruby
data/README.md CHANGED
@@ -4,7 +4,7 @@ This is an implementation of the DHash image matching algorithm in pure Ruby, as
4
4
  https://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html. Its main use is reverse
5
5
  image searching.
6
6
 
7
- This library is fully types in Sorbet.
7
+ This library is fully typed in Sorbet.
8
8
 
9
9
  ## Installation
10
10
 
data/lib/eikon/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # typed: true
2
2
  module Eikon
3
- VERSION = "0.1.3".freeze
3
+ VERSION = "0.1.5".freeze
4
4
  end
@@ -1,4 +1,5 @@
1
1
  # typed: strict
2
+
2
3
  require "sorbet-runtime"
3
4
  require "terrapin"
4
5
 
@@ -14,8 +15,8 @@ module Eikon
14
15
  @file_name = T.let(file_name, String)
15
16
  end
16
17
 
17
- sig { returns(String) }
18
- def split_video_into_images
18
+ sig { params(number_of_frames: Integer).returns(String) }
19
+ def split_video_into_images(number_of_frames = 0)
19
20
  file_name = get_file_name(@file_name)
20
21
 
21
22
  setup_tmp_folder
@@ -28,8 +29,24 @@ module Eikon
28
29
  raise "Folder already exists for this export"
29
30
  end
30
31
 
32
+ # Figure out the number of frames per minute given the number of frames we want, default to every ten seconds out of sixty
33
+ fps = 0.166 # 10/60
34
+ unless number_of_frames.zero?
35
+ # Get length of video
36
+ line = Terrapin::CommandLine.new("ffmpeg", "-i :file_name 2>&1 | grep Duration | cut -d ' ' -f 4 | sed s/,//")
37
+ time = line.run(file_name: @file_name).chomp
38
+
39
+ # Turn the time into total seconds (with two points of precision)
40
+ time_parts = time.split(":")
41
+ total_time = Integer(time_parts[0]) * 60 * 60 # Hours
42
+ total_time += Integer(time_parts[1]) * 60 # Minutes
43
+ total_time += Float(time_parts[2]) # Seconds
44
+
45
+ fps = number_of_frames / total_time
46
+ end
47
+
31
48
  # ffmpeg -i pexels-ron-lach-7121125.mp4 -vf fps=10/60 out%d.png
32
- line = Terrapin::CommandLine.new("ffmpeg", "-i :file_name -vf fps=10/60 :folder_name")
49
+ line = Terrapin::CommandLine.new("ffmpeg", "-i :file_name -vf fps=#{fps} :folder_name")
33
50
  line.run(file_name: @file_name, folder_name: "#{output_folder_path}/#{file_name}_%d.png")
34
51
  output_folder_path
35
52
  end
data/lib/eikon.rb CHANGED
@@ -20,10 +20,10 @@ module Eikon
20
20
  image.byte_array
21
21
  end
22
22
 
23
- sig { params(filename: String).returns(T::Array[T::Hash[String, T.any(Integer, String)]]) }
24
- def self.dhash_for_video(filename)
23
+ sig { params(filename: String, number_of_frames: Integer).returns(T::Array[T::Hash[String, T.any(Integer, String)]]) }
24
+ def self.dhash_for_video(filename, number_of_frames = 0)
25
25
  video_processor = Eikon::VideoProcessor.new(filename)
26
- storage_path = video_processor.split_video_into_images
26
+ storage_path = video_processor.split_video_into_images(number_of_frames)
27
27
  dhashes = video_processor.get_frames_dhash(storage_path)
28
28
  dhashes
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eikon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Guess
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-04 00:00:00.000000000 Z
11
+ date: 2022-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-vips
@@ -73,7 +73,6 @@ files:
73
73
  - bin/console
74
74
  - bin/setup
75
75
  - bin/tapioca
76
- - eikon-0.1.0.gem
77
76
  - eikon.gemspec
78
77
  - lib/eikon.rb
79
78
  - lib/eikon/comparator.rb
data/eikon-0.1.0.gem DELETED
Binary file