From 88677dfb1151f3f5c7320dda5575c05aeb006c75 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 27 May 2016 12:24:42 +0900 Subject: [PATCH] fix subtitle auto-load for when filenames have 2 dots (or more) in file this fixes T3660 --- src/bin/video.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/bin/video.c b/src/bin/video.c index 6bda771..603361c 100644 --- a/src/bin/video.c +++ b/src/bin/video.c @@ -1021,8 +1021,9 @@ video_file_autosub_set(Evas_Object *obj, const char *file, const char *sub) int i; Eina_Bool found = EINA_FALSE; + // try last dont in filename first... strcpy(sub, file); - p = strchr(sub, '.'); + p = strrchr(sub, '.'); if (p) { for (i = 0; subtypes[i]; i++) @@ -1036,6 +1037,25 @@ video_file_autosub_set(Evas_Object *obj, const char *file, const char *sub) } } } + // now try first dot as a fallback. + if (!found) + { + strcpy(sub, file); + p = strchr(sub, '.'); + if (p) + { + for (i = 0; subtypes[i]; i++) + { + strcpy(p, subtypes[i]); + if (ecore_file_exists(sub)) + { + video_sub_file_set(obj, sub); + found = EINA_TRUE; + break; + } + } + } + } if (!found) video_sub_file_set(obj, NULL); } else video_sub_file_set(obj, sub);