config: add merge_media_dirs option
By default, if there are multiple media directories specified, there will be entries for each one in the root directory container. If there is only one media directory specified, then just its contents will be in the root container, to save one level of browsing. Setting this option changes the default behavior so that multiple media dirs will behave like a single media dir.
This commit is contained in:
parent
7c0739ad3f
commit
cce9a012b3
@ -717,6 +717,10 @@ init(int argc, char **argv)
|
||||
case MAX_CONNECTIONS:
|
||||
runtime_vars.max_connections = atoi(ary_options[i].value);
|
||||
break;
|
||||
case MERGE_MEDIA_DIRS:
|
||||
if (strtobool(ary_options[i].value))
|
||||
SETFLAG(MERGE_MEDIA_DIRS_MASK);
|
||||
break;
|
||||
default:
|
||||
DPRINTF(E_ERROR, L_GENERAL, "Unknown option in file %s\n",
|
||||
optionsfile);
|
||||
|
@ -17,6 +17,10 @@ port=8200
|
||||
# + "PV" for pictures and video (eg. media_dir=AV,/home/jmaggard/digital_camera)
|
||||
media_dir=/opt
|
||||
|
||||
# set this to merge all media_dir base contents into the root container
|
||||
# note: the default is no
|
||||
#merge_media_dirs=no
|
||||
|
||||
# set this if you want to customize the name that shows up on your clients
|
||||
#friendly_name=My DLNA Server
|
||||
|
||||
|
@ -63,7 +63,8 @@ static const struct {
|
||||
{ ROOT_CONTAINER, "root_container" },
|
||||
{ USER_ACCOUNT, "user" },
|
||||
{ FORCE_SORT_CRITERIA, "force_sort_criteria" },
|
||||
{ MAX_CONNECTIONS, "max_connections" }
|
||||
{ MAX_CONNECTIONS, "max_connections" },
|
||||
{ MERGE_MEDIA_DIRS, "merge_media_dirs" }
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -57,7 +57,8 @@ enum upnpconfigoptions {
|
||||
ROOT_CONTAINER, /* root ObjectID (instead of "0") */
|
||||
USER_ACCOUNT, /* user account to run as */
|
||||
FORCE_SORT_CRITERIA, /* force sorting by a given sort criteria */
|
||||
MAX_CONNECTIONS /* maximum number of simultaneous connections */
|
||||
MAX_CONNECTIONS, /* maximum number of simultaneous connections */
|
||||
MERGE_MEDIA_DIRS /* don't add an extra directory level when there are multiple media dirs */
|
||||
};
|
||||
|
||||
/* readoptionsfile()
|
||||
|
@ -832,7 +832,7 @@ start_scanner()
|
||||
strncpyt(path, media_path->path, sizeof(path));
|
||||
bname = basename(path);
|
||||
/* If there are multiple media locations, add a level to the ContentDirectory */
|
||||
if( media_dirs && media_dirs->next )
|
||||
if( !GETFLAG(MERGE_MEDIA_DIRS_MASK) && media_dirs->next )
|
||||
{
|
||||
int startID = get_next_available_id("OBJECTS", BROWSEDIR_ID);
|
||||
id = insert_directory(bname, path, BROWSEDIR_ID, "", startID);
|
||||
|
@ -189,6 +189,7 @@ extern uint32_t runtime_flags;
|
||||
#define DLNA_STRICT_MASK 0x0004
|
||||
#define NO_PLAYLIST_MASK 0x0008
|
||||
#define SYSTEMD_MASK 0x0010
|
||||
#define MERGE_MEDIA_DIRS_MASK 0x0020
|
||||
|
||||
#define SETFLAG(mask) runtime_flags |= mask
|
||||
#define GETFLAG(mask) (runtime_flags & mask)
|
||||
|
Loading…
x
Reference in New Issue
Block a user