feedjira-podcast 0.9.14 → 0.10.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/feedjira/parser/podcast.rb +27 -7
- data/lib/feedjira/podcast.rb +14 -8
- data/lib/feedjira/podcast/channel/apple.rb +15 -13
- data/lib/feedjira/podcast/channel/feedburner.rb +3 -1
- data/lib/feedjira/podcast/channel/item.rb +16 -0
- data/lib/feedjira/podcast/item/apple.rb +14 -12
- data/lib/feedjira/podcast/item/content.rb +3 -1
- data/lib/feedjira/podcast/item/dublin.rb +3 -1
- data/lib/feedjira/podcast/rss/channel.rb +20 -0
- data/lib/feedjira/podcast/rss/required.rb +14 -0
- data/lib/feedjira/podcast/version.rb +1 -1
- data/lib/feedjira/podcast/xml/required.rb +11 -0
- data/lib/feedjira/podcast/xml/rss.rb +12 -0
- metadata +8 -4
- data/lib/feedjira/parser/podcast_item.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac3a1196fabb335ea51d62168ec80797768ded8e
|
4
|
+
data.tar.gz: cd06b8dc8e1b5a06752980de182a65affb400c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab3d078680dad24ebb13cf6922d99ad5fd2a1d9bde94edda4bd49afb9809a774665ee2459e2cc8903731eccc80e674364380f7234b0652cef09220e79a08cdc1
|
7
|
+
data.tar.gz: 3acc7dbabdfff90416ca56aa1ec7e880541598f77223fc543e31972230a0c89a94eb48c53b4bb70cf308b83a83a7e3f57159a7ca813b4025833709ee06230900
|
data/README.md
CHANGED
@@ -46,7 +46,7 @@ In nearly all cases the value types of podcast feed data is predictable. As such
|
|
46
46
|
|
47
47
|
Date values are parsed as `Time` objects, number values become `Float` objects, hrefs, URIs and URLs are parsed using [Addressable](https://github.com/sporkmonger/addressable), and boolean values will return `true` or `false`.
|
48
48
|
|
49
|
-
In the
|
49
|
+
In 2016 the definition of the `<itunes:explicit>` tag changed, but it still gets expanded into two properties when parsed: `explicit?` and `clean?`. Unlike previously, where both being false would indicate `"no"` (rather than `"yes"` or `"clean"`), now both properties being false means the tag is not included (or it is being use incorrectly). When present, and given a proper value, `explicit?` and `clean?` will be accurate according to the Podcasts Connect guidelines. If you choose to, you can refer only to `explicit?` to test the value, but when it is false there is no guarantee `<itunes:explicit>` was actually set to `clean`, `no`, or `false`; you would have to also check `clean?` to be sure.
|
50
50
|
|
51
51
|
The spec for the item `<guid>` indicates that the default value if no value is given for the `isPermaLink` attribute is `true`. It also states that when `isPermaLink` is true, the value of `<guid>` represents a URI (and that the client can choose to treat it that way or not). As such, whenever a `<guid>` is acting as a `permaLink`, whether implicitly or explicitly, the `guid` value will return an `Addressable::URI`. Only if `isPermaLink` has a value of `"false"` with `guid` return a string.
|
52
52
|
|
@@ -4,19 +4,39 @@ module Feedjira
|
|
4
4
|
include SAXMachine
|
5
5
|
include FeedUtilities
|
6
6
|
|
7
|
-
include ::Feedjira::Podcast::
|
8
|
-
include ::Feedjira::Podcast::Channel::Optional
|
9
|
-
include ::Feedjira::Podcast::Channel::Atom
|
10
|
-
include ::Feedjira::Podcast::Channel::Feedburner
|
11
|
-
include ::Feedjira::Podcast::Channel::Apple
|
7
|
+
include ::Feedjira::Podcast::XML::Required
|
12
8
|
|
13
|
-
|
9
|
+
# def parse(xml_input, on_error = nil, on_warning = nil)
|
10
|
+
# # TODO This is fragile
|
11
|
+
# @namespaces = {}
|
12
|
+
# Nokogiri::XML(xml_input).xpath("//namespace::*").each do |ns|
|
13
|
+
# @namespaces[ns.href] = ns.prefix
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# super xml_input
|
17
|
+
# end
|
14
18
|
|
15
19
|
def self.able_to_parse?(xml)
|
16
|
-
# TODO Look several
|
20
|
+
# TODO Look for any of several podcast-specific matches, especially
|
17
21
|
# to cover feeds that may not have any items yet
|
18
22
|
(/\<rss|\<rdf/ =~ xml) && (/enclosure/ =~ xml)
|
19
23
|
end
|
24
|
+
|
25
|
+
def method_missing(method_sym, *arguments, &block)
|
26
|
+
if rss && rss.channel && rss.channel.respond_to?(method_sym)
|
27
|
+
rss.channel.send(method_sym, *arguments, &block)
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.respond_to_missing?(method_sym, include_private = false)
|
34
|
+
if rss && rss.channel && rss.channel.respond_to?(method_sym)
|
35
|
+
true
|
36
|
+
else
|
37
|
+
super
|
38
|
+
end
|
39
|
+
end
|
20
40
|
end
|
21
41
|
end
|
22
42
|
end
|
data/lib/feedjira/podcast.rb
CHANGED
@@ -3,6 +3,15 @@ require "addressable/uri"
|
|
3
3
|
|
4
4
|
require "feedjira/podcast/version"
|
5
5
|
|
6
|
+
require "feedjira/podcast/item/guid"
|
7
|
+
require "feedjira/podcast/item/source"
|
8
|
+
|
9
|
+
require "feedjira/podcast/item/required"
|
10
|
+
require "feedjira/podcast/item/optional"
|
11
|
+
require "feedjira/podcast/item/apple"
|
12
|
+
require "feedjira/podcast/item/dublin"
|
13
|
+
require "feedjira/podcast/item/content"
|
14
|
+
|
6
15
|
require "feedjira/podcast/channel/cloud"
|
7
16
|
require "feedjira/podcast/channel/image"
|
8
17
|
require "feedjira/podcast/channel/skip_hours"
|
@@ -18,17 +27,14 @@ require "feedjira/podcast/channel/atom"
|
|
18
27
|
require "feedjira/podcast/channel/feedburner"
|
19
28
|
require "feedjira/podcast/channel/apple"
|
20
29
|
require "feedjira/podcast/channel/syndication"
|
30
|
+
require "feedjira/podcast/channel/item"
|
21
31
|
|
22
|
-
require "feedjira/podcast/
|
23
|
-
require "feedjira/podcast/
|
32
|
+
require "feedjira/podcast/rss/channel"
|
33
|
+
require "feedjira/podcast/rss/required"
|
24
34
|
|
25
|
-
require "feedjira/podcast/
|
26
|
-
require "feedjira/podcast/
|
27
|
-
require "feedjira/podcast/item/apple"
|
28
|
-
require "feedjira/podcast/item/dublin"
|
29
|
-
require "feedjira/podcast/item/content"
|
35
|
+
require "feedjira/podcast/xml/rss"
|
36
|
+
require "feedjira/podcast/xml/required"
|
30
37
|
|
31
|
-
require "feedjira/parser/podcast_item"
|
32
38
|
require "feedjira/parser/podcast"
|
33
39
|
|
34
40
|
Feedjira::Feed.add_feed_class(Feedjira::Parser::Podcast)
|
@@ -52,11 +52,11 @@ module Feedjira
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def itunes_explicit
|
55
|
-
@itunes_explicit ||=
|
55
|
+
@itunes_explicit ||= ["yes", "explicit", "true"].include?(_itunes_explicit)
|
56
56
|
end
|
57
57
|
|
58
58
|
def itunes_clean
|
59
|
-
@itunes_clean ||=
|
59
|
+
@itunes_clean ||= ["no", "clean", "false"].include?(_itunes_explicit)
|
60
60
|
end
|
61
61
|
|
62
62
|
def itunes_owner
|
@@ -70,30 +70,32 @@ module Feedjira
|
|
70
70
|
def self.included(base)
|
71
71
|
base.include(InstanceMethods)
|
72
72
|
|
73
|
-
|
73
|
+
itunes_xml_ns = "itunes"
|
74
74
|
|
75
|
-
base.element :"
|
75
|
+
base.element :"#{itunes_xml_ns}:author", as: :itunes_author
|
76
76
|
|
77
|
-
base.
|
77
|
+
base.element :"#{itunes_xml_ns}:block", as: :_itunes_block
|
78
78
|
|
79
|
-
base.
|
79
|
+
base.elements :"#{itunes_xml_ns}:category", as: :_itunes_categories, class: AppleCategory
|
80
|
+
|
81
|
+
base.element :"#{itunes_xml_ns}:image", as: :itunes_image_href, value: :href do |href|
|
80
82
|
Addressable::URI.parse(href.strip)
|
81
83
|
end
|
82
84
|
|
83
|
-
base.element :"
|
84
|
-
base.element :"
|
85
|
+
base.element :"#{itunes_xml_ns}:explicit", as: :_itunes_explicit
|
86
|
+
base.element :"#{itunes_xml_ns}:complete", as: :_itunes_complete
|
85
87
|
|
86
|
-
base.element :"
|
88
|
+
base.element :"#{itunes_xml_ns}:new_feed_url", as: :itunes_new_feed_url do |url|
|
87
89
|
Addressable::URI.parse(url.strip)
|
88
90
|
end
|
89
91
|
|
90
|
-
base.element :"
|
91
|
-
base.element :"
|
92
|
-
base.element :"
|
92
|
+
base.element :"#{itunes_xml_ns}:owner", as: :_itunes_owner, class: AppleOwner
|
93
|
+
base.element :"#{itunes_xml_ns}:subtitle", as: :itunes_subtitle
|
94
|
+
base.element :"#{itunes_xml_ns}:summary", as: :itunes_summary
|
93
95
|
|
94
96
|
# Legacy support
|
95
97
|
|
96
|
-
base.element :"
|
98
|
+
base.element :"#{itunes_xml_ns}:keywords", as: :itunes_keywords, default: "" do |keywords|
|
97
99
|
keywords.split(",").map(&:strip).select { |k| !k.empty? }
|
98
100
|
end
|
99
101
|
end
|
@@ -12,7 +12,9 @@ module Feedjira
|
|
12
12
|
def self.included(base)
|
13
13
|
base.include(InstanceMethods)
|
14
14
|
|
15
|
-
|
15
|
+
feedburner_xml_ns = "feedburner"
|
16
|
+
|
17
|
+
base.element :"#{feedburner_xml_ns}:info", as: :feedburner_info_uri, value: :uri do |uri|
|
16
18
|
Addressable::URI.parse(uri.strip)
|
17
19
|
end
|
18
20
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Feedjira
|
2
|
+
module Podcast
|
3
|
+
module Channel
|
4
|
+
class Item
|
5
|
+
include SAXMachine
|
6
|
+
include FeedUtilities
|
7
|
+
|
8
|
+
include ::Feedjira::Podcast::Item::Required
|
9
|
+
include ::Feedjira::Podcast::Item::Optional
|
10
|
+
include ::Feedjira::Podcast::Item::Apple
|
11
|
+
include ::Feedjira::Podcast::Item::Dublin
|
12
|
+
include ::Feedjira::Podcast::Item::Content
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -46,42 +46,44 @@ module Feedjira
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def itunes_explicit
|
49
|
-
@itunes_explicit ||=
|
49
|
+
@itunes_explicit ||= ["yes", "explicit", "true"].include?(_itunes_explicit)
|
50
50
|
end
|
51
51
|
|
52
52
|
def itunes_clean
|
53
|
-
@itunes_clean ||=
|
53
|
+
@itunes_clean ||= ["no", "clean", "false"].include?(_itunes_explicit)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.included(base)
|
58
58
|
base.include(InstanceMethods)
|
59
59
|
|
60
|
-
|
61
|
-
base.element :"itunes:block", as: :_itunes_block
|
60
|
+
itunes_xml_ns = "itunes"
|
62
61
|
|
63
|
-
base.element :"
|
62
|
+
base.element :"#{itunes_xml_ns}:author", as: :itunes_author
|
63
|
+
base.element :"#{itunes_xml_ns}:block", as: :_itunes_block
|
64
|
+
|
65
|
+
base.element :"#{itunes_xml_ns}:image", as: :itunes_image_href, value: :href do |href|
|
64
66
|
Addressable::URI.parse(href.strip)
|
65
67
|
end
|
66
68
|
|
67
|
-
base.element :"
|
69
|
+
base.element :"#{itunes_xml_ns}:duration", as: :itunes_duration do |d|
|
68
70
|
["0:0:0:#{d}".split(":")[-3, 3].map(&:to_i)].inject(0) do |_m, i|
|
69
71
|
(i[0] * 3600) + (i[1] * 60) + i[2]
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
73
|
-
base.element :"
|
75
|
+
base.element :"#{itunes_xml_ns}:explicit", as: :_itunes_explicit
|
74
76
|
|
75
|
-
base.element :"
|
77
|
+
base.element :"#{itunes_xml_ns}:isClosedCaptioned", as: :_itunes_is_closed_captioned
|
76
78
|
|
77
|
-
base.element :"
|
79
|
+
base.element :"#{itunes_xml_ns}:order", as: :itunes_order, &:to_f
|
78
80
|
|
79
|
-
base.element :"
|
80
|
-
base.element :"
|
81
|
+
base.element :"#{itunes_xml_ns}:subtitle", as: :itunes_subtitle
|
82
|
+
base.element :"#{itunes_xml_ns}:summary", as: :itunes_summary
|
81
83
|
|
82
84
|
# Legacy support
|
83
85
|
|
84
|
-
base.element :"
|
86
|
+
base.element :"#{itunes_xml_ns}:keywords", as: :itunes_keywords do |keywords|
|
85
87
|
keywords.split(",").map(&:strip).select { |k| !k.empty? }
|
86
88
|
end
|
87
89
|
end
|
@@ -11,7 +11,9 @@ module Feedjira
|
|
11
11
|
def self.included(base)
|
12
12
|
base.include(InstanceMethods)
|
13
13
|
|
14
|
-
|
14
|
+
content_xml_ns = "content"
|
15
|
+
|
16
|
+
base.element :"#{content_xml_ns}:encoded", as: :content_encoded
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Feedjira
|
2
|
+
module Podcast
|
3
|
+
module RSS
|
4
|
+
class Channel
|
5
|
+
include SAXMachine
|
6
|
+
include FeedUtilities
|
7
|
+
|
8
|
+
include ::Feedjira::Podcast::Channel::Required
|
9
|
+
include ::Feedjira::Podcast::Channel::Optional
|
10
|
+
include ::Feedjira::Podcast::Channel::Atom
|
11
|
+
include ::Feedjira::Podcast::Channel::Feedburner
|
12
|
+
include ::Feedjira::Podcast::Channel::Apple
|
13
|
+
|
14
|
+
elements :item, as: :items, class: ::Feedjira::Podcast::Channel::Item
|
15
|
+
|
16
|
+
ancestor :rss
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedjira-podcast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Kalafarski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,7 +128,6 @@ files:
|
|
128
128
|
- bin/setup
|
129
129
|
- feedjira-podcast.gemspec
|
130
130
|
- lib/feedjira/parser/podcast.rb
|
131
|
-
- lib/feedjira/parser/podcast_item.rb
|
132
131
|
- lib/feedjira/podcast.rb
|
133
132
|
- lib/feedjira/podcast/channel/apple.rb
|
134
133
|
- lib/feedjira/podcast/channel/apple_category.rb
|
@@ -138,6 +137,7 @@ files:
|
|
138
137
|
- lib/feedjira/podcast/channel/cloud.rb
|
139
138
|
- lib/feedjira/podcast/channel/feedburner.rb
|
140
139
|
- lib/feedjira/podcast/channel/image.rb
|
140
|
+
- lib/feedjira/podcast/channel/item.rb
|
141
141
|
- lib/feedjira/podcast/channel/optional.rb
|
142
142
|
- lib/feedjira/podcast/channel/required.rb
|
143
143
|
- lib/feedjira/podcast/channel/skip_days.rb
|
@@ -152,8 +152,12 @@ files:
|
|
152
152
|
- lib/feedjira/podcast/item/optional.rb
|
153
153
|
- lib/feedjira/podcast/item/required.rb
|
154
154
|
- lib/feedjira/podcast/item/source.rb
|
155
|
+
- lib/feedjira/podcast/rss/channel.rb
|
156
|
+
- lib/feedjira/podcast/rss/required.rb
|
155
157
|
- lib/feedjira/podcast/version.rb
|
156
158
|
- lib/feedjira/podcast/warning.rb
|
159
|
+
- lib/feedjira/podcast/xml/required.rb
|
160
|
+
- lib/feedjira/podcast/xml/rss.rb
|
157
161
|
homepage: https://github.com/scour/feedjira-podcast
|
158
162
|
licenses:
|
159
163
|
- MIT
|
@@ -175,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
179
|
version: '0'
|
176
180
|
requirements: []
|
177
181
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.6.3
|
179
183
|
signing_key:
|
180
184
|
specification_version: 4
|
181
185
|
summary: Podcast feed parsing with Feedjira
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Feedjira
|
2
|
-
module Parser
|
3
|
-
class PodcastItem
|
4
|
-
include SAXMachine
|
5
|
-
include FeedUtilities
|
6
|
-
|
7
|
-
include ::Feedjira::Podcast::Item::Required
|
8
|
-
include ::Feedjira::Podcast::Item::Optional
|
9
|
-
include ::Feedjira::Podcast::Item::Apple
|
10
|
-
include ::Feedjira::Podcast::Item::Dublin
|
11
|
-
include ::Feedjira::Podcast::Item::Content
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|