1
0
mirror of https://github.com/stonega/tsacdop synced 2025-01-24 04:32:28 +01:00
tsacdop-podcast-app-android/lib/class/episodebrief.dart
stonegate 9d4bbc895a modified: .circleci/config.yml
modified:   lib/class/episodebrief.dart
	modified:   lib/class/podcast_group.dart
	deleted:    lib/class/podcastrss.dart
	deleted:    lib/class/podcastrss.g.dart
	deleted:    lib/class/podcasts.dart
	deleted:    lib/class/podcasts.g.dart
	modified:   lib/episodes/episodedetail.dart
	modified:   lib/home/appbar/about.dart
	modified:   lib/home/appbar/addpodcast.dart
	modified:   lib/home/appbar/popupmenu.dart
	modified:   lib/home/homescroll.dart
	modified:   lib/local_storage/sqflite_localpodcast.dart
	modified:   lib/main.dart
	modified:   lib/podcasts/podcastdetail.dart
	modified:   lib/podcasts/podcastgroup.dart
	modified:   lib/podcasts/podcastlist.dart
	modified:   lib/podcasts/podcastmanage.dart
	modified:   lib/util/episodegrid.dart
	modified:   lib/webfeed/domain/rss_itunes.dart
	modified:   pubspec.lock
	modified:   pubspec.yaml
2020-02-21 23:04:02 +08:00

42 lines
1.0 KiB
Dart

import 'package:intl/intl.dart';
class EpisodeBrief {
final String title;
String description;
final int pubDate;
final int enclosureLength;
final String enclosureUrl;
final String feedTitle;
final String primaryColor;
final int liked;
final String downloaded;
final int duration;
final int explicit;
final String imagePath;
EpisodeBrief(
this.title,
this.enclosureUrl,
this.enclosureLength,
this.pubDate,
this.feedTitle,
this.primaryColor,
this.liked,
this.downloaded,
this.duration,
this.explicit,
this.imagePath
);
String dateToString(){
DateTime date = DateTime.fromMillisecondsSinceEpoch(pubDate);
var diffrence = DateTime.now().difference(date);
if(diffrence.inHours < 24) {
return '${diffrence.inHours} hours ago';
} else if (diffrence.inDays < 7){
return '${diffrence.inDays} days ago';}
else {
return DateFormat.yMMMd().format( DateTime.fromMillisecondsSinceEpoch(pubDate));
}
}
}