diff src/services/anilist.cc @ 183:01d259b9c89f

pages/torrents.cc: parse feed descriptions separately services/anilist.cc: use constexpr STL string_view for HTTP queries
author Paper <mrpapersonic@gmail.com>
date Mon, 04 Dec 2023 13:40:42 -0500
parents 9b10175be389
children 09492158bcc5
line wrap: on
line diff
--- a/src/services/anilist.cc	Mon Dec 04 13:19:54 2023 -0500
+++ b/src/services/anilist.cc	Mon Dec 04 13:40:42 2023 -0500
@@ -177,8 +177,8 @@
 		return 0;
 	}
 
-	/* NOTE: these should be in the qrc file */
-	const std::string query = "query ($id: Int) {\n"
+	/* NOTE: these really ought to be in the qrc file */
+	constexpr std::string_view query = "query ($id: Int) {\n"
 							  "  MediaListCollection (userId: $id, type: ANIME) {\n"
 							  "    lists {\n"
 							  "      name\n"
@@ -265,7 +265,7 @@
 	 * Date completedAt
 	 **/
 	Anime::Anime& anime = Anime::db.items[id];
-	const std::string query = "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, "
+	constexpr std::string_view query = "mutation ($media_id: Int, $progress: Int, $status: MediaListStatus, $score: Int, "
 							  "$notes: String, $start: FuzzyDateInput, $comp: FuzzyDateInput) {\n"
 							  "  SaveMediaListEntry (mediaId: $media_id, progress: $progress, status: $status, "
 							  "scoreRaw: $score, notes: $notes, startedAt: $start, completedAt: $comp) {\n"
@@ -313,7 +313,7 @@
 
 	account.SetAuthToken(Strings::ToUtf8String(token));
 
-	const std::string query = "query {\n"
+	constexpr std::string_view query = "query {\n"
 							  "  Viewer {\n"
 							  "    id\n"
 							  "    name\n"