| 1075 | } |
| 1076 | |
| 1077 | void ghb_queue_update_live_stats (signal_user_data_t * ud, int index, |
| 1078 | ghb_instance_status_t * status) |
| 1079 | { |
| 1080 | int count = ghb_array_len(ud->queue); |
| 1081 | if (index < 0 || index >= count) |
| 1082 | { |
| 1083 | // invalid index |
| 1084 | return; |
| 1085 | } |
| 1086 | |
| 1087 | GtkListBox * lb; |
| 1088 | GtkListBoxRow * row; |
| 1089 | |
| 1090 | lb = GTK_LIST_BOX(ghb_builder_widget("queue_list")); |
| 1091 | row = gtk_list_box_get_selected_row(lb); |
| 1092 | if (row == NULL || index != gtk_list_box_row_get_index(row)) |
| 1093 | { |
| 1094 | return; |
| 1095 | } |
| 1096 | |
| 1097 | GhbValue * queueDict, * uiDict; |
| 1098 | queueDict = ghb_array_get(ud->queue, index); |
| 1099 | if (queueDict == NULL) // should never happen |
| 1100 | { |
| 1101 | return; |
| 1102 | } |
| 1103 | uiDict = ghb_dict_get(queueDict, "uiSettings"); |
| 1104 | if (uiDict == NULL) // should never happen |
| 1105 | { |
| 1106 | return; |
| 1107 | } |
| 1108 | |
| 1109 | GString * gstr = NULL; |
| 1110 | GtkLabel * label; |
| 1111 | struct tm * tm; |
| 1112 | char date[40] = ""; |
| 1113 | char * str; |
| 1114 | const char * pass = ""; |
| 1115 | const char * result = ""; |
| 1116 | time_t start, finish, paused, duration; |
| 1117 | |
| 1118 | start = ghb_dict_get_int(uiDict, "job_start_time"); |
| 1119 | finish = time(NULL); |
| 1120 | if (status->state & GHB_STATE_WORKING) |
| 1121 | { |
| 1122 | finish += status->eta_seconds; |
| 1123 | } |
| 1124 | paused = status->paused / 1000; |
| 1125 | if ((status->state & GHB_STATE_WORKING) && status->pass_count > 1) |
| 1126 | { |
| 1127 | label = GTK_LABEL(ghb_builder_widget("queue_stats_pass_label")); |
| 1128 | gtk_widget_set_visible(GTK_WIDGET(label), TRUE); |
| 1129 | label = GTK_LABEL(ghb_builder_widget("queue_stats_pass")); |
| 1130 | gtk_widget_set_visible(GTK_WIDGET(label), TRUE); |
| 1131 | switch (status->pass_id) |
| 1132 | { |
| 1133 | case HB_PASS_SUBTITLE: |
| 1134 | pass = _("Foreign Audio Search"); |
no test coverage detected