1
0
mirror of https://github.com/stonega/tsacdop synced 2025-01-10 06:17:45 +01:00
tsacdop-podcast-app-android/lib/webfeed/domain/atom_item.dart
stonegate 1021f2eea4 modified: lib/class/audiostate.dart
new file:   lib/class/fireside_data.dart
	modified:   lib/episodes/episodedetail.dart
	modified:   lib/home/appbar/addpodcast.dart
	modified:   lib/home/audioplayer.dart
	modified:   lib/local_storage/key_value_storage.dart
	modified:   lib/local_storage/sqflite_localpodcast.dart
	modified:   lib/podcasts/podcastdetail.dart
	modified:   lib/webfeed/domain/atom_feed.dart
	modified:   lib/webfeed/domain/atom_item.dart
	modified:   lib/webfeed/domain/atom_person.dart
	modified:   lib/webfeed/domain/atom_source.dart
	modified:   lib/webfeed/domain/media/community.dart
	modified:   lib/webfeed/domain/media/embed.dart
	modified:   lib/webfeed/domain/media/group.dart
	modified:   lib/webfeed/domain/media/media.dart
	modified:   lib/webfeed/domain/media/scene.dart
	modified:   pubspec.lock
	modified:   pubspec.yaml
2020-02-26 17:54:59 +08:00

67 lines
2.0 KiB
Dart

import 'package:tsacdop/webfeed/domain/atom_category.dart';
import 'package:tsacdop/webfeed/domain/atom_link.dart';
import 'package:tsacdop/webfeed/domain/atom_person.dart';
import 'package:tsacdop/webfeed/domain/atom_source.dart';
import 'package:tsacdop/webfeed/domain/media/media.dart';
import 'package:tsacdop/webfeed/util/helpers.dart';
import 'package:xml/xml.dart';
class AtomItem {
final String id;
final String title;
final String updated;
final List<AtomPerson> authors;
final List<AtomLink> links;
final List<AtomCategory> categories;
final List<AtomPerson> contributors;
final AtomSource source;
final String published;
final String content;
final String summary;
final String rights;
final Media media;
AtomItem({
this.id,
this.title,
this.updated,
this.authors,
this.links,
this.categories,
this.contributors,
this.source,
this.published,
this.content,
this.summary,
this.rights,
this.media,
});
factory AtomItem.parse(XmlElement element) {
return AtomItem(
id: findElementOrNull(element, "id")?.text,
title: findElementOrNull(element, "title")?.text,
updated: findElementOrNull(element, "updated")?.text,
authors: element.findElements("author").map((element) {
return AtomPerson.parse(element);
}).toList(),
links: element.findElements("link").map((element) {
return AtomLink.parse(element);
}).toList(),
categories: element.findElements("category").map((element) {
return AtomCategory.parse(element);
}).toList(),
contributors: element.findElements("contributor").map((element) {
return AtomPerson.parse(element);
}).toList(),
source: AtomSource.parse(findElementOrNull(element, "source")),
published: findElementOrNull(element, "published")?.text,
content: findElementOrNull(element, "content")?.text,
summary: findElementOrNull(element, "summary")?.text,
rights: findElementOrNull(element, "rights")?.text,
media: Media.parse(element),
);
}
}