char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
const char *psz_name_org )
{
- int i_fuzzy;
+ int i_fuzzy = var_GetInteger( p_this, "sub-autodetect-fuzzy" );
+ if ( i_fuzzy == 0 )
+ return NULL;
int j, i_result2, i_sub_count, i_fname_len;
char *f_fname_noext = NULL, *f_fname_trim = NULL;
strcpy_strip_ext( f_fname_noext, f_fname );
strcpy_trim( f_fname_trim, f_fname_noext );
- i_fuzzy = var_GetInteger( p_this, "sub-autodetect-fuzzy" );
-
result = calloc( MAX_SUBTITLE_FILES+1, sizeof(vlc_subfn_t) ); /* We check it later (simplify code) */
subdirs = paths_to_list( f_dir, psz_path );
for( j = -1, i_sub_count = 0; (j == -1) || ( j >= 0 && subdirs != NULL && subdirs[j] != NULL ); j++ )
char tmp_fname_noext[strlen( psz_name ) + 1];
char tmp_fname_trim[strlen( psz_name ) + 1];
char tmp_fname_ext[strlen( psz_name ) + 1];
- char *tmp;
-
- int i_prio;
+ const char *tmp;
+ int i_prio = SUB_PRIORITY_NONE;
/* retrieve various parts of the filename */
strcpy_strip_ext( tmp_fname_noext, psz_name );
strcpy_get_ext( tmp_fname_ext, psz_name );
strcpy_trim( tmp_fname_trim, tmp_fname_noext );
- i_prio = SUB_PRIORITY_NONE;
- if( i_prio == SUB_PRIORITY_NONE && !strcmp( tmp_fname_trim, f_fname_trim ) )
+ if( !strcmp( tmp_fname_trim, f_fname_trim ) )
{
/* matches the movie name exactly */
i_prio = SUB_PRIORITY_MATCH_ALL;
}
- if( i_prio == SUB_PRIORITY_NONE &&
- ( tmp = strstr( tmp_fname_trim, f_fname_trim ) ) )
+ else if( (tmp = strstr( tmp_fname_trim, f_fname_trim )) )
{
/* contains the movie name */
tmp += strlen( f_fname_trim );
i_prio = SUB_PRIORITY_MATCH_LEFT;
}
}
- if( i_prio == SUB_PRIORITY_NONE &&
- j == 0 )
+ else if( j == -1 )
{
/* doesn't contain the movie name, prefer files in f_dir over subdirs */
i_prio = SUB_PRIORITY_MATCH_NONE;