mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
libvlc: add "extractor-flatten" option
Used to force extractors to flatten their file listing (done automatically by vlc_readdir_helper helper).
This commit is contained in:
parent
6c87f60107
commit
780bf2cf51
@ -425,6 +425,7 @@ struct vlc_readdir_helper
|
||||
size_t i_dirs;
|
||||
int i_sub_autodetect_fuzzy;
|
||||
bool b_show_hiddenfiles;
|
||||
bool b_flatten;
|
||||
char *psz_ignored_exts;
|
||||
};
|
||||
|
||||
|
@ -1686,6 +1686,7 @@ void vlc_readdir_helper_init(struct vlc_readdir_helper *p_rdh,
|
||||
bool b_autodetect = var_InheritBool(p_obj, "sub-autodetect-file");
|
||||
p_rdh->i_sub_autodetect_fuzzy = !b_autodetect ? 0 :
|
||||
var_InheritInteger(p_obj, "sub-autodetect-fuzzy");
|
||||
p_rdh->b_flatten = var_InheritBool(p_obj, "extractor-flatten");
|
||||
TAB_INIT(p_rdh->i_slaves, p_rdh->pp_slaves);
|
||||
TAB_INIT(p_rdh->i_dirs, p_rdh->pp_dirs);
|
||||
|
||||
@ -1728,13 +1729,22 @@ int vlc_readdir_helper_additem(struct vlc_readdir_helper *p_rdh,
|
||||
struct rdh_slave *p_rdh_slave = NULL;
|
||||
assert(psz_flatpath || psz_filename);
|
||||
|
||||
if (psz_filename == NULL)
|
||||
if (!p_rdh->b_flatten)
|
||||
{
|
||||
psz_filename = strrchr(psz_flatpath, '/');
|
||||
if (psz_filename != NULL)
|
||||
++psz_filename;
|
||||
else
|
||||
if (psz_filename == NULL)
|
||||
{
|
||||
psz_filename = strrchr(psz_flatpath, '/');
|
||||
if (psz_filename != NULL)
|
||||
++psz_filename;
|
||||
else
|
||||
psz_filename = psz_flatpath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (psz_filename == NULL)
|
||||
psz_filename = psz_flatpath;
|
||||
psz_flatpath = NULL;
|
||||
}
|
||||
|
||||
if (p_rdh->i_sub_autodetect_fuzzy != 0
|
||||
|
@ -1138,6 +1138,11 @@ static const char *const psz_recursive_list_text[] = {
|
||||
#define SHOW_HIDDENFILES_LONGTEXT N_( \
|
||||
"Ignore files starting with '.'" )
|
||||
|
||||
#define EXTRACTOR_FLATTEN_TEXT N_( \
|
||||
"Flatten files listed by extractors (archive)")
|
||||
#define EXTRACTOR_FLATTEN_LONGTEXT N_( \
|
||||
"The default behavior is to create one item per directory.")
|
||||
|
||||
#define SD_TEXT N_( "Services discovery modules")
|
||||
#define SD_LONGTEXT N_( \
|
||||
"Specifies the services discovery modules to preload, separated by " \
|
||||
@ -2099,6 +2104,8 @@ vlc_module_begin ()
|
||||
IGNORE_TEXT, IGNORE_LONGTEXT, false )
|
||||
add_bool( "show-hiddenfiles", false,
|
||||
SHOW_HIDDENFILES_TEXT, SHOW_HIDDENFILES_LONGTEXT, false )
|
||||
add_bool( "extractor-flatten", false,
|
||||
EXTRACTOR_FLATTEN_TEXT, EXTRACTOR_FLATTEN_LONGTEXT, true );
|
||||
|
||||
set_subcategory( SUBCAT_PLAYLIST_SD )
|
||||
add_string( "services-discovery", "", SD_TEXT, SD_LONGTEXT, true )
|
||||
|
Loading…
Reference in New Issue
Block a user