@@ -29,7 +29,8 @@ class DanbooruHandler extends BooruHandler {
2929
3030 @override
3131 String validateTags (String tags) {
32- if (tags.toLowerCase ().contains ('rating:safe' )) {
32+ if (tags.toLowerCase ().contains ('rating:safe' ) &&
33+ booru.baseURL! .contains ('danbooru.donmai.us' )) {
3334 tags = tags.toLowerCase ().replaceAll ('rating:safe' , 'rating:general' );
3435 }
3536 return tags;
@@ -57,16 +58,25 @@ class DanbooruHandler extends BooruHandler {
5758 */
5859 if (current.containsKey ("file_url" )) {
5960 if ((current["file_url" ].length > 0 )) {
60- addTagsWithType (current['tag_string_general' ].toString ().split (" " ), TagType .none);
61- addTagsWithType (current['tag_string_character' ].toString ().split (" " ), TagType .character);
62- addTagsWithType (current['tag_string_copyright' ].toString ().split (" " ), TagType .copyright);
63- addTagsWithType (current['tag_string_artist' ].toString ().split (" " ), TagType .artist);
64- addTagsWithType (current['tag_string_meta' ].toString ().split (" " ), TagType .meta);
61+ addTagsWithType (
62+ current['tag_string_general' ].toString ().split (" " ), TagType .none);
63+ addTagsWithType (current['tag_string_character' ].toString ().split (" " ),
64+ TagType .character);
65+ addTagsWithType (current['tag_string_copyright' ].toString ().split (" " ),
66+ TagType .copyright);
67+ addTagsWithType (
68+ current['tag_string_artist' ].toString ().split (" " ), TagType .artist);
69+ addTagsWithType (
70+ current['tag_string_meta' ].toString ().split (" " ), TagType .meta);
6571
6672 final bool isZip = current['file_url' ].toString ().endsWith (".zip" );
67- final String ? dateStr = current['created_at' ]? .toString ().substring (0 , current['created_at' ]! .toString ().length - 6 );
73+ final String ? dateStr = current['created_at' ]
74+ ? .toString ()
75+ .substring (0 , current['created_at' ]! .toString ().length - 6 );
6876 BooruItem item = BooruItem (
69- fileURL: isZip ? current["large_file_url" ].toString () : current["file_url" ].toString (),
77+ fileURL: isZip
78+ ? current["large_file_url" ].toString ()
79+ : current["file_url" ].toString (),
7080 sampleURL: current["large_file_url" ].toString (),
7181 thumbnailURL: current["preview_file_url" ].toString (),
7282 tagsList: current["tag_string" ].toString ().split (" " ),
@@ -82,7 +92,8 @@ class DanbooruHandler extends BooruHandler {
8292 sources: [current["source" ].toString ()],
8393 md5String: current["md5" ].toString (),
8494 postDate: dateStr, // 2021-06-17T16:27:45.743-04:00
85- postDateFormat: "yyyy-MM-dd't'HH:mm:ss'.'SSSZ" , // when timezone support added: "yyyy-MM-dd't'HH:mm:ssZ",
95+ postDateFormat:
96+ "yyyy-MM-dd't'HH:mm:ss'.'SSSZ" , // when timezone support added: "yyyy-MM-dd't'HH:mm:ssZ",
8697 );
8798 return item;
8899 } else {
@@ -101,8 +112,10 @@ class DanbooruHandler extends BooruHandler {
101112 @override
102113 String makeURL (String tags) {
103114 // EXAMPLE: https://danbooru.donmai.us/posts.json?tags=rating:safe%20order:rank&limit=20&page=1
104- final String loginStr = booru.userID? .isNotEmpty == true ? "&login=${booru .userID }" : "" ;
105- final String apiKeyStr = booru.apiKey? .isNotEmpty == true ? "&api_key=${booru .apiKey }" : "" ;
115+ final String loginStr =
116+ booru.userID? .isNotEmpty == true ? "&login=${booru .userID }" : "" ;
117+ final String apiKeyStr =
118+ booru.apiKey? .isNotEmpty == true ? "&api_key=${booru .apiKey }" : "" ;
106119 return "${booru .baseURL }/posts.json?tags=$tags &limit=${limit .toString ()}&page=${pageNum .toString ()}$loginStr $apiKeyStr " ;
107120 }
108121
@@ -129,7 +142,8 @@ class DanbooruHandler extends BooruHandler {
129142
130143 @override
131144 String ? parseTagSuggestion (responseItem, int index) {
132- final String tagStr = (responseItem['antecedent' ] ?? responseItem['value' ])? .toString () ?? "" ;
145+ final String tagStr =
146+ (responseItem['antecedent' ] ?? responseItem['value' ])? .toString () ?? "" ;
133147 if (tagStr.isEmpty) return null ;
134148
135149 final String rawTagType = responseItem["category" ]? .toString () ?? "" ;
@@ -149,7 +163,9 @@ class DanbooruHandler extends BooruHandler {
149163
150164 @override
151165 CommentItem ? parseComment (responseItem, int index) {
152- final String ? dateStr = responseItem['created_at' ]? .toString ().substring (0 , responseItem['created_at' ]! .toString ().length - 6 );
166+ final String ? dateStr = responseItem['created_at' ]
167+ ? .toString ()
168+ .substring (0 , responseItem['created_at' ]! .toString ().length - 6 );
153169 return CommentItem (
154170 id: responseItem["id" ].toString (),
155171 title: responseItem["post_id" ].toString (),
0 commit comments