Skip to content

Commit 4421ed9

Browse files
committed
Merge branch 'refs/heads/npr-changes'
2 parents e64c7df + 855e3ad commit 4421ed9

File tree

8 files changed

+54
-9
lines changed

8 files changed

+54
-9
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PodEngine 2.3 – Podcast Feed Library
1+
# PodEngine 2.4 – Podcast Feed Library
22

33
## Java library for parsing your podcast feeds 🚀
44
* Written in Java 7 🤖
@@ -17,7 +17,7 @@ repositories {
1717
}
1818
1919
dependencies {
20-
compile 'com.icosillion.podengine:podengine:2.3'
20+
compile 'com.icosillion.podengine:podengine:2.4'
2121
}
2222
```
2323

@@ -35,7 +35,7 @@ dependencies {
3535
<dependency>
3636
<groupId>com.icosillion.podengine</groupId>
3737
<artifactId>podengine</artifactId>
38-
<version>2.3</version>
38+
<version>2.4</version>
3939
</dependency>
4040
</dependencies>
4141
```

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ apply plugin: 'java'
66
apply plugin: 'maven-publish'
77

88
group = 'com.icosillion.podengine'
9-
version = '2.3'
9+
version = '2.4'
1010

1111
description = """Simple library to read podcast feeds"""
1212

feed.rss

+25
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,30 @@
7171
The show notes live in this section, but we have nothing else interesting to say.
7272
</content:encoded>
7373
</item>
74+
<item>
75+
<title>Episode 2: Most podcasts have more than one episode</title>
76+
<description>Our hosts realize they need a second episode.</description>
77+
<pubDate>Tue, 28 Oct 2019 13:30:00 GMT</pubDate>
78+
<enclosure url="https://podcast-feed-library.owl.im/audio/episode-1.mp3" length="1234000" type="audio/mp3" />
79+
<link>https://podcast-feed-library.owl.im/episodes/2</link>
80+
<guid>https://podcast-feed-library.owl.im/episodes/2</guid>
81+
<comments>https://podcast-feed-library.owl.im/episodes/2/comments</comments>
82+
<category>Technology</category>
83+
<category>Testing</category>
84+
<source url="http://podcast-feed-library.owl.im/feed.rss">Master Feed</source>
85+
<itunes:author>Icosillion</itunes:author>
86+
<itunes:subtitle>Our hosts realize they need a second episode.</itunes:subtitle>
87+
<itunes:summary>Our hosts realize they need a second episode.</itunes:summary>
88+
<itunes:explicit>no</itunes:explicit>
89+
<itunes:duration>12:34</itunes:duration>
90+
<itunes:block>no</itunes:block>
91+
<itunes:image href="https://podcast-feed-library.owl.im/images/artwork.png" />
92+
<itunes:isClosedCaptioned>no</itunes:isClosedCaptioned>
93+
<itunes:order>2</itunes:order>
94+
<itunes:season>1</itunes:season>
95+
<itunes:episode>2</itunes:episode>
96+
<content:encoded>Our hosts realize they need a second episode.
97+
</content:encoded>
98+
</item>
7499
</channel>
75100
</rss>

src/main/java/com/icosillion/podengine/models/ITunesInfo.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public abstract class ITunesInfo {
1111

1212
public enum ExplicitLevel {
13-
EXPLICIT, CLEAN, UNKNOWN
13+
EXPLICIT, CLEAN, NO, UNKNOWN
1414
}
1515

1616
protected final Element parent;
@@ -92,6 +92,10 @@ public ExplicitLevel getExplicit() {
9292
return this.explicit = ExplicitLevel.EXPLICIT;
9393
}
9494

95+
if ("no".equalsIgnoreCase(explicitText)) {
96+
return this.explicit = ExplicitLevel.NO;
97+
}
98+
9599
if ("clean".equalsIgnoreCase(explicitText)) {
96100
return this.explicit = ExplicitLevel.CLEAN;
97101
}

src/main/java/com/icosillion/podengine/models/ITunesItemInfo.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public class ITunesItemInfo extends ITunesInfo {
77

88
public enum EpisodeType {
9-
FULL, TRAILER, BONUS
9+
FULL, TRAILER, BONUS, UNKNOWN
1010
}
1111

1212
private String duration;
@@ -124,7 +124,7 @@ public EpisodeType getEpisodeType() {
124124

125125
Element episodeTypeElement = this.parent.element(QName.get("episodeType", this.iTunesNamespace));
126126
if (episodeTypeElement == null) {
127-
return this.episodeType = EpisodeType.FULL;
127+
return this.episodeType = EpisodeType.UNKNOWN;
128128
}
129129

130130
String rawEpisodeType = episodeTypeElement.getTextTrim().toLowerCase();
@@ -139,7 +139,7 @@ public EpisodeType getEpisodeType() {
139139
this.episodeType = EpisodeType.FULL;
140140
break;
141141
default:
142-
this.episodeType = EpisodeType.FULL;
142+
this.episodeType = EpisodeType.UNKNOWN;
143143
break;
144144
}
145145

src/main/java/com/icosillion/podengine/models/Podcast.java

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class Podcast {
2222
private String xmlData;
2323
private Document document;
2424
private URL feedURL;
25+
private URL resolvedURL;
2526

2627
private Element rootElement, channelElement;
2728

@@ -54,6 +55,7 @@ public Podcast(URL feed) throws InvalidFeedException, MalformedFeedException {
5455
bomInputStream = new BOMInputStream(is, false);
5556

5657
this.feedURL = feed;
58+
this.resolvedURL = ic.getURL();
5759
this.xmlData = IOUtils.toString(bomInputStream);
5860
this.document = DocumentHelper.parseText(xmlData);
5961
this.rootElement = this.document.getRootElement();
@@ -594,4 +596,8 @@ public String getXMLData() {
594596
public URL getFeedURL() {
595597
return feedURL;
596598
}
599+
600+
public URL getResolvedURL() {
601+
return resolvedURL;
602+
}
597603
}

src/test/java/com/icosillion/podengine/models/EpisodeTest.java

+10
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,15 @@ public void testEpisode() throws MalformedFeedException, MalformedURLException,
6868
assertEquals(1, (int) iTunesInfo.getOrder());
6969
assertEquals(1, (int) iTunesInfo.getSeasonNumber());
7070
assertEquals(1, (int) iTunesInfo.getEpisodeNumber());
71+
72+
}
73+
74+
@Test
75+
public void testEpisodeWithExplicitNo()
76+
{
77+
List<Episode> episodes = podcast.getEpisodes();
78+
Episode episode = episodes.get(1);
79+
ITunesItemInfo iTunesInfo = episode.getITunesInfo();
80+
assertEquals(ITunesInfo.ExplicitLevel.NO, iTunesInfo.getExplicit());
7181
}
7282
}

src/test/java/com/icosillion/podengine/models/PodcastOverviewTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testOverview() throws MalformedFeedException, MalformedURLException,
5757
assertTrue(skipDays.contains("Wednesday"));
5858
assertTrue(skipDays.contains("Friday"));
5959
assertArrayEquals(new String[] { "podcast", "java", "xml", "dom4j", "icosillion", "maven" } , podcast.getKeywords());
60-
assertEquals(1, podcast.getEpisodes().size());
60+
assertEquals(2, podcast.getEpisodes().size());
6161
}
6262

6363
@Test

0 commit comments

Comments
 (0)