robbie 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -18
- data/lib/robbie/command.rb +4 -1
- data/lib/robbie/request.rb +39 -1
- data/lib/robbie/search.rb +12 -0
- data/lib/robbie/version.rb +1 -1
- data/lib/robbie.rb +3 -3
- metadata +1 -2
- data/lib/robbie/keys.json +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dd30b7ec003d2d52b6ff91563c34d5fd54f92d5
|
4
|
+
data.tar.gz: 628def2f049252b0816beaaff19ddc78701157ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c21f51693f56f328bd999cdee92ff916f18b17677f6851b1fa146e4007f2d234e33d2c912dbe69e8a0d459e89fbc768da6abc2175119e892e64a0eba10a6bb
|
7
|
+
data.tar.gz: e5aaa2ecdeeafe1f74210151d2922c016926dedb6b77f3f5ddb9c32f79cc824ae45ceea4147df3a6b238f7a51a7a22a99ab0c98d021d1c77e9aa37556e63ebad
|
data/README.md
CHANGED
@@ -1,36 +1,24 @@
|
|
1
1
|
# robbie
|
2
|
-
Media
|
2
|
+
Media Information at your Fingertips
|
3
3
|
|
4
4
|
<img align="right" height="260" src="http://poile.me/robbie/img/logo.png">
|
5
5
|
|
6
|
-
##
|
6
|
+
## Docs
|
7
|
+
### `robbie`, the friendly robot
|
7
8
|
|
8
|
-
|
9
|
-
- [OMDB gem](https://github.com/jvanbaarsen/omdb)
|
10
|
-
- [CanIStreamIt API](https://github.com/KevinBongart/canistreamit)
|
9
|
+
Primarily you'll be using `info`, if you know what you want, but you can also use `search` if you're looking to find something general.
|
11
10
|
|
12
|
-
### Music
|
13
|
-
- [SoundCloud API 1](https://developers.soundcloud.com/docs/api/guide)
|
14
|
-
- [SoundCloud API 2](https://developers.soundcloud.com/docs/api/sdks)
|
15
|
-
- [SoundCloud gem](https://github.com/soundcloud/soundcloud-ruby)
|
16
|
-
|
17
|
-
### Books
|
18
|
-
- [GoodReads API](http://www.goodreads.com/api)
|
19
|
-
- [Goodreads gem](https://github.com/sosedoff/goodreads)
|
20
|
-
|
21
|
-
## Ideas/Planning
|
22
|
-
### `robbie`, the main command
|
23
11
|
Specify one of the following afterwards (as well as as a title for the media)
|
24
12
|
- `movie`
|
25
13
|
|
26
14
|
```bash
|
27
|
-
robbie movie "Hitchhiker's Guide to the Galaxy"
|
15
|
+
robbie info movie "Hitchhiker's Guide to the Galaxy"
|
28
16
|
```
|
29
17
|
|
30
18
|
- `tv`
|
31
19
|
|
32
20
|
```bash
|
33
|
-
robbie tv "Rick and Morty"
|
21
|
+
robbie search tv "Rick and Morty" # =>
|
34
22
|
```
|
35
23
|
|
36
24
|
- `music`
|
data/lib/robbie/command.rb
CHANGED
@@ -32,7 +32,10 @@ module Command
|
|
32
32
|
when 'tv' then Request.tv(@args)
|
33
33
|
when 'actor' then Request.actor(@args)
|
34
34
|
when 'book' then Request.book(@args)
|
35
|
-
when '
|
35
|
+
when 'song' then Request.song(@args)
|
36
|
+
when 'album' then Request.album(@args)
|
37
|
+
when 'artist' then Request.artist(@args)
|
38
|
+
when 'id' then Request.id(@args) # currently only works for movie and tv show
|
36
39
|
else help end
|
37
40
|
end
|
38
41
|
|
data/lib/robbie/request.rb
CHANGED
@@ -17,11 +17,49 @@ module Request
|
|
17
17
|
puts "Title: \t\t #{@json["Title"]}"
|
18
18
|
puts "Plot: \t\t #{@json["Plot"]}"
|
19
19
|
puts "Poster: \t #{@json["Poster"]}"
|
20
|
-
puts "
|
20
|
+
puts "Actors: \t #{@json["Actors"]}"
|
21
21
|
puts "Rating: \t\t #{@json["imdbRating"]}"
|
22
22
|
end
|
23
23
|
|
24
|
+
def artist(args) # to do
|
25
|
+
@artist = URI.escape(args.shift)
|
26
|
+
@res = HTTP.get("http://ws.audioscrobbler.com/2.0/?method=artist.getInfo&artist=#{@artist}&api_key=0a7d3b25ed857f679eba1a353e98a658&format=json").body
|
27
|
+
@json = JSON.parse(@res)
|
28
|
+
|
29
|
+
puts @json['artist']['bio']['summary']
|
30
|
+
end
|
31
|
+
|
32
|
+
def song(args) # to do
|
33
|
+
# Requires track title and artist name
|
34
|
+
@song = URI.escape(args.shift)
|
35
|
+
@artist = URI.escape(args.shift)
|
36
|
+
@res = HTTP.get("http://ws.audioscrobbler.com/2.0/?method=track.getInfo&track=#{@song}&artist=#{@artist}&api_key=0a7d3b25ed857f679eba1a353e98a658&format=json").body
|
37
|
+
@json = JSON.parse(@res)
|
38
|
+
|
39
|
+
puts "Title: \t\t#{@json['track']['name']}"
|
40
|
+
puts "Artist: \t#{@json['track']['artist']['name']}"
|
41
|
+
puts "Year: \t\t#{@json['track']['wiki']['published']}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def album(args) # works, sort of
|
45
|
+
# Requires artist and album
|
46
|
+
@album = URI.escape(args.shift)
|
47
|
+
@artist = URI.escape(args.shift)
|
48
|
+
@res = HTTP.get("http://ws.audioscrobbler.com/2.0/?method=album.getInfo&artist=#{@artist}&album=#{@album}&api_key=0a7d3b25ed857f679eba1a353e98a658&format=json").body
|
49
|
+
@json = JSON.parse(@res)
|
50
|
+
|
51
|
+
puts "Title: \t\t#{puts @json['album']['name']}"
|
52
|
+
puts "Artist: \t#{@json['album']['artist']}"
|
53
|
+
puts "Year: \t\t#{@json['album']['wiki']['published']}"
|
54
|
+
puts "Tracks: \t"
|
55
|
+
|
56
|
+
@json['album']['tracks']['track'].each do |track|
|
57
|
+
puts "\t#{track['name']}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
24
61
|
def movie(title)
|
62
|
+
puts "title: #{title}"
|
25
63
|
Bitly.use_api_version_3
|
26
64
|
|
27
65
|
bitly = Bitly.new('benp51', 'R_886e9ca24b25c1e91d66f5c6379568a9')
|
data/lib/robbie/search.rb
CHANGED
@@ -7,6 +7,10 @@ module Search
|
|
7
7
|
module_function
|
8
8
|
|
9
9
|
def movie(title)
|
10
|
+
if title.empty?
|
11
|
+
puts "You need to specify a movie to query"
|
12
|
+
exit
|
13
|
+
end
|
10
14
|
title = URI.escape(title.first)
|
11
15
|
url = "http://www.omdbapi.com/?type=movie&r=json&s="+title
|
12
16
|
omdbData = JSON.parse(HTTP.get('http://www.omdbapi.com/?type=movie&r=json&s='+title).body)
|
@@ -16,6 +20,10 @@ module Search
|
|
16
20
|
end
|
17
21
|
|
18
22
|
def tv (title)
|
23
|
+
if title.nil?
|
24
|
+
puts "You need to specify a TV show to query"
|
25
|
+
exit
|
26
|
+
end
|
19
27
|
title = URI.escape(title.first)
|
20
28
|
omdbData = JSON.parse(HTTP.get('http://www.omdbapi.com/?type=series&r=json&s='+title).body)
|
21
29
|
puts "- #{omdbData["Search"][0]["Title"]} (#{omdbData["Search"][0]["Year"]}) /#{omdbData["Search"][0]["imdbID"]}"
|
@@ -24,6 +32,10 @@ module Search
|
|
24
32
|
end
|
25
33
|
|
26
34
|
def actor (name)
|
35
|
+
if name.nil?
|
36
|
+
puts "You need to specify an actor/actress to query"
|
37
|
+
exit
|
38
|
+
end
|
27
39
|
name = URI.escape(name.first)
|
28
40
|
myApiFilms = JSON.parse(HTTP.get("http://www.myapifilms.com/imdb/idIMDB?name=#{name}&token=8e26a029-8cf1-4dd7-89bd-889bf5e74cbd&format=json&language=en-us&limit=1&bornDied=1").body)
|
29
41
|
|
data/lib/robbie/version.rb
CHANGED
data/lib/robbie.rb
CHANGED
@@ -3,7 +3,7 @@ require_relative 'robbie/version'
|
|
3
3
|
require_relative 'robbie/command'
|
4
4
|
require 'rainbow'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Robbie
|
7
7
|
module_function #ily
|
8
8
|
|
9
9
|
def run(*args)
|
@@ -21,9 +21,9 @@ module Marvin
|
|
21
21
|
case @first
|
22
22
|
when 'search' then Command.search(@args)
|
23
23
|
when 'info' then Command.info(@args)
|
24
|
-
when 'version', '--version' then puts
|
24
|
+
when 'version', '--version' then puts Robbie::E_VERSION
|
25
25
|
when 'help', '--help' then Command.help(@args)
|
26
|
-
else puts "
|
26
|
+
else puts "robbie: '#{@first}' is not a robbie command. See 'robbie --help'."
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robbie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Poile
|
@@ -130,7 +130,6 @@ files:
|
|
130
130
|
- bin/robbie
|
131
131
|
- lib/robbie.rb
|
132
132
|
- lib/robbie/command.rb
|
133
|
-
- lib/robbie/keys.json
|
134
133
|
- lib/robbie/request.rb
|
135
134
|
- lib/robbie/search.rb
|
136
135
|
- lib/robbie/version.rb
|