yt-audit 0.2.0 → 0.2.1

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: 7da22a57ea6de80903cdfaedc43242975109e22b
4
- data.tar.gz: 3e77764bc854359f62880bc4576a7ac86e667ac9
3
+ metadata.gz: 1985f6dcd66807535c99d44333847590d11b75b6
4
+ data.tar.gz: 1be1b823be83ba994908a9f4f60c4ccfbec74b02
5
5
  SHA512:
6
- metadata.gz: 999786ef7ebdccbcbafe39c075105db541b5f6292022b2505d2e7df6fbde93dbfbcef176529de0b425f4b01b6ed8526fbe535142deab875b2ae1cfb6f7a4d42d
7
- data.tar.gz: b0219b654d9e6a59bcec46a554690d1e7ce433b88f9374724ed45b9aa672564ab6ae59ce54630f955ad69e1ee72776915d8aac2c4275da5c418cd927030f2f9d
6
+ metadata.gz: 08052224cb49b7eea75b17a8f437ca582fd62234e1b0925c6eda4efa0ded0804837b7e545b2e581d42fe338b556b32493a9c18bcde2d2cf84a910ccd65c84679
7
+ data.tar.gz: b9a1d57d5e580d28cb40a594680c1c9656637c7900a472b11e97735e93c26564b63c2e3792e2de1aef0d17a5ef9273fbc9c360286de61ec2a1cf98e268e7e749
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.2.1 - 2016.02.19
10
+
11
+ * [FEATURE] Add `PlaylistAudit::Descripton` for `run` to also count playlists with a description.
12
+
9
13
  ## 0.2.0 - 2016.02.18
10
14
 
11
15
  **How to upgrade**
data/README.md CHANGED
@@ -30,20 +30,20 @@ The **source code** is available on [GitHub](https://github.com/Fullscreen/yt-au
30
30
  audit = Yt::Audit.new(channel_id: 'UCPCk_8dtVyR1lLHMBEILW4g')
31
31
  # => #<Yt::Audit:0x007f94ec8050b0 @channel_id="UCPCk_8dtVyR1lLHMBEILW4g">
32
32
  audit.run
33
- # => [#<Yt::VideoAudit::InfoCard:0x007f94ec8c6f30 @videos=[...]>, #<Yt::VideoAudit::BrandAnchoring...>, #<Yt::VideoAudit::SubscribeAnnotation...>, #<Yt::VideoAudit::YoutubeAssociation...>, #<Yt::VideoAudit::EndCard...>]
33
+ # => [#<Yt::VideoAudit::InfoCard:0x007f94ec8c6f30 @videos=[...]>, #<Yt::VideoAudit::BrandAnchoring...>, #<Yt::VideoAudit::SubscribeAnnotation...>, #<Yt::VideoAudit::YoutubeAssociation...>, #<Yt::VideoAudit::EndCard...>, #<Yt::PlaylistAudit::Description...>]
34
34
  ```
35
35
 
36
- You can call four available methods `total_count`, `valid_count`, `title`, and `description` from each `Yt::VideoAudit` object.
36
+ You can call four available methods `total_count`, `valid_count`, `title`, and `description` from each `Yt::VideoAudit` or `Yt::PlaylistAudit` object.
37
37
 
38
38
  ```ruby
39
- video_audit = audit.run[0]
39
+ audit_item = audit.run[0]
40
40
  # => #<Yt::VideoAudit::InfoCard:0x007f94ec979ab8 @videos=[...]>
41
- video_audit.total_count
41
+ audit_item.total_count
42
42
  # => 10
43
- video_audit.valid_count
43
+ audit_item.valid_count
44
44
  # => 10
45
- video_audit.title
45
+ audit_item.title
46
46
  # => "Info Cards"
47
- video_audit.description
47
+ audit_item.description
48
48
  # => "The number of videos with an info card"
49
49
  ```
data/bin/yt-audit CHANGED
@@ -10,9 +10,9 @@ end
10
10
  channel_id = ARGV[0] || 'UCKM-eG7PBcw3flaBvd0q2TQ'
11
11
  audit = Yt::Audit.new(channel_id: channel_id)
12
12
  puts "Channel: https://www.youtube.com/channel/#{channel_id}"
13
- audit.run.each do |video_audit|
13
+ audit.run.each do |audit_item|
14
14
  puts
15
- puts "#{video_audit.description}"
16
- puts "#{video_audit.title}: #{video_audit.valid_count} out of #{video_audit.total_count}"
15
+ puts "#{audit_item.description}"
16
+ puts "#{audit_item.title}: #{audit_item.valid_count} out of #{audit_item.total_count}"
17
17
  end
18
18
 
data/lib/yt/audit.rb CHANGED
@@ -5,6 +5,7 @@ require 'yt/video_audit/brand_anchoring'
5
5
  require 'yt/video_audit/subscribe_annotation'
6
6
  require 'yt/video_audit/youtube_association'
7
7
  require 'yt/video_audit/end_card'
8
+ require 'yt/playlist_audit/description'
8
9
 
9
10
  module Yt
10
11
  class Audit
@@ -18,12 +19,17 @@ module Yt
18
19
  Yt::VideoAudit::BrandAnchoring.new(videos: videos, brand: channel.title),
19
20
  Yt::VideoAudit::SubscribeAnnotation.new(videos: videos),
20
21
  Yt::VideoAudit::YoutubeAssociation.new(videos: videos),
21
- Yt::VideoAudit::EndCard.new(videos: videos)
22
+ Yt::VideoAudit::EndCard.new(videos: videos),
23
+ Yt::PlaylistAudit::Description.new(playlists: playlists)
22
24
  ]
23
25
  end
24
26
 
25
27
  private
26
28
 
29
+ def playlists
30
+ @playlists ||= channel.playlists.first 10
31
+ end
32
+
27
33
  def videos
28
34
  @videos ||= channel.videos.first 10
29
35
  end
@@ -1,5 +1,5 @@
1
1
  module Yt
2
2
  class Audit
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -0,0 +1,32 @@
1
+ module Yt
2
+ module PlaylistAudit
3
+ # Count how many playlists have its description.
4
+ class Description
5
+ def initialize(playlists:)
6
+ @playlists = playlists
7
+ end
8
+
9
+ def total_count
10
+ @playlists.size
11
+ end
12
+
13
+ def valid_count
14
+ @playlists.count {|playlist| valid? playlist}
15
+ end
16
+
17
+ def title
18
+ 'Playlist Description'
19
+ end
20
+
21
+ def description
22
+ 'The number of playlists with description'
23
+ end
24
+
25
+ private
26
+
27
+ def valid?(playlist)
28
+ !playlist.description.empty?
29
+ end
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kang-Kyu Lee
@@ -129,6 +129,7 @@ files:
129
129
  - bin/yt-audit
130
130
  - lib/yt/audit.rb
131
131
  - lib/yt/audit/version.rb
132
+ - lib/yt/playlist_audit/description.rb
132
133
  - lib/yt/video_audit/base.rb
133
134
  - lib/yt/video_audit/brand_anchoring.rb
134
135
  - lib/yt/video_audit/end_card.rb