Module: Podcastinator
- Defined in:
- lib/podcastinator.rb,
lib/podcastinator/feed.rb,
lib/podcastinator/version.rb,
lib/podcastinator/file_feed.rb,
lib/podcastinator/generator.rb
Defined Under Namespace
Classes: Feed, FileFeed, Generator
Constant Summary
collapse
- VERSION =
"0.0.6"
Class Method Summary
collapse
Class Method Details
.add_channel_yml(options) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/podcastinator.rb', line 56
def self.add_channel_yml(options)
yml_filename = File.join(options[:path], "channel.yml")
return unless File.file? yml_filename
yml_content = File.read(yml_filename)
yml_hash = YAML.load(yml_content)
yml_hash.each do |key, value|
options[key.to_sym] ||= value
end
end
|
.parse_cli_options ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/podcastinator.rb', line 34
def self.parse_cli_options
options = {
:path => Dir.pwd,
}
OptionParser.new do |opts|
opts.banner = "Usage: podcastinator [options] [audio files ...]"
opts.on("-o", "--output [FILENAME]", "Write the XML to the specified file") do |filename|
options[:output] = filename
end
opts.on("-r", "--root [PATH]", "The root path in the URL to access the audio files") do |path|
options[:path] = path
end
end.parse!
add_channel_yml(options)
options
end
|
.start(options = self.parse_cli_options) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/podcastinator.rb', line 21
def self.start(options = self.parse_cli_options)
feed = Podcastinator::FileFeed.new(options)
xml = Podcastinator::Generator.new(feed).to_xml
if options[:output]
File.open(options[:output], "w") do |f|
f.puts(xml)
end
else
puts xml
end
end
|