get_freaky 0.1.1 → 0.1.2.pre
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/bin/get_freaky +32 -6
- data/lib/get_freaky/conference.rb +13 -2
- data/lib/get_freaky/version.rb +2 -2
- data/lib/get_freaky/video.rb +52 -23
- metadata +60 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6338916db36a7680f7feff7d3aa07cd38518b59
|
4
|
+
data.tar.gz: e3489dac1296caf08995d929eaa7eb118c622522
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01e26f4c372b41713b28eb890f66b720cb13aac8ec5ed83d628c95036d5fcd91918ddc454ab4c47c377b7e16c3732ea3cac67a822780df612196ffbb6532b0ae
|
7
|
+
data.tar.gz: 0209cba65873ddda0855e0efd5709a4461d546d8c1872960444a507a8345c646840f5de3e57852eb6224ee42e3c3be1c51c7279939fc542ff1d275001d83592d
|
data/bin/get_freaky
CHANGED
@@ -18,8 +18,16 @@ command :conf do |c|
|
|
18
18
|
c.description = c.summary # Because we're lazy
|
19
19
|
c.example 'List information about the GORUCO conference', 'get_freaky conf GORUCO'
|
20
20
|
c.action do |args, options|
|
21
|
-
|
22
|
-
|
21
|
+
if ! args[0]
|
22
|
+
puts `get_freaky conf --help`
|
23
|
+
else
|
24
|
+
conf = Conference.find(args[0])
|
25
|
+
if conf.name == "Not Found"
|
26
|
+
puts "Sorry, there was no conference found by that name."
|
27
|
+
else
|
28
|
+
puts conf.event_list
|
29
|
+
end
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
@@ -43,12 +51,30 @@ command :download do |c|
|
|
43
51
|
c.example 'Download "The Future of Online Learning" from Railsberry 2013', 'get_freaky download "The Future of Online Learning" railsberry2013'
|
44
52
|
c.example 'Download "Sleep!" from Railsberry 2013', 'get_freaky download Sleep! railsberry2013'
|
45
53
|
c.action do |args, options|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
54
|
+
if args[0] == "featured"
|
55
|
+
Video.find_featured
|
56
|
+
else
|
57
|
+
video_title = args[0]
|
58
|
+
event = Event.find(args[1])
|
59
|
+
event_short_code = event.short_code
|
60
|
+
video = Video.find(event_short_code, video_title)
|
61
|
+
end
|
50
62
|
puts video.download
|
51
63
|
end
|
52
64
|
end
|
53
65
|
|
66
|
+
command :featured do |c|
|
67
|
+
c.syntax = 'get_freaky featured [options]'
|
68
|
+
#c.summary = 'Displays information about an event (an instance of a conference in a particular year)'
|
69
|
+
c.summary = 'Shows information on the "featured video" on confreaks.tv'
|
70
|
+
c.description = c.summary
|
71
|
+
c.example 'Show the current featured video on confreaks.tv', 'get_freaky featured'
|
72
|
+
c.action do |args, options|
|
73
|
+
video = Video.find_featured
|
74
|
+
puts video
|
75
|
+
puts agree("Would you like to download this video?") ? video.download : %Q(Okay. Here's the link if you change your mind #{video.url})
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
54
80
|
default_command :help
|
@@ -11,7 +11,14 @@ class Conference
|
|
11
11
|
|
12
12
|
def self.find(name)
|
13
13
|
response = get("/conferences/#{name}.json")
|
14
|
-
|
14
|
+
# TODO: I need to figure out a better way of dealing with 404 errors
|
15
|
+
if response["status"] == 404
|
16
|
+
self.new(
|
17
|
+
"Not Found",
|
18
|
+
"Not Found",
|
19
|
+
"Not Found"
|
20
|
+
)
|
21
|
+
elsif response.success?
|
15
22
|
self.new(
|
16
23
|
response["name"],
|
17
24
|
response["event_count"],
|
@@ -24,6 +31,10 @@ class Conference
|
|
24
31
|
end
|
25
32
|
|
26
33
|
def event_list
|
27
|
-
events
|
34
|
+
if events == "Not Found"
|
35
|
+
"There was no conference found by that name."
|
36
|
+
else
|
37
|
+
events.map { |event| event["short_code"] }
|
38
|
+
end
|
28
39
|
end
|
29
40
|
end
|
data/lib/get_freaky/version.rb
CHANGED
data/lib/get_freaky/video.rb
CHANGED
@@ -2,28 +2,73 @@ class Video
|
|
2
2
|
include HTTParty
|
3
3
|
BASE_URI = "http://confreaks.tv/api/v1"
|
4
4
|
base_uri "http://confreaks.tv/api/v1"
|
5
|
-
attr_accessor :title, :abstract, :embed_code
|
6
5
|
|
7
|
-
|
6
|
+
attr_accessor :title, :abstract, :host, :embed_code, :event_short_code
|
7
|
+
|
8
|
+
def initialize(title, abstract, host, embed_code, event_short_code)
|
8
9
|
self.title = title
|
9
10
|
self.abstract = abstract
|
11
|
+
self.host = host
|
10
12
|
self.embed_code = embed_code
|
13
|
+
# TODO: This feels like a kludge to me--figure out a better way to deal with the event_short_code for featured videos
|
14
|
+
self.event_short_code = event_short_code || nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.find_featured
|
18
|
+
response = get("/featured-video.json")
|
19
|
+
if response.success?
|
20
|
+
self.create_video(response)
|
21
|
+
else
|
22
|
+
raise response.response
|
23
|
+
end
|
11
24
|
end
|
12
25
|
|
13
26
|
def self.find(event_short_code, title)
|
14
27
|
slug = self.create_slug(event_short_code, title)
|
15
28
|
response = get("/videos/#{slug}.json")
|
16
29
|
if response.success?
|
17
|
-
|
18
|
-
response["title"],
|
19
|
-
response["abstract"],
|
20
|
-
response["embed_code"]
|
21
|
-
)
|
30
|
+
self.create_video(response, event_short_code)
|
22
31
|
else
|
23
32
|
raise response.response
|
24
33
|
end
|
25
34
|
end
|
26
35
|
|
36
|
+
def download
|
37
|
+
cmd = %x[ viddl-rb #{url} ]
|
38
|
+
end
|
39
|
+
|
40
|
+
def event
|
41
|
+
Event.find(event_short_code)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
info = %Q{
|
46
|
+
Title: #{title}
|
47
|
+
Description: #{abstract}
|
48
|
+
Link: #{url}
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def url
|
53
|
+
if host == "youtube"
|
54
|
+
"https://www.youtube.com/watch?v=#{embed_code}"
|
55
|
+
elsif host == "vimeo"
|
56
|
+
"https://vimeo.com/#{embed_code}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def self.create_video(response, event_short_code=nil)
|
63
|
+
Video.new(
|
64
|
+
response["title"],
|
65
|
+
response["abstract"],
|
66
|
+
response["host"],
|
67
|
+
response["embed_code"],
|
68
|
+
event_short_code
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
27
72
|
# TODO: That's WAY too many lines of code to do something relatively simple.
|
28
73
|
# I'm sure I can do better with some time spent cooking up a regular expression
|
29
74
|
# Also I may come up against more situations in which slugify isn't consistent
|
@@ -37,21 +82,5 @@ class Video
|
|
37
82
|
_i = _i.chomp('-').chomp(',')
|
38
83
|
end
|
39
84
|
|
40
|
-
def download
|
41
|
-
cmd = %x[ viddl-rb #{youtube_url} ]
|
42
|
-
end
|
43
|
-
|
44
|
-
#private
|
45
|
-
|
46
|
-
def youtube_url
|
47
|
-
"https://www.youtube.com/watch?v=#{embed_code}"
|
48
|
-
end
|
49
85
|
end
|
50
86
|
|
51
|
-
def find(event_short_code, title)
|
52
|
-
slug = self.create_slug(event_short_code, title)
|
53
|
-
response = HTTParty.get("http://confreaks.tv/api/v1/videos/#{slug}.json")
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: get_freaky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Mariano Cabrera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: table_print
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.5.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.3
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: httparty
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,34 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: fabricas
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.1.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.1.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aruba
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.6.2
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.6.2
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: bundler
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +122,20 @@ dependencies:
|
|
80
122
|
- - "~>"
|
81
123
|
- !ruby/object:Gem::Version
|
82
124
|
version: '10.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: jazz_fingers
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.0.0
|
83
139
|
description: Wrapper for the confreaks API. Browse and download convention videos
|
84
140
|
from the command line.
|
85
141
|
email: stephen.m.cabrera@gmail.com
|
@@ -111,9 +167,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
167
|
version: '0'
|
112
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
169
|
requirements:
|
114
|
-
- - "
|
170
|
+
- - ">"
|
115
171
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
172
|
+
version: 1.3.1
|
117
173
|
requirements: []
|
118
174
|
rubyforge_project:
|
119
175
|
rubygems_version: 2.2.2
|