Merge branch 'master' of https://github.com/rometools/rome-modules
This commit is contained in:
commit
bb49c32dab
6 changed files with 71 additions and 1 deletions
|
@ -66,4 +66,11 @@ public interface EntryInformation extends ITunes {
|
|||
*/
|
||||
public void setDuration(Duration duration);
|
||||
|
||||
public boolean getClosedCaptioned();
|
||||
|
||||
public void setClosedCaptioned(boolean closedCaptioned);
|
||||
|
||||
public Integer getOrder();
|
||||
|
||||
public void setOrder(Integer order);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,8 @@ public class EntryInformationImpl extends AbstractITunesObject implements EntryI
|
|||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Duration duration;
|
||||
private boolean closedCaptioned;
|
||||
private Integer order;
|
||||
|
||||
/**
|
||||
* Creates a new instance of EntryInformationImpl
|
||||
|
@ -82,6 +84,26 @@ public class EntryInformationImpl extends AbstractITunesObject implements EntryI
|
|||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getClosedCaptioned() {
|
||||
return closedCaptioned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClosedCaptioned(boolean closedCaptioned) {
|
||||
this.closedCaptioned = closedCaptioned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrder(Integer order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by the ROME module API
|
||||
*
|
||||
|
@ -105,6 +127,8 @@ public class EntryInformationImpl extends AbstractITunesObject implements EntryI
|
|||
|
||||
setSubtitle(info.getSubtitle());
|
||||
setSummary(info.getSummary());
|
||||
setClosedCaptioned(info.getClosedCaptioned());
|
||||
setOrder(info.getOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,8 +147,12 @@ public class EntryInformationImpl extends AbstractITunesObject implements EntryI
|
|||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("[");
|
||||
sb.append(" Duration: ");
|
||||
sb.append(" duration: ");
|
||||
sb.append(getDuration());
|
||||
sb.append(" closedCaptioned: ");
|
||||
sb.append(getClosedCaptioned());
|
||||
sb.append(" order: ");
|
||||
sb.append(getOrder());
|
||||
sb.append("]");
|
||||
sb.append(super.toString());
|
||||
|
||||
|
|
|
@ -124,6 +124,12 @@ public class ITunesGenerator implements ModuleGenerator {
|
|||
if (info.getDuration() != null) {
|
||||
element.addContent(generateSimpleElement("duration", info.getDuration().toString()));
|
||||
}
|
||||
if (info.getClosedCaptioned()) {
|
||||
element.addContent(generateSimpleElement("isClosedCaptioned", "yes"));
|
||||
}
|
||||
if (info.getOrder() != null) {
|
||||
element.addContent(generateSimpleElement("order", info.getOrder().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (itunes.getAuthor() != null) {
|
||||
|
|
|
@ -151,6 +151,19 @@ public class ITunesParser implements ModuleParser {
|
|||
final Duration dur = new Duration(duration.getValue().trim());
|
||||
entryInfo.setDuration(dur);
|
||||
}
|
||||
|
||||
final Element closedCaptioned = element.getChild("isClosedCaptioned", ns);
|
||||
|
||||
if (closedCaptioned != null && closedCaptioned.getValue() != null && closedCaptioned.getValue().trim().equalsIgnoreCase("yes")) {
|
||||
entryInfo.setClosedCaptioned(true);
|
||||
}
|
||||
|
||||
final Element order = element.getChild("order", ns);
|
||||
|
||||
if (order != null && order.getValue() != null) {
|
||||
final Integer o = Integer.valueOf(order.getValue().trim());
|
||||
entryInfo.setOrder(o);
|
||||
}
|
||||
}
|
||||
if (module != null) {
|
||||
// All these are common to both Channel and Item
|
||||
|
|
|
@ -103,4 +103,18 @@ public class ITunesParserTest extends AbstractTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of parse method, of class com.rometools.modules.itunes.io.ITunesParser.
|
||||
*/
|
||||
public void testParseItem() throws Exception {
|
||||
File feed = new File(getTestFile("xml/leshow.xml"));
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL()));
|
||||
|
||||
SyndEntry entry = syndfeed.getEntries().get(0);
|
||||
|
||||
EntryInformationImpl entryInfo = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);
|
||||
assertEquals(true, entryInfo.getClosedCaptioned());
|
||||
assertEquals(Integer.valueOf(2), entryInfo.getOrder());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@
|
|||
<itunes:duration>46:34</itunes:duration>
|
||||
|
||||
<itunes:keywords></itunes:keywords>
|
||||
<itunes:isClosedCaptioned>yes</itunes:isClosedCaptioned>
|
||||
<itunes:order>2</itunes:order>
|
||||
</item>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue