annotate src/core/config.cc @ 327:b5d6c27c308f

anime: refactor Anime::SeriesSeason to Season class ToLocalString has also been altered to take in both season and year because lots of locales actually treat formatting seasons differently! most notably is Russian which adds a suffix at the end to notate seasons(??)
author Paper <paper@paper.us.eu.org>
date Thu, 13 Jun 2024 01:49:18 -0400
parents 1b5c04268d6a
children a7d4e5107531
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "core/config.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "core/anime.h"
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
3 #include "core/filesystem.h"
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include "core/json.h"
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
5 #include "core/strings.h"
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
6 #include "gui/translate/anime.h"
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
7 #include "gui/translate/config.h"
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
8
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
9 #include "animone/player.h"
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
10
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
11 #include <algorithm>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 #include <cstdlib>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 #include <cstring>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 #include <filesystem>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 #include <fstream>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 #include <limits.h>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
18 #include <toml11/toml.hpp>
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
19
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
20 #include <QFile>
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
21 #include <QTextStream>
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
22
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
23 #include <iostream>
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
24
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
25 /* NOTE: This config file is prone to breakage, as Minori is alpha software and
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
26 * as such nothing is constant. */
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
27
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 int Config::Load() {
135
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
29 std::filesystem::path cfg_path = Filesystem::GetConfigPath();
102
b315f3759c56 *: big patch
Paper <mrpapersonic@gmail.com>
parents: 101
diff changeset
30
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
31 std::ifstream ifs(cfg_path, std::ios_base::binary);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
32 if (!ifs.good())
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
33 return 0;
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
34
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
35 toml::value data;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
36
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
37 try {
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
38 data = toml::parse(ifs);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
39 } catch (const std::exception& ex) {
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
40 std::cerr << "config: failed to parse toml with error " << ex.what() << std::endl;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
41 return 0;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
42 }
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
43
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
44 service = Translate::ToService(toml::find_or(data, "General", "Service", "None"));
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
45 locale.RefreshAvailableLocales();
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
46 locale.SetActiveLocale(QLocale(Strings::ToQString(toml::find_or(data, "General", "Locale", "en_US"))));
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
47
183
01d259b9c89f pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents: 151
diff changeset
48
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
49 anime_list.score_format = Translate::ToScoreFormat(toml::find_or(data, "Anime List", "Score format", "100-point"));
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
50 anime_list.language = Translate::ToLanguage(toml::find_or(data, "Anime List", "Title language", "Romaji"));
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
51 anime_list.display_aired_episodes = toml::find_or(data, "Anime List", "Display only aired episodes", true);
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
52 anime_list.display_available_episodes = toml::find_or(data, "Anime List", "Display only available episodes in library", true);
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
53 anime_list.highlight_anime_if_available = toml::find_or(data, "Anime List", "Highlight anime if available", true);
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
54 anime_list.highlighted_anime_above_others =
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
55 (anime_list.highlight_anime_if_available)
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
56 ? toml::find_or(data, "Anime List", "Display highlighted anime above others", false)
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
57 : false;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
58
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
59 auth.anilist.auth_token = toml::find_or(data, "Authentication/AniList", "Auth Token", "");
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
60 auth.anilist.user_id = toml::find_or(data, "Authentication/AniList", "User ID", 0);
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
61
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
62 auth.kitsu.access_token = toml::find_or(data, "Authentication/Kitsu", "Access Token", "");
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
63 auth.kitsu.access_token_expiration = toml::find_or(data, "Authentication/Kitsu", "Access Token Expiration", static_cast<Time::Timestamp>(0));
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
64 auth.kitsu.refresh_token = toml::find_or(data, "Authentication/Kitsu", "Refresh Token", "");
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
65 auth.kitsu.user_id = toml::find_or(data, "Authentication/Kitsu", "User ID", "");
116
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents: 108
diff changeset
66
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
67 torrents.feed_link = toml::find_or(data, "Torrents", "RSS feed", "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0");
135
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
68
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
69 recognition.detect_media_players = toml::find_or(data, "Recognition", "Detect media players", true);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
70
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
71 {
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
72 QFile f(":/players.anisthesia");
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
73 if (!f.exists())
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
74 return false;
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
75
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
76 f.open(QFile::ReadOnly | QFile::Text);
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
77 QTextStream ts(&f);
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
78
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
79 std::vector<animone::Player> players;
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
80
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
81 if (!animone::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players))
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
82 return false;
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
83
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
84 recognition.players.reserve(players.size());
185
62e336597bb7 anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents: 183
diff changeset
85 for (const auto& player : players)
151
54744a48a7d7 last commit part 2: struct init with {} is valid syntax, actually
Paper <mrpapersonic@gmail.com>
parents: 150
diff changeset
86 recognition.players.push_back({true, player});
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
87 }
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
88
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
89 for (auto& [enabled, player] : recognition.players) {
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
90 switch (player.type) {
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
91 default:
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
92 case animone::PlayerType::Default:
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
93 enabled = toml::find_or(data, "Recognition/Players", player.name, true);
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
94 break;
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
95 case animone::PlayerType::WebBrowser:
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
96 enabled = toml::find_or(data, "Recognition/Browsers", player.name, true);
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
97 break;
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
98 }
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
99 }
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
100
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
101
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
102 theme.SetTheme(Translate::ToTheme(toml::find_or(data, "Appearance", "Theme", "Default")));
116
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents: 108
diff changeset
103
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
104 if (data.contains("Library") && data["Library"].contains("Folders")) {
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
105 const toml::value& folders = toml::find(data, "Library", "Folders");
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
106 std::vector<std::string> v = toml::get_or<std::vector<std::string>>(folders, {});
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
107 for (const auto& s : v)
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
108 if (!library.paths.count(s))
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
109 library.paths.insert(s);
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents: 224
diff changeset
110 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents: 224
diff changeset
111
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
112 library.real_time_monitor = toml::find_or(data, "Library", "Real-time monitor", true);
223
84e0a3c4737a library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents: 221
diff changeset
113
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114 return 0;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
115 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
116
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
117 int Config::Save() {
135
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
118 std::filesystem::path cfg_path = Filesystem::GetConfigPath();
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
119 Filesystem::CreateDirectories(cfg_path);
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
120
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
121 std::ofstream file(cfg_path);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
122 if (!file.good())
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
123 return 0;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
124
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
125 toml::value data;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
126
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
127 data["Library"]["Folders"] = library.paths;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
128 data["Library"]["Real-time monitor"] = library.real_time_monitor;
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
129
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
130 for (const auto& [enabled, player] : recognition.players) {
276
ec0a2b5493f8 ini: simplify INI code, use templates less
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
131 const std::string section = (player.type == animone::PlayerType::WebBrowser) ? "Recognition/Players" : "Recognition/Browsers";
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
132 data[section][player.name] = enabled;
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
133 }
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
134
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
135 data["Recognition"]["Detect media players"] = recognition.detect_media_players;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
136
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
137 data["Torrents"]["RSS feed"] = torrents.feed_link;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
138
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
139 data["Authentication/Kitsu"]["Access Token"] = auth.kitsu.access_token;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
140 data["Authentication/Kitsu"]["Access Token Expiration"] = auth.kitsu.access_token_expiration;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
141 data["Authentication/Kitsu"]["Refresh Token"] = auth.kitsu.refresh_token;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
142 data["Authentication/Kitsu"]["User ID"] = auth.kitsu.user_id;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
143
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
144 data["Authentication/AniList"]["Auth Token"] = auth.anilist.auth_token;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
145 data["Authentication/AniList"]["User ID"] = auth.anilist.user_id;
223
84e0a3c4737a library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents: 221
diff changeset
146
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
147 data["Anime List"]["Score format"] = Translate::ToString(anime_list.score_format);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
148 data["Anime List"]["Title language"] = Translate::ToString(anime_list.language);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
149 data["Anime List"]["Display only aired episodes"] = anime_list.display_aired_episodes;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
150 data["Anime List"]["Display only available episodes in library"] = anime_list.display_available_episodes;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
151 data["Anime List"]["Highlight anime if available"] = anime_list.highlight_anime_if_available;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
152 data["Anime List"]["Display highlighted anime above others"] = anime_list.highlighted_anime_above_others;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
153
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
154 data["Appearance"]["Theme"] = Translate::ToString(theme.GetTheme());
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
155
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
156 data["General"]["Service"] = Translate::ToString(service);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
157 data["General"]["Locale"] = Strings::ToUtf8String(locale.GetLocale().name());
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
158
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
159 file << std::setw(0) << data;
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
160
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161 return 0;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162 }