blob: cd7fef5098497f01eb0dd368e2dc565891fcd612 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package de.danoeh.antennapod.syndication.namespace;
import org.xml.sax.Attributes;
import de.danoeh.antennapod.feed.FeedImage;
import de.danoeh.antennapod.syndication.handler.HandlerState;
public class NSITunes extends Namespace{
public static final String NSTAG = "itunes";
public static final String NSURI = "http://www.itunes.com/dtds/podcast-1.0.dtd";
private static final String IMAGE = "image";
private static final String IMAGE_TITLE = "image";
private static final String IMAGE_HREF = "href";
private static final String AUTHOR = "author";
@Override
public SyndElement handleElementStart(String localName, HandlerState state,
Attributes attributes) {
if (localName.equals(IMAGE) && state.getFeed().getImage() == null) {
FeedImage image = new FeedImage();
image.setTitle(IMAGE_TITLE);
image.setDownload_url(attributes.getValue(IMAGE_HREF));
state.getFeed().setImage(image);
}
return new SyndElement(localName, this);
}
@Override
public void handleElementEnd(String localName, HandlerState state) {
if (localName.equals(AUTHOR)) {
state.getFeed().setAuthor(state.getContentBuf().toString());
}
}
}
|