| 804 | } |
| 805 | |
| 806 | void write_chapter_names(hb_dict_t *job_dict, const char *marker_file) |
| 807 | { |
| 808 | if (marker_file == NULL) |
| 809 | return; |
| 810 | |
| 811 | hb_csv_file_t * file = hb_open_csv_file(marker_file); |
| 812 | hb_csv_cell_t * cell; |
| 813 | int row = 0; |
| 814 | |
| 815 | if (file == NULL) |
| 816 | { |
| 817 | fprintf(stderr, "Cannot open chapter marker file, using defaults\n"); |
| 818 | return; |
| 819 | } |
| 820 | fprintf(stderr, "Reading chapter markers from file %s\n", marker_file); |
| 821 | |
| 822 | hb_value_array_t *chapter_array; |
| 823 | chapter_array = hb_dict_get(hb_dict_get(job_dict, "Destination"), |
| 824 | "ChapterList"); |
| 825 | |
| 826 | if (chapter_array == NULL) |
| 827 | return; |
| 828 | |
| 829 | /* Parse the cells */ |
| 830 | while (NULL != (cell = hb_read_next_cell(file))) |
| 831 | { |
| 832 | /* We have a chapter number */ |
| 833 | if (cell->cell_col == 0) |
| 834 | { |
| 835 | row = cell->cell_row; |
| 836 | } |
| 837 | |
| 838 | /* We have a chapter name */ |
| 839 | if (cell->cell_col == 1 && row == cell->cell_row) |
| 840 | { |
| 841 | /* If we have a valid chapter, add chapter entry */ |
| 842 | hb_dict_t *chapter_dict = hb_value_array_get(chapter_array, row); |
| 843 | if (chapter_dict != NULL) |
| 844 | { |
| 845 | hb_dict_set(chapter_dict, "Name", |
| 846 | hb_value_string(cell->cell_text)); |
| 847 | } |
| 848 | } |
| 849 | hb_dispose_cell( cell ); |
| 850 | } |
| 851 | hb_close_csv_file( file ); |
| 852 | } |
| 853 | |
| 854 | static void lang_list_remove(hb_value_array_t *list, const char *lang) |
| 855 | { |
no test coverage detected