viddl 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,121 @@
1
+ require "helper"
2
+
3
+ describe Viddl::Video::Instance do
4
+
5
+ before(:each) do
6
+ @video_id = "6g4dkBF5anU"
7
+ @source_url = "https://youtube.com/watch?v=#{@video_id}"
8
+ @video = Viddl::Video::Instance.new(@source_url)
9
+ end
10
+
11
+ context "#source_filenames" do
12
+
13
+ context "with associated download" do
14
+
15
+ it "pulls filenames from directory" do
16
+ @download = Viddl::Video::Download.new(@video)
17
+ expect(Dir).to(receive(:[]))
18
+ @result = @video.source_filenames
19
+ end
20
+
21
+ end
22
+
23
+ context "with no associated download" do
24
+
25
+ it "raises" do
26
+ expect {
27
+ @video.source_filenames
28
+ }.to(raise_error(RuntimeError))
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ context "#create_clip" do
36
+
37
+ before(:each) do
38
+ @download = Viddl::Video::Download.new(@video)
39
+ expect(@video).to(receive(:source_filenames).and_return(["/tmp/#{@video_id}.mkv"]))
40
+ end
41
+
42
+ context "with no options" do
43
+
44
+ it "execs command line" do
45
+ @options = {}
46
+ expect(Kernel).to(receive(:system))
47
+ @result = @video.create_clip(@options)
48
+ end
49
+
50
+ end
51
+
52
+ context "with duration" do
53
+
54
+ it "execs command line" do
55
+ @options = {
56
+ duration: 12
57
+ }
58
+ expect(Kernel).to(receive(:system))
59
+ @result = @video.create_clip(@options)
60
+ end
61
+
62
+ end
63
+
64
+ context "with start time and duration" do
65
+
66
+ it "execs command line" do
67
+ @options = {
68
+ start: 10,
69
+ duration: 15
70
+ }
71
+ expect(Kernel).to(receive(:system))
72
+ @result = @video.create_clip(@options)
73
+ end
74
+
75
+ end
76
+
77
+ context "with start and end time" do
78
+
79
+ it "execs command line" do
80
+ @options = {
81
+ start: 8,
82
+ end: 15
83
+ }
84
+ expect(Kernel).to(receive(:system))
85
+ @result = @video.create_clip(@options)
86
+ end
87
+
88
+ end
89
+
90
+ context "with start, end time and duration" do
91
+
92
+ it "raises" do
93
+ @options = {
94
+ duration: 5,
95
+ end: 15,
96
+ start: 10
97
+ }
98
+ expect {
99
+ @video.create_clip(@options)
100
+ }.to(raise_error(RuntimeError))
101
+ end
102
+
103
+ end
104
+
105
+ end
106
+
107
+ context "#process_download" do
108
+
109
+ context "with no options" do
110
+
111
+ it "execs command line" do
112
+ @options = {}
113
+ expect(Kernel).to(receive(:system).and_return(true))
114
+ @result = @video.process_download(@options)
115
+ end
116
+
117
+ end
118
+
119
+ end
120
+
121
+ end
@@ -0,0 +1,24 @@
1
+ require "helper"
2
+
3
+ describe Viddl::Video do
4
+
5
+ before(:each) do
6
+ @video_id = "6g4dkBF5anU"
7
+ @source_url = "https://youtube.com/watch?v=#{@video_id}"
8
+ end
9
+
10
+ context ".process" do
11
+
12
+ context "with no options" do
13
+
14
+ it "execs command line" do
15
+ @options = {}
16
+ expect(Kernel).to(receive(:system).and_return(true))
17
+ @result = Viddl::Video.download(@source_url, @options)
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: viddl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Ari Russo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.4'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 10.4.2
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '10.4'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 10.4.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.5'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.5.0
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.5'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.5.0
53
+ description: Use Viddl to quickly download, cut, crop and resize video clips using
54
+ youtube-dl and ffmpeg
55
+ email:
56
+ - ari.russo@gmail.com
57
+ executables:
58
+ - viddl
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE
63
+ - README.md
64
+ - bin/viddl
65
+ - lib/viddl.rb
66
+ - lib/viddl/system.rb
67
+ - lib/viddl/video.rb
68
+ - lib/viddl/video/clip.rb
69
+ - lib/viddl/video/clip/audio.rb
70
+ - lib/viddl/video/clip/crop.rb
71
+ - lib/viddl/video/clip/cut.rb
72
+ - lib/viddl/video/clip/resize.rb
73
+ - lib/viddl/video/download.rb
74
+ - lib/viddl/video/instance.rb
75
+ - spec/helper.rb
76
+ - spec/system_spec.rb
77
+ - spec/video/clip/audio_spec.rb
78
+ - spec/video/clip/crop_spec.rb
79
+ - spec/video/clip/cut_spec.rb
80
+ - spec/video/clip/resize_spec.rb
81
+ - spec/video/clip_spec.rb
82
+ - spec/video/download_spec.rb
83
+ - spec/video/instance_spec.rb
84
+ - spec/video_spec.rb
85
+ homepage: http://github.com/arirusso/viddl
86
+ licenses:
87
+ - Apache-2.0
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 1.3.6
103
+ requirements: []
104
+ rubyforge_project: viddl
105
+ rubygems_version: 2.4.6
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Quickly download, cut, crop and resize video clips
109
+ test_files: []