1
0
mirror of https://github.com/stonega/tsacdop synced 2025-01-08 13:31:19 +01:00
tsacdop-podcast-app-android/lib/util/ompl_build.dart
stonegate 57bf41114b Export ompli file
Storage management
Syncing setting
2020-03-20 03:58:30 +08:00

29 lines
904 B
Dart

import 'package:tsacdop/class/podcastlocal.dart';
import 'package:xml/xml.dart' as xml;
omplBuilder(List<PodcastLocal> podcasts) {
var builder = xml.XmlBuilder();
builder.processing('xml', 'version="1.0"');
builder.element('ompl', nest: () {
builder.attribute('version', '1.0');
builder.element('head', nest: () {
builder.element('title', nest: 'Tsacdop Feeds');
});
builder.element('body', nest: () {
builder.element('outline', nest: () {
builder.attribute('text', 'feed');
podcasts.forEach((e) => builder.element(
'outline',
nest: () {
builder.attribute('type', 'rss');
builder.attribute('text', '${e.title}');
builder.attribute('xmlUrl', '${e.rssUrl}');
},
isSelfClosing: true,
));
});
});
});
return builder.build();
}