woody 0.1.1 → 0.2.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.
@@ -7,6 +7,10 @@ module Woody
7
7
  def self.compile(options = [])
8
8
  puts "Compiling..."
9
9
  meta = YAML.load_file("content/metadata.yml")
10
+
11
+ # instantiate the metadata hash so shit doesn't explode in our faces
12
+ meta = Hash.new if meta.empty?
13
+
10
14
 
11
15
  episodes = Array.new
12
16
  filesfound = Array.new
@@ -26,8 +30,9 @@ module Woody
26
30
  end
27
31
  end
28
32
 
33
+
29
34
  # Check for files in meta but not found
30
- unless meta == false
35
+ unless meta.empty?
31
36
  meta.each do |file|
32
37
  next if filesfound.include? file[0]
33
38
  puts "Warning: found metadata for file #{file[0]}, but file itself is missing. Will not be published."
@@ -86,7 +91,7 @@ module Woody
86
91
 
87
92
 
88
93
 
89
- # Update General RSS
94
+ # TODO: Update General RSS
90
95
 
91
96
 
92
97
  # Purge left over files
@@ -124,9 +129,10 @@ module Woody
124
129
  m['subtitle'] = ask "Subtitle: "
125
130
  m['synopsis'] = ask "Synopsis:"
126
131
  m['tags'] = ask "Tags: ", Array
127
-
132
+ m['explicit'] = agree "Explicit content?: "
133
+
128
134
  meta[filename] = m
129
- episodes << Episode.new(filename, m['title'], Date.parse(m['date'].to_s), m['synopsis'], m['subtitle'], m['tags'])
135
+ episodes << Episode.new(filename, m['title'], Date.parse(m['date'].to_s), m['synopsis'], m['subtitle'], m['tags'], m['explicit'])
130
136
  filesfound << filename
131
137
 
132
138
  write_meta meta
data/lib/woody/episode.rb CHANGED
@@ -6,7 +6,7 @@ module Woody
6
6
  # @param [Hash] meta is the relevant part of metadata.yml
7
7
  # @return [Episode] the new Episode object
8
8
  def self.new_from_meta(filename, meta)
9
- return Episode.new(filename, meta['title'], Date.parse(meta['date'].to_s), meta['synopsis'], meta['subtitle'], meta['tags'])
9
+ return Episode.new(filename, meta['title'], Date.parse(meta['date'].to_s), meta['synopsis'], meta['subtitle'], meta['tags'], meta['explicit'])
10
10
  end
11
11
 
12
12
  # Creates a new Episode object
@@ -17,17 +17,18 @@ module Woody
17
17
  # @param [String] subtitle specifies the episode's subtitle
18
18
  # @param [Array] tags specifies the episode's tags - each element is a String
19
19
  # @return [Episode] the new Episode object
20
- def initialize(filename, title, date, synopsis, subtitle = nil, tags = [])
20
+ def initialize(filename, title, date, synopsis, subtitle = nil, tags = [], explicit = false)
21
21
  @filename = filename
22
22
  @title = title
23
23
  @date = date
24
24
  @synopsis = synopsis
25
25
  @subtitle = subtitle
26
26
  @tags = tags
27
+ @explicit = explicit
27
28
  @compiledname = @filename.gsub(/[^0-9A-Za-z .]/, '').gsub(' ', '_')
28
29
  end
29
30
 
30
- attr_accessor :filename, :title, :date, :synopsis, :tags, :subtitle, :compiledname
31
+ attr_accessor :filename, :title, :date, :synopsis, :tags, :subtitle, :explicit, :compiledname
31
32
 
32
33
  # @return the episode's page URL where possible, otherwise false
33
34
  def url
@@ -62,7 +63,12 @@ module Woody
62
63
  def size
63
64
  File.size "content/#{filename}"
64
65
  end
65
-
66
+
67
+ # @return [String] 'yes' if explicit content, otherwise n'o'
68
+ def explicit_string
69
+ @explicit ? 'yes' : 'no'
70
+ end
71
+
66
72
  # TODO: fix this!
67
73
  # @return [String] the duration of the media file, formatted as minutes:seconds
68
74
  def duration
data/lib/woody/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Woody
2
2
  # Specifies Woody gem version
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
data/templates/itunes.xml CHANGED
@@ -8,6 +8,7 @@
8
8
  <itunes:subtitle><%= config['subtitle'] %></itunes:subtitle>
9
9
  <itunes:author><%= config['author'] %></itunes:author>
10
10
  <itunes:summary><%= config['itunes']['summary'] %></itunes:summary>
11
+ <itunes:explicit><%= config['itunes']['explicit'] %></itunes:explicit>
11
12
  <description><%= config['itunes']['summary'] %></description>
12
13
 
13
14
  <itunes:owner>
@@ -28,6 +29,7 @@
28
29
  <pubDate><%= episode.date.rfc2822 %></pubDate>
29
30
  <itunes:duration><%= episode.duration %></itunes:duration>
30
31
  <itunes:keywords><%= episode.keywords %></itunes:keywords>
32
+ <itunes:explicit><%= episode.explicit_string %></itunes:explicit>
31
33
  <guid><%= episode.url %></guid>
32
34
  </item>
33
35
  <% end %>
@@ -17,6 +17,7 @@ itunes:
17
17
  email: owner@example.com
18
18
  # Category MUST be one of the ones listed here http://www.apple.com/itunes/podcasts/specs.html#categories
19
19
  category: Comedy
20
+ explicit: "no" # yes/no/clean
20
21
 
21
22
  s3:
22
23
  # Set the relevant s3 endpoint here. For eu-west-1 (Ireland), use this default.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woody
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -145,4 +145,3 @@ signing_key:
145
145
  specification_version: 3
146
146
  summary: Podcast Static Site Generator
147
147
  test_files: []
148
- has_rdoc: