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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 754721cccbe03abc4baaaeeb3cc7b4a466ff792b
4
- data.tar.gz: 4aaddeaa7ff0dcd5bdedd75e81168671a640e528
3
+ metadata.gz: c6c38487a2d7d5f254f6a2c578ee593a19869e92
4
+ data.tar.gz: 7a23f5b3d8a6e3bb71c66c60db05f22dcb142e9b
5
5
  SHA512:
6
- metadata.gz: d0ac5e272ff2b62a0db0e2de646c85450ad802a1b9248216966f1421a3fdcaa555ca4938c867629bc09756945915f787e59976195147852941bc0823cc1ac5c8
7
- data.tar.gz: 81f1c6314ab103b92c6bead41880835dc5eb4afebe9362d09f6881d35cc9fb4122b8b82604745b426364dfe7ec8d410ce14fa1f725d965e696451fa4d143fd8f
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
- Alternately, this will start the clip at 15 seconds in the original video and stop at 22 seconds
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 15 -e 22
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
- Audio can be left out of the clip:
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 = {
@@ -1,5 +1,8 @@
1
1
  #
2
- # viddl
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.2"
20
+ VERSION = "0.0.3"
18
21
 
19
22
  end
@@ -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.scan(/youtube.com\/watch\?v\=(\S*)&?/).flatten.first
59
+ @id = Base64.encode64(@source_url).slice(0, ID_LENGTH)
56
60
  end
57
61
 
58
62
  end
@@ -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 file path" do
37
- expect(@result).to(include("#{Viddl::Video::Download::TEMPDIR}/#{@video_id}"))
36
+ it "includes temp dir" do
37
+ expect(@result).to(include("#{Viddl::Video::Download::TEMPDIR}/"))
38
38
  end
39
39
 
40
40
  end
@@ -3,11 +3,20 @@ require "helper"
3
3
  describe Viddl::Video::Instance do
4
4
 
5
5
  before(:each) do
6
- @video_id = "6g4dkBF5anU"
7
- @source_url = "https://youtube.com/watch?v=#{@video_id}"
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.2
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-04 00:00:00.000000000 Z
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.4.6
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