sentry-videos 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b778de37e744ceded2a9e4bdc9e3d275a845016a
4
+ data.tar.gz: c85d8f0da72fa0f861354bf00a93b93888f064aa
5
+ SHA512:
6
+ metadata.gz: 94c2431093a9ff854c33b154ddce75d5a0ae137fea4b5fb31ade58d6938622d02d8141301a7bf15ef29c69ac2ba4437776aea904748648c5ee8f422937ec5158
7
+ data.tar.gz: a258363eef5f36ca2f68c7b04b56a05087e0f1ed4303cc154ad63418e3a17ea866a0be083e0b53dab2ba375d63adb8718250cd76cd565580501b0c1661b60cd0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ pkg/
3
+ vendor/cache/*.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 jRiddick
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ = sentry-videos
2
+
3
+ * {Homepage}[https://rubygems.org/gems/sentry-videos]
4
+ * {Documentation}[http://rubydoc.info/gems/sentry-videos/frames]
5
+ * {Email}[mailto:apersson.93 at gmail.com]
6
+
7
+ == Description
8
+
9
+ TODO: Description
10
+
11
+ == Features
12
+
13
+ == Examples
14
+
15
+ require 'sentry/videos'
16
+
17
+ == Requirements
18
+
19
+ == Install
20
+
21
+ $ gem install sentry-videos
22
+
23
+ == Copyright
24
+
25
+ Copyright (c) 2015 jRiddick
26
+
27
+ See LICENSE.txt for details.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,77 @@
1
+ require 'cinch'
2
+ require 'video_info'
3
+ require 'twitter-text'
4
+ require 'uri'
5
+ require 'chronic_duration'
6
+ require 'sentry/helper'
7
+
8
+ module Cinch
9
+ module Plugins
10
+ module Sentry
11
+ class Videos
12
+ include Cinch::Plugin
13
+ include Twitter::Extractor
14
+
15
+ # Fetch all github links
16
+ listen_to :channel
17
+
18
+ def initialize(*)
19
+ super
20
+ end
21
+
22
+ def listen(m)
23
+ # Exctract urls
24
+ urls = extract_urls(m.message)
25
+
26
+ # Set the API keys
27
+ VideoInfo.provider_api_keys = {
28
+ youtube: config["youtube"],
29
+ vimeo: config["vimeo"]
30
+ }
31
+
32
+ # Go through all links
33
+ urls.each do |url|
34
+ # Parse the url
35
+ uri = URI.parse(URI.escape(url.to_url))
36
+
37
+ # We only handle GitHub links
38
+ case uri.host
39
+ when "www.dailymotion.com",
40
+ "dailymotion.com",
41
+ "dai.ly",
42
+ "www.dai.ly",
43
+ "vimeo.com",
44
+ "www.vimeo.com",
45
+ "www.youtube.com",
46
+ "youtube.com",
47
+ "youtu.be",
48
+ "www.youtu.be"
49
+ begin
50
+ # Get information from the link
51
+ video = VideoInfo.new(uri.to_s, "User-Agent" => "Sentry IRC Bot/0.1.0")
52
+
53
+ # Check if it is a link to a live video
54
+ if video.duration == 0 and video.provider.eql? "YouTube"
55
+ m.reply("[%s] %s (%s)" % [
56
+ Format(:green, video.provider),
57
+ Format(:bold, video.title),
58
+ Format(:orange, "LIVE")
59
+ ])
60
+ else
61
+ m.reply("[%s] %s (duration: %s)" % [
62
+ Format(:green, video.provider),
63
+ Format(:bold, video.title),
64
+ Format(:teal, ChronicDuration.output(video.duration))
65
+ ])
66
+ end
67
+ rescue Exception => e
68
+ # Log the exception
69
+ puts e
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "sentry-videos"
5
+ gem.version = File.new("VERSION", 'r').read.chomp
6
+ gem.summary = %q{Parses messages for videos links and replies with information about the video}
7
+ gem.license = "MIT"
8
+ gem.authors = ["jRiddick"]
9
+ gem.email = "apersson.93@gmail.com"
10
+ gem.homepage = "https://rubygems.org/gems/sentry-videos"
11
+
12
+ gem.files = `git ls-files`.split($/)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.require_paths = ['lib']
16
+
17
+ gem.add_development_dependency 'bundler', '~> 1.0'
18
+
19
+ gem.add_dependency "cinch", "~> 2.0"
20
+ gem.add_dependency "video_info", "~> 2.5"
21
+ gem.add_dependency "chronic", "~> 0.10"
22
+ gem.add_dependency "chronic_duration", "~> 0.10"
23
+ gem.add_dependency "twitter-text", "~> 1.13"
24
+ gem.add_dependency "sentry-helper", "~> 0.1.0"
25
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sentry-videos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - jRiddick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cinch
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: video_info
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: chronic
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.10'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: chronic_duration
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.10'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: twitter-text
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.13'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.13'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sentry-helper
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.1.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.1.0
111
+ description:
112
+ email: apersson.93@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - ".gitignore"
118
+ - Gemfile
119
+ - LICENSE.txt
120
+ - README.rdoc
121
+ - VERSION
122
+ - lib/cinch/plugins/sentry/videos.rb
123
+ - sentry-videos.gemspec
124
+ homepage: https://rubygems.org/gems/sentry-videos
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.5.1
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Parses messages for videos links and replies with information about the video
148
+ test_files: []