[scan] Changes to commit 9a3cb3b7

* 'split_genre' -> 'only_first_genre' + changed description
* fix memleak on multiple genre tags
This commit is contained in:
ejurgensen 2022-12-29 20:04:43 +01:00
parent 0c43de9735
commit af07f9eeb4
3 changed files with 10 additions and 7 deletions

View File

@ -171,11 +171,11 @@ library {
# to trigger a rescan. # to trigger a rescan.
# filescan_disable = false # filescan_disable = false
# Should server use first genre found in metadata # Only use the first genre found in metadata
# Tracks may be tagged with multiple genres, such as 'Pop' and 'Rock'. # Some tracks have multiple genres semicolon-separated in the same tag,
# This option instructs the server to use only the first genre found # e.g. 'Pop;Rock'. If you don't want them listed like this, you can
# (ie 'Pop' in this case) when parsing genre # enable this option and only the first genre will be used (i.e. 'Pop').
# split_genre = false # only_first_genre = false
# Should metadata from m3u playlists, e.g. artist and title in EXTINF, # Should metadata from m3u playlists, e.g. artist and title in EXTINF,
# override the metadata we get from radio streams? # override the metadata we get from radio streams?

View File

@ -118,7 +118,7 @@ static cfg_opt_t sec_library[] =
CFG_BOOL("allow_modifying_stored_playlists", cfg_false, CFGF_NONE), CFG_BOOL("allow_modifying_stored_playlists", cfg_false, CFGF_NONE),
CFG_STR("default_playlist_directory", NULL, CFGF_NONE), CFG_STR("default_playlist_directory", NULL, CFGF_NONE),
CFG_BOOL("clear_queue_on_stop_disable", cfg_false, CFGF_NONE), CFG_BOOL("clear_queue_on_stop_disable", cfg_false, CFGF_NONE),
CFG_BOOL("split_genre", cfg_false, CFGF_NONE), CFG_BOOL("only_first_genre", cfg_false, CFGF_NONE),
CFG_END() CFG_END()
}; };

View File

@ -62,9 +62,12 @@ parse_genre(struct media_file_info *mfi, char *genre_string)
char **genre = (char**)((char *) mfi + mfi_offsetof(genre)); char **genre = (char**)((char *) mfi + mfi_offsetof(genre));
char *ptr; char *ptr;
if (*genre) // Previous genre tag exists
return 0;
*genre = strdup(genre_string); *genre = strdup(genre_string);
if (cfg_getbool(cfg_getsec(cfg, "library"), "split_genre")) if (cfg_getbool(cfg_getsec(cfg, "library"), "only_first_genre"))
{ {
ptr = strchr(*genre, ';'); ptr = strchr(*genre, ';');
if (ptr) if (ptr)