Add Automatically Load Content To Playlist feature

This commit is contained in:
twinaphex 2017-11-27 06:47:08 +01:00
parent 03bd93d323
commit 9f83175182
24 changed files with 113 additions and 2 deletions

View File

@ -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;

View File

@ -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);

View File

@ -243,6 +243,8 @@ typedef struct settings
bool ssh_enable;
bool samba_enable;
bool bluetooth_enable;
bool automatically_add_content_to_playlist;
} bools;
struct

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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.")

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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),