# HG changeset patch # User cboesch # Date 1296938742 0 # Node ID dfeea3d3b2d0a8377ea4856d4206d39f3e199bd3 # Parent 06b75ec1b9c9266aa235151b204344fbbbec8e8b Do not add .sub to text subtitles when they look like vobsub. This will avoid the annoying message "SUB: Could not determine file format" because of MicroDVD and VOBsub sharing the same extension. diff -r 06b75ec1b9c9 -r dfeea3d3b2d0 sub/subreader.c --- a/sub/subreader.c Sat Feb 05 20:38:02 2011 +0000 +++ b/sub/subreader.c Sat Feb 05 20:45:42 2011 +0000 @@ -1957,6 +1957,22 @@ strcpy_get_ext(tmp_fname_ext, de->d_name); strcpy_trim(tmp_fname_trim, tmp_fname_noext); + // If it's a .sub, check if there is a .idx with the same name. If + // there is one, it's certainly a vobsub so we skip it. + if (strcasecmp(tmp_fname_ext, "sub") == 0) { + char *idx, *idxname = strdup(de->d_name); + + strcpy(idxname + strlen(de->d_name) - sizeof("idx") + 1, "idx"); + idx = mp_dir_join(path, idxname); + free(idxname); + f = fopen(idx, "rt"); + free(idx); + if (f) { + fclose(f); + continue; + } + } + // does it end with a subtitle extension? found = 0; #ifdef CONFIG_ICONV