yt 0.29.0 → 0.29.1
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/CHANGELOG.md +4 -0
- data/lib/yt/models/content_detail.rb +6 -0
- data/lib/yt/models/video.rb +4 -0
- data/lib/yt/version.rb +1 -1
- data/spec/models/content_detail_spec.rb +7 -0
- data/spec/requests/as_account/video_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d230c04ee3f54a7973c00c77df5da93267abe5c
|
4
|
+
data.tar.gz: f59ed4300490ef5955c4d29549da530ee5e2f5eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 052df215093feaa61545a96f41fa13de5919bf0f0abc78db9ee67788434b9c08b0451405673d0645d7491898f5f1fac608411a4c3290c01b8590a892b2fcce86
|
7
|
+
data.tar.gz: 5e7e1ffdc1ee27511e5f9172efb7964edae8c0bd541e76f8aed095cc686f70e0ccf1423cc6420533f23d4a966bcfa5eb915a9d8b43c2d958ed074d4816326518
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 0.29.1 - 2017-02-26
|
10
|
+
|
11
|
+
* [FEATURE] Add `Video#length` to show the duration as an ISO 8601 time.
|
12
|
+
|
9
13
|
## 0.29.0 - 2017-02-17
|
10
14
|
|
11
15
|
**How to upgrade**
|
@@ -29,6 +29,12 @@ module Yt
|
|
29
29
|
content_rating['ytRating']
|
30
30
|
end
|
31
31
|
|
32
|
+
# @return [<String>] the length of the video as an ISO 8601 time, HH:MM:SS.
|
33
|
+
def length
|
34
|
+
hh, mm, ss = duration / 3600, duration / 60 % 60, duration % 60
|
35
|
+
[hh, mm, ss].map{|t| t.to_s.rjust(2,'0')}.join(':')
|
36
|
+
end
|
37
|
+
|
32
38
|
private
|
33
39
|
|
34
40
|
# @return [Integer] the duration of the resource as reported by YouTube.
|
data/lib/yt/models/video.rb
CHANGED
@@ -231,6 +231,10 @@ module Yt
|
|
231
231
|
# @return [Integer] the duration of the video (in seconds).
|
232
232
|
delegate :duration, to: :content_detail
|
233
233
|
|
234
|
+
# @!attribute [r] duration
|
235
|
+
# @return [String] the length of the video as an ISO 8601 time, HH:MM:SS.
|
236
|
+
delegate :length, to: :content_detail
|
237
|
+
|
234
238
|
# @return [Boolean] whether the video is available in 3D.
|
235
239
|
def stereoscopic?
|
236
240
|
content_detail.dimension == '3d'
|
data/lib/yt/version.rb
CHANGED
@@ -42,4 +42,11 @@ describe Yt::ContentDetail do
|
|
42
42
|
it { expect(content_detail.duration).to eq 51 }
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
describe '#length' do
|
47
|
+
context 'returns the duration in HH:MM:SS' do
|
48
|
+
let(:data) { {"duration"=>"PT1H18M52S"} }
|
49
|
+
it { expect(content_detail.length).to eq '01:18:52' }
|
50
|
+
end
|
51
|
+
end
|
45
52
|
end
|
@@ -29,6 +29,7 @@ describe Yt::Video, :device_app do
|
|
29
29
|
expect(video.favorite_count).to be_an Integer
|
30
30
|
expect(video.comment_count).to be_an Integer
|
31
31
|
expect(video.duration).to be_an Integer
|
32
|
+
expect(video.length).to be_a String
|
32
33
|
expect(video.hd?).to be_in [true, false]
|
33
34
|
expect(video.stereoscopic?).to be_in [true, false]
|
34
35
|
expect(video.captioned?).to be_in [true, false]
|