diff --git a/config.def.h b/config.def.h index cbbffb0ffb..c3fb49f6f6 100644 --- a/config.def.h +++ b/config.def.h @@ -293,6 +293,12 @@ static bool xmb_show_add = true; #endif #endif +#if defined(HAVE_LIBRETRODB) && !defined(RARCH_CONSOLE) +static bool automatically_add_content_to_playlist = true; +#else +static bool automatically_add_content_to_playlist = false; +#endif + static float menu_framebuffer_opacity = 0.900; static float menu_wallpaper_opacity = 0.300; diff --git a/configuration.c b/configuration.c index 7f2fa1fc91..14b8d82c0a 100644 --- a/configuration.c +++ b/configuration.c @@ -1114,6 +1114,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, unsigned count = 0; global_t *global = global_get_ptr(); + SETTING_BOOL("automatically_add_content_to_playlist", &settings->bools.automatically_add_content_to_playlist, true, automatically_add_content_to_playlist, false); SETTING_BOOL("ui_companion_start_on_boot", &settings->bools.ui_companion_start_on_boot, true, ui_companion_start_on_boot, false); SETTING_BOOL("ui_companion_enable", &settings->bools.ui_companion_enable, true, ui_companion_enable, false); SETTING_BOOL("video_gpu_record", &settings->bools.video_gpu_record, true, gpu_record, false); diff --git a/configuration.h b/configuration.h index 7dd74b9282..31dbeebff3 100644 --- a/configuration.h +++ b/configuration.h @@ -243,6 +243,8 @@ typedef struct settings bool ssh_enable; bool samba_enable; bool bluetooth_enable; + + bool automatically_add_content_to_playlist; } bools; struct diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index d9d5f633c1..63aa35cfb5 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3201,3 +3201,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 3074dc5f32..a5be0c3d3a 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3201,3 +3201,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index e5bf9687e8..9e03d9f147 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3311,3 +3311,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, "Blau-Anteil der Bildschirmmeldungen") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, "Zeige die aktuelle Anzahl an Einzelbildern an") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 3f16073e95..133ef8253d 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3064,3 +3064,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 1920e13ad8..d27634fae8 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3233,3 +3233,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 22232ed4f4..b403f7bffd 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3291,3 +3291,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password corretta.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password non corretta.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index ebae8a65ed..6ccf4feb78 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3243,3 +3243,7 @@ MSG_HASH(MSG_GAME_REMAP_FILE_LOADED, "ゲームの優先ファイルをロードしました。") MSG_HASH(MSG_CORE_REMAP_FILE_LOADED, "コアの優先ファイルをロードしました。") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 9a22edd4c8..86d3798887 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3196,3 +3196,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 32cd47b828..a097ee5c90 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1375,3 +1375,5 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_BLUE, "video_msg_color_blue") MSG_HASH(MENU_ENUM_LABEL_FRAMECOUNT_SHOW, "framecount_show") +MSG_HASH(MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "automatically_add_content_to_playlist") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index dcd21e2962..6040e5470e 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3064,3 +3064,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Wachtwoord correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Verkeerde wachtwoord.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 2603504428..21b574287b 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -4181,3 +4181,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 9e6cb8641d..757e1d4058 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3171,3 +3171,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 84aec3c7ba..5e11949ec3 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3254,3 +3254,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Пароль верен.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Пароль неверен.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index f877546905..c3ec369eb3 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3333,3 +3333,7 @@ MSG_HASH(MSG_GAME_REMAP_FILE_LOADED, "Game remap file loaded.") MSG_HASH(MSG_CORE_REMAP_FILE_LOADED, "Core remap file loaded.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index efea88ed20..41a38b6e28 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3225,3 +3225,7 @@ MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_OK, "Password correct.") MSG_HASH(MSG_INPUT_KIOSK_MODE_PASSWORD_NOK, "Password incorrect.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically add content to playlist") +MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + "Automatically scans loaded content so they appear inside playlists.") diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 95e5d0d0c6..876258f0f8 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1032,6 +1032,23 @@ static bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info return true; } +#ifdef HAVE_LIBRETRODB +void handle_dbscan_finished(void *task_data, void *user_data, const char *err); +#endif + +static void content_add_to_playlist(const char *path) +{ +#ifdef HAVE_LIBRETRODB + settings_t *settings = config_get_ptr(); + if (!settings || !settings->bools.automatically_add_content_to_playlist) + return; + task_push_dbscan( + settings->paths.directory_playlist, + settings->paths.path_content_database, + path, false, handle_dbscan_finished); +#endif +} + static int file_load_with_detect_core_wrapper( enum msg_hash_enums enum_label_idx, enum msg_hash_enums enum_idx, @@ -1118,6 +1135,7 @@ static int file_load_with_detect_core_wrapper( free(new_core_path); return -1; } + content_add_to_playlist(def_info.s); ret = 0; break; @@ -2372,9 +2390,10 @@ static int action_ok_file_load_detect_core(const char *path, if (!task_push_load_content_with_new_core_from_menu( path, detect_content_path, &content_info, - CORE_TYPE_FFMPEG, + CORE_TYPE_PLAIN, NULL, NULL)) return -1; + content_add_to_playlist(detect_content_path); return 0; } diff --git a/menu/cbs/menu_cbs_scan.c b/menu/cbs/menu_cbs_scan.c index 213b6b8ad1..8e0168fc86 100644 --- a/menu/cbs/menu_cbs_scan.c +++ b/menu/cbs/menu_cbs_scan.c @@ -37,7 +37,7 @@ #endif #ifdef HAVE_LIBRETRODB -static void handle_dbscan_finished(void *task_data, void *user_data, const char *err) +void handle_dbscan_finished(void *task_data, void *user_data, const char *err) { menu_ctx_environment_t menu_environ; menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 06170be390..2dd471d3cc 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -44,6 +44,7 @@ return 0; \ } +default_sublabel_macro(action_bind_sublabel_automatically_add_content_to_playlist, MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST) default_sublabel_macro(action_bind_sublabel_driver_settings_list, MENU_ENUM_SUBLABEL_DRIVER_SETTINGS) default_sublabel_macro(action_bind_sublabel_retro_achievements_settings_list, MENU_ENUM_SUBLABEL_RETRO_ACHIEVEMENTS_SETTINGS) default_sublabel_macro(action_bind_sublabel_saving_settings_list, MENU_ENUM_SUBLABEL_SAVING_SETTINGS) @@ -1376,6 +1377,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CORE_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_settings_list); break; + case MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_automatically_add_content_to_playlist); + break; case MENU_ENUM_LABEL_DRIVER_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_driver_settings_list); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 61d3ccc919..2fddc1669c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5304,6 +5304,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_FILTER_BY_CURRENT_CORE, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + PARSE_ONLY_BOOL, false); info->need_refresh = true; info->need_push = true; break; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 17e388340b..22e36c4b68 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -5985,6 +5985,23 @@ static bool setting_append_list( START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); +#ifdef HAVE_LIBRETRODB + CONFIG_BOOL( + list, list_info, + &settings->bools.automatically_add_content_to_playlist, + MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, + true, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); +#endif + CONFIG_BOOL( list, list_info, &settings->bools.multimedia_builtin_mediaplayer_enable, diff --git a/msg_hash.h b/msg_hash.h index 0cce4dfd36..daffdcfc92 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1023,6 +1023,7 @@ enum msg_hash_enums MENU_LABEL(INFORMATION), MENU_LABEL(INFORMATION_LIST), MENU_LABEL(USE_BUILTIN_PLAYER), + MENU_LABEL(AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST), MENU_LABEL(NETPLAY_SETTINGS), MENU_LABEL(CONTENT_SETTINGS), MENU_LABEL(LOAD_CONTENT_LIST),