| 338 | } |
| 339 | |
| 340 | static char * |
| 341 | subtitle_get_track_description(GhbValue *settings, GhbValue *subsettings) |
| 342 | { |
| 343 | GhbValue * import; |
| 344 | char *desc = NULL; |
| 345 | |
| 346 | import = ghb_dict_get(subsettings, "Import"); |
| 347 | if (import != NULL) |
| 348 | { |
| 349 | const gchar * format = "SRT"; |
| 350 | const gchar * filename, * code; |
| 351 | const gchar * lang; |
| 352 | int source = IMPORTSRT; |
| 353 | const iso639_lang_t * iso; |
| 354 | |
| 355 | format = ghb_dict_get_string(import, "Format"); |
| 356 | filename = ghb_dict_get_string(import, "Filename"); |
| 357 | lang = ghb_dict_get_string(import, "Language"); |
| 358 | code = ghb_dict_get_string(import, "Codeset"); |
| 359 | |
| 360 | if (format != NULL && !strcasecmp(format, "SSA")) |
| 361 | { |
| 362 | source = IMPORTSSA; |
| 363 | } |
| 364 | iso = lang_lookup(lang); |
| 365 | if (iso != NULL) |
| 366 | { |
| 367 | if (iso->native_name != NULL) |
| 368 | lang = iso->native_name; |
| 369 | else |
| 370 | lang = iso->eng_name; |
| 371 | } |
| 372 | |
| 373 | if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) |
| 374 | { |
| 375 | gchar *basename; |
| 376 | |
| 377 | basename = g_path_get_basename(filename); |
| 378 | if (source == IMPORTSRT) |
| 379 | { |
| 380 | desc = g_strdup_printf("%s (%s)(%s)(%s)", |
| 381 | lang, code, format, basename); |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | desc = g_strdup_printf("%s (%s)(%s)", lang, format, basename); |
| 386 | } |
| 387 | g_free(basename); |
| 388 | } |
| 389 | else |
| 390 | { |
| 391 | if (source == IMPORTSRT) |
| 392 | { |
| 393 | desc = g_strdup_printf("%s (%s)(%s)", lang, code, format); |
| 394 | } |
| 395 | else |
| 396 | { |
| 397 | desc = g_strdup_printf("%s (%s)", lang, format); |
no test coverage detected