booyah 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Podcasts/booyah.json +1 -0
- data/README.md +22 -0
- data/bin/booyah +27 -0
- data/lib/initialize.rb +153 -0
- metadata +51 -0
@@ -0,0 +1 @@
|
|
1
|
+
{ "url" : "http://dejay.github.com/Booyah/feed.json" }
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#Booyah!
|
2
|
+
*Podcast with JSON FTW*
|
3
|
+
|
4
|
+
Booyah is a software suite that allows you share JSON-coded podcasts with a massive online community!
|
5
|
+
|
6
|
+
###Using Booyah
|
7
|
+
Booyah's main purposes are viewing, downloading, and playing podcasts.
|
8
|
+
```shell
|
9
|
+
booyah view [podcast]
|
10
|
+
booyah dl [podcast]/[episode]
|
11
|
+
booyah play [podcast]/[episode]
|
12
|
+
```
|
13
|
+
##Adding podcasts
|
14
|
+
Instead of storing podcast data, the Booyah repo stores only links to existing podcasts (see `Podcasts/booyah.json`). This way, podcasters do not have to update the repo every time that they add an episode.
|
15
|
+
|
16
|
+
For example, a podcaster would create a JSON file entitled with the name of the podcast. The file should contain a single line similar to the following:
|
17
|
+
|
18
|
+
```JSON
|
19
|
+
{ "url" : "http://dejay.github.com/Booyah/feed.json"}
|
20
|
+
```
|
21
|
+
|
22
|
+
Where `"URL"`is the URL to your JSON-coded podcast!
|
data/bin/booyah
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
BOOYAH_FILE = File.expand_path(__FILE__)
|
6
|
+
BOOYAH_REPO = Pathname.new(__FILE__).realpath.dirname.parent
|
7
|
+
BOOYAH_LIBRARY = Pathname.new(__FILE__).realpath.dirname.parent.join("lib").to_s
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift(BOOYAH_LIBRARY)
|
10
|
+
|
11
|
+
require 'initialize'
|
12
|
+
|
13
|
+
case ARGV.first when 'help', '--help', '-h', 'h', nil
|
14
|
+
puts BOOYAH_HELP
|
15
|
+
when 'home', 'homepage'
|
16
|
+
Booyah.home
|
17
|
+
when 'version', '--version', '-v', 'v'
|
18
|
+
puts "Booyah Version: #{BOOYAH_VERSION}"
|
19
|
+
when 'view'
|
20
|
+
Booyah.view(ARGV)
|
21
|
+
when 'download', 'dl'
|
22
|
+
Booyah.dl(ARGV)
|
23
|
+
when 'play'
|
24
|
+
Booyah.play(ARGV)
|
25
|
+
when 'search'
|
26
|
+
Booyah.search(ARGV)
|
27
|
+
end
|
data/lib/initialize.rb
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
BOOYAH_VERSION = '0.0.9'
|
2
|
+
BOOYAH_DIR = "/Library/Caches/Booyah"
|
3
|
+
BOOYAH_HOMEPAGE = "https://dejay.github.com/booyah"
|
4
|
+
#BOOYAH_REPO = Pathname.new(HOMEBREW_BREW_FILE).realpath.dirname.parent
|
5
|
+
#BOOYAH_TREE = "https://github.com/dejay/Booyah/tree/master"
|
6
|
+
BOOYAH_HELP = <<-EOS
|
7
|
+
|
8
|
+
You obviously do not know how to use Booyah. Yet.
|
9
|
+
You have, however, come to the right place!
|
10
|
+
|
11
|
+
Here are the secrets to success:
|
12
|
+
If you want to know what version of Booyah you have installed, run one of the following:
|
13
|
+
$ booyah version
|
14
|
+
$ booyah --version
|
15
|
+
$ booyah -v
|
16
|
+
$ booyah v
|
17
|
+
|
18
|
+
If you want to view the episodes of a podcast, run:
|
19
|
+
$ booyah view [podcast]
|
20
|
+
|
21
|
+
If you want to cache (*cough* "download") an episode, run:
|
22
|
+
$ booyah download [podcast]/[episode_name]
|
23
|
+
$ booyah dl [podcast]/[episode_name]
|
24
|
+
|
25
|
+
If you want to play an episode, run:
|
26
|
+
$ booyah play [podcast]/[episode_name]
|
27
|
+
|
28
|
+
If you want to search for podcasts on the remote repository, run:
|
29
|
+
$ booyah search
|
30
|
+
|
31
|
+
for a complete list, or:
|
32
|
+
$ booyah search [podcast]
|
33
|
+
|
34
|
+
for a specific podcast
|
35
|
+
|
36
|
+
To visit the Booyah homepage, run:
|
37
|
+
$ booyah home
|
38
|
+
$ booyah homepage
|
39
|
+
|
40
|
+
If you want to see a help page, run what you did to see this!
|
41
|
+
|
42
|
+
EOS
|
43
|
+
|
44
|
+
class Booyah
|
45
|
+
def self.home
|
46
|
+
exec "open #{BOOYAH_HOMEPAGE}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.dl(argv)
|
50
|
+
if ARGV[1] != nil
|
51
|
+
case ARGV[1] when '--help', '-h'
|
52
|
+
puts BOOYAH_HELP
|
53
|
+
exit 0
|
54
|
+
end
|
55
|
+
require 'open-uri'
|
56
|
+
require 'rubygems'
|
57
|
+
require 'json'
|
58
|
+
path = ARGV[1].split('/')
|
59
|
+
path[0] += '.json'
|
60
|
+
json = BOOYAH_REPO + 'Podcasts/' + path[0]
|
61
|
+
parsed = JSON.parse(open(json).read)
|
62
|
+
url = parsed['url']
|
63
|
+
podcast = JSON.parse(open(url).read)
|
64
|
+
name = podcast['name']
|
65
|
+
episode = podcast['episodes'][path[1]].to_i
|
66
|
+
episodefile = "#{podcast['items'][episode]['name']}.#{podcast['items'][episode]['ext']}"
|
67
|
+
remote = podcast['items'][episode]['download']
|
68
|
+
cache = "#{BOOYAH_DIR}/#{name}"
|
69
|
+
downloading = "Downloading \"#{episodefile}\". . ."
|
70
|
+
finished = "Finished downloading to #{BOOYAH_DIR}/#{name}/#{episodefile}!"
|
71
|
+
if File.directory?(cache)
|
72
|
+
puts "Downloading \"#{episodefile}\". . ."
|
73
|
+
system "curl -s --output #{cache}/#{episodefile} #{remote}"
|
74
|
+
else
|
75
|
+
puts "Creating Cache Directory: #{BOOYAH_DIR}/#{name}"
|
76
|
+
system("mkdir -p #{BOOYAH_DIR}/#{name}")
|
77
|
+
puts downloading
|
78
|
+
system "curl -s --output #{BOOYAH_DIR}/#{name}/#{episodefile} #{remote}"
|
79
|
+
puts finished
|
80
|
+
end
|
81
|
+
else
|
82
|
+
puts BOOYAH_HELP
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.view(argv)
|
87
|
+
if ARGV[1] != nil
|
88
|
+
case ARGV[1] when '--help', '-h'
|
89
|
+
puts BOOYAH_HELP
|
90
|
+
exit 0
|
91
|
+
end
|
92
|
+
query = ARGV[1]
|
93
|
+
else
|
94
|
+
puts BOOYAH_HELP
|
95
|
+
exit 0
|
96
|
+
end
|
97
|
+
require 'rubygems'
|
98
|
+
require 'json'
|
99
|
+
require 'open-uri'
|
100
|
+
podcast = BOOYAH_REPO + "Podcasts/#{query}.json"
|
101
|
+
parse = JSON.parse(open(podcast).read)
|
102
|
+
podcast = parse['url']
|
103
|
+
parse = JSON.parse(open(podcast).read)
|
104
|
+
|
105
|
+
parse['items'].each do |item|
|
106
|
+
puts "#{item['name']} : #{item['description']}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.play(argv)
|
111
|
+
if ARGV[1] != nil
|
112
|
+
case ARGV[1] when '--help', '-h'
|
113
|
+
puts BOOYAH_HELP
|
114
|
+
exit 0
|
115
|
+
end
|
116
|
+
query = ARGV[1]
|
117
|
+
else
|
118
|
+
puts BOOYAH_HELP
|
119
|
+
exit 0
|
120
|
+
end
|
121
|
+
|
122
|
+
path = query.split('/')
|
123
|
+
puts "Playing #{path[1]}. . ."
|
124
|
+
exec "afplay #{BOOYAH_DIR}/#{path[0]}/#{path[1]}"
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.search(argv)
|
128
|
+
if ARGV[1] != nil
|
129
|
+
case ARGV[1] when 'help', '--help', '-h', 'h'
|
130
|
+
puts BOOYAH_HELP
|
131
|
+
exit 0
|
132
|
+
end
|
133
|
+
require 'open-uri'
|
134
|
+
query = ARGV[1]
|
135
|
+
else
|
136
|
+
require 'open-uri'
|
137
|
+
results = Dir["#{BOOYAH_REPO}/Podcasts/*.json"].map{ |f| File.basename f, '.json' }.sort
|
138
|
+
puts results
|
139
|
+
exit 0
|
140
|
+
end
|
141
|
+
|
142
|
+
results = Dir["#{BOOYAH_REPO}/Podcasts/*.json"].map{ |f| File.basename f, '.json' }.sort.grep query
|
143
|
+
enumerate = results.length
|
144
|
+
|
145
|
+
if enumerate == 0
|
146
|
+
puts "WHOOPS! There is no podcast named #{query} in the Booyah repo."
|
147
|
+
exit 0
|
148
|
+
else
|
149
|
+
puts results
|
150
|
+
exit 0
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: booyah
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.9
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- dejay
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-25 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Booyah is a software suite that allows you share JSON-coded podcasts
|
15
|
+
with a massive online community!
|
16
|
+
email: chipsolderer@gmail.com
|
17
|
+
executables:
|
18
|
+
- booyah
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files:
|
21
|
+
- README.md
|
22
|
+
files:
|
23
|
+
- bin/booyah
|
24
|
+
- lib/initialize.rb
|
25
|
+
- Podcasts/booyah.json
|
26
|
+
- README.md
|
27
|
+
homepage: https://github.com/dejay/Booyah
|
28
|
+
licenses: []
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project:
|
47
|
+
rubygems_version: 1.8.24
|
48
|
+
signing_key:
|
49
|
+
specification_version: 3
|
50
|
+
summary: Podcast with JSON FTW
|
51
|
+
test_files: []
|