Skip to content

Commit 8b58b3d

Browse files
authored
Merge pull request #3 from michael-yarzebinski/feature/2_Thumbnail_Media_Group
Add Thumbnail to Media Group
2 parents a97b9e2 + a8d3c34 commit 8b58b3d

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
# 1.0.10
4+
5+
* Added Thumbnail as a Media Group property
6+
37
# 1.0.9
48

59
* Correct README.md

lib/domain/media/group.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ import 'package:rss_dart/domain/media/category.dart';
22
import 'package:rss_dart/domain/media/content.dart';
33
import 'package:rss_dart/domain/media/credit.dart';
44
import 'package:rss_dart/domain/media/rating.dart';
5+
import 'package:rss_dart/domain/media/thumbnail.dart';
56
import 'package:rss_dart/util/helpers.dart';
67
import 'package:xml/xml.dart';
78

89
class Group {
910
final List<Content> contents;
1011
final List<Credit> credits;
12+
final List<Thumbnail> thumbnails;
1113
final Category? category;
1214
final Rating? rating;
1315

1416
const Group({
1517
this.contents = const <Content>[],
1618
this.credits = const <Credit>[],
19+
this.thumbnails = const <Thumbnail>[],
1720
this.category,
1821
this.rating,
1922
});
@@ -31,6 +34,10 @@ class Group {
3134
.findElements('media:credit')
3235
.map((e) => Credit.parse(e))
3336
.toList(),
37+
thumbnails: element
38+
.findElements('media:thumbnail')
39+
.map((e) => Thumbnail.parse(e))
40+
.toList(),
3441
category: Category.parse(findElementOrNull(element, 'media:category')),
3542
rating: Rating.parse(findElementOrNull(element, 'media:rating')),
3643
);

pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: rss_dart
2-
version: 1.0.9
2+
version: 1.0.10
33
description: rss_dart is a rss parser for RSS1.0/RSS2.0/Atom. This library is forked from webfeed https://github.com/witochandra/webfeed and dart_rss.
44
homepage: https://github.com/ubuntu-flutter-community/rss.dart
55

@@ -13,4 +13,3 @@ dependencies:
1313
dev_dependencies:
1414
test: ^1.16.4
1515
pedantic: ^1.10.0
16-

test/atom_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ void main() {
111111
expect(item.media!.group!.category!.value, 'music/artist name/album/song');
112112
expect(item.media!.group!.rating!.value, 'nonadult');
113113

114+
final mediaGroupThumbnail = item.media!.group!.thumbnails.first;
115+
expect(mediaGroupThumbnail.url, 'http://www.foo.com/keyframe1.jpg');
116+
expect(mediaGroupThumbnail.width, '75');
117+
expect(mediaGroupThumbnail.height, '50');
118+
expect(mediaGroupThumbnail.time, '12:05:01.123');
119+
114120
expect(item.media!.contents.length, 2);
115121
final mediaContent = item.media!.contents.first;
116122
expect(mediaContent.url, 'http://www.foo.com/video.mov');

test/xml/Atom-Media.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<media:credit role="musician">band member 2</media:credit>
5151
<media:category>music/artist name/album/song</media:category>
5252
<media:rating>nonadult</media:rating>
53+
<media:thumbnail url="http://www.foo.com/keyframe1.jpg" width="75" height="50" time="12:05:01.123" />
5354
</media:group>
5455
<media:title type="plain">The Judy's -- The Moo Song</media:title>
5556
<media:description type="plain">This was some really bizarre band I listened to as a young lad.</media:description>

0 commit comments

Comments
 (0)