| 79 | } |
| 80 | |
| 81 | static void |
| 82 | notify_done (gboolean final, gboolean success, int64_t idx, signal_user_data_t *ud) |
| 83 | { |
| 84 | if (!final) |
| 85 | { |
| 86 | if (success) n_succeeded += 1; |
| 87 | else n_failed += 1; |
| 88 | } |
| 89 | |
| 90 | GhbValue *queueDict, *jobDict, *destDict; |
| 91 | g_autofree char *title = NULL; |
| 92 | g_autofree char *body = NULL; |
| 93 | gboolean notify_item, notify_queue; |
| 94 | |
| 95 | notify_item = ghb_dict_get_bool(ud->prefs, "NotifyOnEncodeDone"); |
| 96 | notify_queue = ghb_dict_get_bool(ud->prefs, "NotifyOnQueueDone"); |
| 97 | |
| 98 | if (notify_queue && final) |
| 99 | { |
| 100 | const char *msg = ghb_dict_get_string(ud->prefs, "CustomNotificationMessage"); |
| 101 | if (msg && msg[0]) |
| 102 | { |
| 103 | title = g_strdup(msg); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | title = g_strdup(_("Put down that cocktail…")); |
| 108 | } |
| 109 | body = queue_complete_message(); |
| 110 | } |
| 111 | else if (notify_item && !final) |
| 112 | { |
| 113 | queueDict = ghb_array_get(ud->queue, idx); |
| 114 | jobDict = ghb_dict_get(queueDict, "Job"); |
| 115 | destDict = ghb_dict_get(jobDict, "Destination"); |
| 116 | body = item_complete_name(ghb_dict_get_string(destDict, "File")); |
| 117 | title = g_strdup(success ? _("Encode Complete") : _("Encode Failed")); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | return; |
| 122 | } |
| 123 | send_notification(title, body, "hb-done"); |
| 124 | } |
| 125 | |
| 126 | static void |
| 127 | notify_paused (GhbNotification type, int64_t value, signal_user_data_t *ud) |
no test coverage detected