Add QoL feed, download and quality improvements
This commit is contained in:
@@ -147,10 +147,24 @@ class DanbooruProvider implements ContentProvider, CommentProvider {
|
||||
}
|
||||
|
||||
List<String> _topTags(TopPeriodFilter period) {
|
||||
final now = DateTime.now();
|
||||
return switch (period) {
|
||||
TopPeriodFilter.none => const [],
|
||||
TopPeriodFilter.month || TopPeriodFilter.year => const ['order:rank'],
|
||||
TopPeriodFilter.month => [
|
||||
'order:score',
|
||||
'date:>${_date(now.subtract(const Duration(days: 31)))}',
|
||||
],
|
||||
TopPeriodFilter.year => [
|
||||
'order:score',
|
||||
'date:>${_date(DateTime(now.year - 1, now.month, now.day))}',
|
||||
],
|
||||
TopPeriodFilter.allTime => const ['order:score'],
|
||||
};
|
||||
}
|
||||
|
||||
String _date(DateTime value) {
|
||||
return '${value.year.toString().padLeft(4, '0')}-'
|
||||
'${value.month.toString().padLeft(2, '0')}-'
|
||||
'${value.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,13 +168,27 @@ class E621Provider
|
||||
}
|
||||
|
||||
List<String> _topTags(TopPeriodFilter period) {
|
||||
final now = DateTime.now();
|
||||
return switch (period) {
|
||||
TopPeriodFilter.none => const [],
|
||||
TopPeriodFilter.month => const ['order:rank'],
|
||||
TopPeriodFilter.year || TopPeriodFilter.allTime => const ['order:score'],
|
||||
TopPeriodFilter.month => [
|
||||
'order:score',
|
||||
'date:>${_date(now.subtract(const Duration(days: 31)))}',
|
||||
],
|
||||
TopPeriodFilter.year => [
|
||||
'order:score',
|
||||
'date:>${_date(DateTime(now.year - 1, now.month, now.day))}',
|
||||
],
|
||||
TopPeriodFilter.allTime => const ['order:score'],
|
||||
};
|
||||
}
|
||||
|
||||
String _date(DateTime value) {
|
||||
return '${value.year.toString().padLeft(4, '0')}-'
|
||||
'${value.month.toString().padLeft(2, '0')}-'
|
||||
'${value.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
int _int(dynamic value) {
|
||||
if (value is int) return value;
|
||||
if (value is num) return value.toInt();
|
||||
|
||||
@@ -140,10 +140,8 @@ class GelbooruProvider implements ContentProvider, CommentProvider {
|
||||
List<String> _topTags(TopPeriodFilter period) {
|
||||
return switch (period) {
|
||||
TopPeriodFilter.none => const [],
|
||||
TopPeriodFilter.month ||
|
||||
TopPeriodFilter.year ||
|
||||
TopPeriodFilter.allTime =>
|
||||
const ['sort:score:desc'],
|
||||
TopPeriodFilter.month || TopPeriodFilter.year => const [],
|
||||
TopPeriodFilter.allTime => const ['sort:score:desc'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -166,10 +166,8 @@ class MoebooruProvider
|
||||
List<String> _topTags(TopPeriodFilter period) {
|
||||
return switch (period) {
|
||||
TopPeriodFilter.none => const [],
|
||||
TopPeriodFilter.month ||
|
||||
TopPeriodFilter.year ||
|
||||
TopPeriodFilter.allTime =>
|
||||
const ['order:score'],
|
||||
TopPeriodFilter.month || TopPeriodFilter.year => const [],
|
||||
TopPeriodFilter.allTime => const ['order:score'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,8 @@ class Rule34Provider extends GelbooruProvider {
|
||||
}) async {
|
||||
final topTags = switch (topPeriod) {
|
||||
TopPeriodFilter.none => const <String>[],
|
||||
TopPeriodFilter.month ||
|
||||
TopPeriodFilter.year ||
|
||||
TopPeriodFilter.allTime =>
|
||||
const ['sort:score:desc'],
|
||||
TopPeriodFilter.month || TopPeriodFilter.year => const <String>[],
|
||||
TopPeriodFilter.allTime => const ['sort:score:desc'],
|
||||
};
|
||||
final response = await dio.get<dynamic>(
|
||||
'/index.php',
|
||||
|
||||
Reference in New Issue
Block a user