1
0
mirror of https://github.com/stonega/tsacdop synced 2025-01-10 14:23:08 +01:00
tsacdop-podcast-app-android/lib/webfeed/domain/media/group.dart
2020-02-09 20:29:09 +08:00

41 lines
1.0 KiB
Dart

import 'package:webfeed/domain/media/category.dart';
import 'package:webfeed/domain/media/content.dart';
import 'package:webfeed/domain/media/credit.dart';
import 'package:webfeed/domain/media/rating.dart';
import 'package:webfeed/util/helpers.dart';
import 'package:xml/xml.dart';
class Group {
final List<Content> contents;
final List<Credit> credits;
final Category category;
final Rating rating;
Group({
this.contents,
this.credits,
this.category,
this.rating,
});
factory Group.parse(XmlElement element) {
if (element == null) {
return null;
}
return new Group(
contents: element.findElements("media:content").map((e) {
return new Content.parse(e);
}).toList(),
credits: element.findElements("media:credit").map((e) {
return new Credit.parse(e);
}).toList(),
category: new Category.parse(
findElementOrNull(element, "media:category"),
),
rating: new Rating.parse(
findElementOrNull(element, "media:rating"),
),
);
}
}