viddl 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/viddl.rb +5 -2
- data/lib/viddl/video/instance.rb +5 -1
- data/spec/video/download_spec.rb +2 -2
- data/spec/video/instance_spec.rb +11 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c38487a2d7d5f254f6a2c578ee593a19869e92
|
4
|
+
data.tar.gz: 7a23f5b3d8a6e3bb71c66c60db05f22dcb142e9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c394b34c44d1181ae5595f03ae5c66651154494b6e16c19537955bd412625d7ea46f578c5e0bb33bb4ffbdbae10c82a4737962124ca8ef3e4c3eabf903755b47
|
7
|
+
data.tar.gz: 0b07f0783b4028f740d320d14bc09419415b30727807c347d0dbb8a22602d74666d93c64390921623873a514768d1fc55e09ac5aba68afe42226a6d7ce6af313
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Running Viddl generates video clip files in the current directory
|
|
14
14
|
|
15
15
|
### Command Line
|
16
16
|
|
17
|
-
The command line usage and options are as follows
|
17
|
+
The command line usage and options are as follows
|
18
18
|
|
19
19
|
#### Download
|
20
20
|
|
@@ -32,15 +32,15 @@ This will start the clip at 10 seconds into the original video and run for five
|
|
32
32
|
viddl https://www.youtube.com/watch?v=6g4dkBF5anU -s 10 -d 5
|
33
33
|
```
|
34
34
|
|
35
|
-
|
35
|
+
Alternatively, this will also start the clip at 10 seconds into the original video and stop at 15 seconds
|
36
36
|
|
37
37
|
```sh
|
38
|
-
viddl https://www.youtube.com/watch?v=6g4dkBF5anU -s
|
38
|
+
viddl https://www.youtube.com/watch?v=6g4dkBF5anU -s 10 -e 15
|
39
39
|
```
|
40
40
|
|
41
41
|
#### Resize
|
42
42
|
|
43
|
-
This will resize to 640 x 480
|
43
|
+
This will resize to 640 x 480
|
44
44
|
|
45
45
|
```sh
|
46
46
|
viddl https://www.youtube.com/watch?v=6g4dkBF5anU -w 640 -h 480
|
@@ -48,7 +48,7 @@ viddl https://www.youtube.com/watch?v=6g4dkBF5anU -w 640 -h 480
|
|
48
48
|
|
49
49
|
#### Crop
|
50
50
|
|
51
|
-
This will crop a 40 x 40 pixel box at position 20 x 20
|
51
|
+
This will crop a 40 x 40 pixel box at position 20 x 20
|
52
52
|
|
53
53
|
```sh
|
54
54
|
viddl https://www.youtube.com/watch?v=6g4dkBF5anU --cx 20 --cy 20 --cw 40 --ch 40
|
@@ -56,7 +56,7 @@ viddl https://www.youtube.com/watch?v=6g4dkBF5anU --cx 20 --cy 20 --cw 40 --ch 4
|
|
56
56
|
|
57
57
|
#### Strip Audio
|
58
58
|
|
59
|
-
|
59
|
+
This will make the clip silent
|
60
60
|
|
61
61
|
```sh
|
62
62
|
viddl https://www.youtube.com/watch?v=6g4dkBF5anU --no-audio
|
@@ -64,7 +64,7 @@ viddl https://www.youtube.com/watch?v=6g4dkBF5anU --no-audio
|
|
64
64
|
|
65
65
|
#### Combine
|
66
66
|
|
67
|
-
Any or all of these options can be used together
|
67
|
+
Any or all of these options can be used together
|
68
68
|
|
69
69
|
```sh
|
70
70
|
viddl https://www.youtube.com/watch?v=6g4dkBF5anU -s 15 -e 22 --no-audio --cx 20 --cy 20 --cw 40 --ch 40 -w 640 -h 480
|
@@ -72,7 +72,7 @@ viddl https://www.youtube.com/watch?v=6g4dkBF5anU -s 15 -e 22 --no-audio --cx 20
|
|
72
72
|
|
73
73
|
### Ruby
|
74
74
|
|
75
|
-
Similar to the command line, Ruby usage and options are as follows
|
75
|
+
Similar to the command line, Ruby usage and options are as follows
|
76
76
|
|
77
77
|
```ruby
|
78
78
|
options = {
|
data/lib/viddl.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# Viddl
|
3
|
+
#
|
4
|
+
# Ruby/Command line tool to quickly download, cut, crop and
|
5
|
+
# resize video clips
|
3
6
|
#
|
4
7
|
# (c)2017 Ari Russo
|
5
8
|
# Apache 2.0 License
|
@@ -14,6 +17,6 @@ module Viddl
|
|
14
17
|
|
15
18
|
extend self
|
16
19
|
|
17
|
-
VERSION = "0.0.
|
20
|
+
VERSION = "0.0.3"
|
18
21
|
|
19
22
|
end
|
data/lib/viddl/video/instance.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "base64"
|
2
|
+
|
1
3
|
module Viddl
|
2
4
|
|
3
5
|
module Video
|
@@ -7,6 +9,8 @@ module Viddl
|
|
7
9
|
attr_accessor :download
|
8
10
|
attr_reader :id, :source_url
|
9
11
|
|
12
|
+
ID_LENGTH = 10
|
13
|
+
|
10
14
|
# @param [String] url The url of the video source
|
11
15
|
def initialize(url)
|
12
16
|
@source_url = url
|
@@ -52,7 +56,7 @@ module Viddl
|
|
52
56
|
# The video instance id
|
53
57
|
# @return [String]
|
54
58
|
def populate_id
|
55
|
-
@id = @source_url.
|
59
|
+
@id = Base64.encode64(@source_url).slice(0, ID_LENGTH)
|
56
60
|
end
|
57
61
|
|
58
62
|
end
|
data/spec/video/download_spec.rb
CHANGED
@@ -33,8 +33,8 @@ describe Viddl::Video::Download do
|
|
33
33
|
expect(@result).to(include(@source_url))
|
34
34
|
end
|
35
35
|
|
36
|
-
it "includes temp
|
37
|
-
expect(@result).to(include("#{Viddl::Video::Download::TEMPDIR}
|
36
|
+
it "includes temp dir" do
|
37
|
+
expect(@result).to(include("#{Viddl::Video::Download::TEMPDIR}/"))
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
data/spec/video/instance_spec.rb
CHANGED
@@ -3,11 +3,20 @@ require "helper"
|
|
3
3
|
describe Viddl::Video::Instance do
|
4
4
|
|
5
5
|
before(:each) do
|
6
|
-
@
|
7
|
-
@source_url = "https://youtube.com/watch?v=#{@
|
6
|
+
@yt_video_id = "6g4dkBF5anU"
|
7
|
+
@source_url = "https://youtube.com/watch?v=#{@yt_video_id}"
|
8
8
|
@video = Viddl::Video::Instance.new(@source_url)
|
9
9
|
end
|
10
10
|
|
11
|
+
context "#populate_id" do
|
12
|
+
|
13
|
+
it "populates id" do
|
14
|
+
expect(@video.id).to_not(be_nil)
|
15
|
+
expect(@video.id.length).to(eq(10))
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
11
20
|
context "#source_filenames" do
|
12
21
|
|
13
22
|
context "with associated download" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Russo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: 1.3.6
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project: viddl
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.6.8
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Quickly download, cut, crop and resize video clips
|