Skip to content

Commit

Permalink
Merge pull request #21 from Fullscreen/add-audit
Browse files Browse the repository at this point in the history
add VideoAudit::InvideoProgramming audit
  • Loading branch information
claudiofullscreen authored Jun 20, 2017
2 parents dc5a452 + 430d52f commit fbd443b
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ For more information about changelogs, check
[Keep a Changelog](http://keepachangelog.com) and
[Vandamme](http://tech-angels.github.io/vandamme).

## 0.5.3 - 2017-06-19

* [FEATURE] Add `VideoAudit::InvideoProgramming` to count videos with a branding annotation.

## 0.5.2 - 2017-06-14

* [FEATURE] Add `VideoAudit::EndScreen` to count videos with end screens.
Expand Down
4 changes: 3 additions & 1 deletion lib/yt/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
require 'yt/video_audit/video_end_screen'
require 'yt/video_audit/playlist_end_screen'
require 'yt/video_audit/website_end_screen'
require 'yt/video_audit/invideo_programming'

module Yt
class Audit
Expand All @@ -36,7 +37,8 @@ def run
Yt::VideoAudit::SubscribeEndScreen.new(videos: @videos),
Yt::VideoAudit::VideoEndScreen.new(videos: @videos),
Yt::VideoAudit::PlaylistEndScreen.new(videos: @videos),
Yt::VideoAudit::WebsiteEndScreen.new(videos: @videos)
Yt::VideoAudit::WebsiteEndScreen.new(videos: @videos),
Yt::VideoAudit::InvideoProgramming.new(videos: @videos),
]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/yt/audit/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Yt
class Audit
VERSION = '0.5.2'
VERSION = '0.5.3'
end
end
2 changes: 1 addition & 1 deletion lib/yt/video_audit/end_screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def title
end

def description
'The number of videos with at least one end screen'
'The number of videos with at least one end screen element'
end

private
Expand Down
24 changes: 24 additions & 0 deletions lib/yt/video_audit/invideo_programming.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'yt/video_audit/base'

module Yt
module VideoAudit
# Count how many subject videos have a branding.
class InvideoProgramming < Base
def title
'In-Video Programming'
end

def description
'The number of videos with an in-video programming'
end

private

def valid?(video)
Yt::Annotations.for(video.id).any? do |annotation|
annotation.instance_of? Yt::Annotations::Branding
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/yt/video_audit/playlist_end_screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Yt
module VideoAudit
# Count how many subject videos have an end screens
# Count how many subject videos have an end screen
# with a playlist link.
class PlaylistEndScreen < Base
def title
Expand Down
2 changes: 1 addition & 1 deletion lib/yt/video_audit/subscribe_end_screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Yt
module VideoAudit
# Count how many subject videos have an end screens
# Count how many subject videos have an end screen
# with a subscribe link.
class SubscribeEndScreen < Base
def title
Expand Down
2 changes: 1 addition & 1 deletion lib/yt/video_audit/video_end_screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Yt
module VideoAudit
# Count how many subject videos have an end screens
# Count how many subject videos have an end screen
# with a video link.
class VideoEndScreen < Base
def title
Expand Down
2 changes: 1 addition & 1 deletion lib/yt/video_audit/website_end_screen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Yt
module VideoAudit
# Count how many subject videos have an end screens
# Count how many subject videos have an end screen
# with a website link.
class WebsiteEndScreen < Base
def title
Expand Down
7 changes: 6 additions & 1 deletion test/yt/audit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_channel_audit
assert_equal 7, result[7].total_count

assert_equal 'End Screens', result[6].title
assert_equal "The number of videos with at least one end screen", result[6].description
assert_equal "The number of videos with at least one end screen element", result[6].description
assert_equal 2, result[6].valid_count
assert_equal 7, result[6].total_count

Expand All @@ -70,6 +70,11 @@ def test_channel_audit
assert_equal "The number of videos with any external link in its end screens", result[11].description
assert_equal 1, result[11].valid_count
assert_equal 7, result[11].total_count

assert_equal 'In-Video Programming', result[12].title
assert_equal "The number of videos with an in-video programming", result[12].description
assert_equal 6, result[12].valid_count
assert_equal 7, result[12].total_count
end

def test_channel_audit_with_videos_argument
Expand Down

0 comments on commit fbd443b

Please sign in to comment.