diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-15 18:13:49 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-15 18:13:49 +0200 |
commit | 21208ecc1c6223cdfd2dbfeaff3bcfad8d0b8937 (patch) | |
tree | 67f151d022fdcd71bf2ddc5fff8046a4d3a8bfa1 /src/html.c | |
parent | 9946c0363648b44d396b07d8a1a4557c568edc88 (diff) |
Add torrent complete notification
Diffstat (limited to 'src/html.c')
-rw-r--r-- | src/html.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -349,8 +349,13 @@ static int download_html_items_in_reverse(const char *plugin_filepath, Buffer *d download_items_end--; int download_item_index = 0; for(; download_items_it != download_items_end && download_item_index < MAX_UPDATE_ITEMS && is_program_running(); --download_items_it) { + char notify_msg[PATH_MAX]; + const char *path_components[] = { tracked_html->title, download_items_it->title }; + path_join(notify_msg, path_components, 2); + item_dir[item_dir_len] = '/'; strcpy(item_dir + item_dir_len + 1, download_items_it->title); + fprintf(stderr, "Starting download of html item: %s (title: %s)\n", download_items_it->link, notify_msg); if(create_directory_recursive(item_dir) != 0) { fprintf(stderr, "Failed to create directory for html item: %s\n", download_items_it->title); result = -1; @@ -363,9 +368,6 @@ static int download_html_items_in_reverse(const char *plugin_filepath, Buffer *d if(result != 0) fprintf(stderr, "Failed while downloading html, url: %s\n", download_items_it->link); - char notify_msg[PATH_MAX]; - const char *path_components[] = { tracked_html->title, download_items_it->title }; - path_join(notify_msg, path_components, 2); const char *notify_args[] = { "notify-send", "-u", result == 0 ? "normal" : "critical", "--", result == 0 ? "Download finished" : "Download failed", notify_msg, NULL }; program_exec(notify_args, NULL, NULL); |