Skip to content

Commit 44b8022

Browse files
committed
- Added chapter/image URI progress numbers to console output
- Removed "Downloaded ... bytes" console messages
1 parent 6fd423e commit 44b8022

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

main.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ int main(int argc, char *argv[]) {
101101

102102
for (size_t i = 0; i < chapters_count; ++i) {
103103
const auto& chapter = chapters[i];
104-
std::cout << " " << chapter.name << " -> " << chapter.url << std::endl;
104+
std::cout << " [" << (i + 1) << "/" << chapters_count << "] " << chapter.name << " -> " << chapter.url << std::endl;
105105

106106
std::filesystem::path chapter_folder = manga_folder / Utils::sanitizeFolderName(chapter.name);
107107

@@ -120,11 +120,14 @@ int main(int argc, char *argv[]) {
120120
std::vector<std::string> image_uris = getChapterImageURIs(http_client, chapter.url);
121121

122122
if (image_uris.empty()) {
123-
std::cerr << "Error: Could not get image URIs for chapter: " << chapter.name << std::endl;
123+
std::cerr << " Error: Could not get image URIs for chapter: " << chapter.name << std::endl;
124124
return 1;
125125
}
126126

127-
for (const auto &image_uri: image_uris) {
127+
const std::size_t image_uris_count = image_uris.size();
128+
129+
for (size_t j = 0; j < image_uris_count; ++j) {
130+
const std::string &image_uri = image_uris[j];
128131
std::string image_filename = std::filesystem::path(image_uri).filename().string();
129132

130133
size_t queryPos = image_filename.find('?');
@@ -138,7 +141,7 @@ int main(int argc, char *argv[]) {
138141

139142
http_client.download_image(image_uri, image_path_string);
140143

141-
std::cout << " " << image_uri << " -> " << image_path_string << std::endl;
144+
std::cout << " [" << (j + 1) << "/" << image_uris_count << "] " << image_uri << " -> " << image_path_string << std::endl;
142145
}
143146

144147
if (i < chapters_count - 1) {
@@ -161,7 +164,7 @@ std::string getMangaTitle(HttpClient &http_client, const std::string &manga_uri)
161164
return {};
162165
}
163166

164-
std::cout << "Downloaded " << html_content.size() << " bytes" << std::endl;
167+
// std::cout << "Downloaded " << html_content.size() << " bytes" << std::endl;
165168

166169
// Parse HTML with lexbor
167170
lxb_html_document_t *document = lxb_html_document_create();
@@ -223,7 +226,7 @@ std::vector<Chapter> getChapters(HttpClient &http_client, const std::string &ser
223226
return {};
224227
}
225228

226-
std::cout << "Downloaded " << html_content.size() << " bytes" << std::endl;
229+
// std::cout << "Downloaded " << html_content.size() << " bytes" << std::endl;
227230

228231
// Parse chapter list HTML
229232
lxb_html_document_t *document = lxb_html_document_create();
@@ -260,7 +263,7 @@ std::vector<std::string> getChapterImageURIs(HttpClient &http_client, const std:
260263
return {};
261264
}
262265

263-
std::cout << "Downloaded " << html_content.size() << " bytes" << std::endl;
266+
// std::cout << "Downloaded " << html_content.size() << " bytes" << std::endl;
264267

265268
// Parse chapter images list HTML
266269
lxb_html_document_t *document = lxb_html_document_create();

0 commit comments

Comments
 (0)