Start creating new history files for music/video/image

This commit is contained in:
twinaphex 2016-07-30 22:47:43 +02:00
parent f391c1b65d
commit 8b706ad805
6 changed files with 69 additions and 9 deletions

View File

@ -2102,23 +2102,74 @@ bool command_event(enum event_command cmd, void *data)
return false;
break;
case CMD_EVENT_HISTORY_DEINIT:
if (g_defaults.history)
if (g_defaults.content_history)
{
playlist_write_file(g_defaults.history);
playlist_free(g_defaults.history);
playlist_write_file(g_defaults.content_history);
playlist_free(g_defaults.content_history);
}
g_defaults.history = NULL;
g_defaults.content_history = NULL;
#ifdef HAVE_FFMPEG
if (g_defaults.video_history)
{
playlist_write_file(g_defaults.video_history);
playlist_free(g_defaults.video_history);
}
g_defaults.video_history = NULL;
if (g_defaults.music_history)
{
playlist_write_file(g_defaults.music_history);
playlist_free(g_defaults.music_history);
}
g_defaults.music_history = NULL;
#endif
#ifdef HAVE_IMAGEVIEWER
if (g_defaults.image_history)
{
playlist_write_file(g_defaults.image_history);
playlist_free(g_defaults.image_history);
}
g_defaults.image_history = NULL;
#endif
break;
case CMD_EVENT_HISTORY_INIT:
command_event(CMD_EVENT_HISTORY_DEINIT, NULL);
if (!settings->history_list_enable)
return false;
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->path.content_history);
g_defaults.history = playlist_init(
g_defaults.content_history = playlist_init(
settings->path.content_history,
settings->content_history_size);
#ifdef HAVE_FFMPEG
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->path.content_music_history);
g_defaults.music_history = playlist_init(
settings->path.content_music_history,
settings->content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->path.content_video_history);
g_defaults.video_history = playlist_init(
settings->path.content_video_history,
settings->content_history_size);
#endif
#ifdef HAVE_IMAGEVIEWER
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->path.content_image_history);
g_defaults.image_history = playlist_init(
settings->path.content_image_history,
settings->content_history_size);
#endif
break;
case CMD_EVENT_CORE_INFO_DEINIT:
core_info_deinit_list();

View File

@ -84,7 +84,14 @@ struct defaults
} settings;
#ifndef IS_SALAMANDER
playlist_t *history;
playlist_t *content_history;
#ifdef HAVE_IMAGEVIEWER
playlist_t *image_history;
#endif
#ifdef HAVE_FFMPEG
playlist_t *video_history;
playlist_t *music_history;
#endif
#endif
};

View File

@ -2844,6 +2844,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
switch (msg)
{
case MSG_LOADING_HISTORY_FILE:
return "Loading history file";
case MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED:
return "Ribbon (simplified)";
case MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON:

View File

@ -1011,7 +1011,7 @@ static int action_ok_playlist_entry(const char *path,
size_t selection;
menu_content_ctx_playlist_info_t playlist_info;
size_t selection_ptr = 0;
playlist_t *playlist = g_defaults.history;
playlist_t *playlist = g_defaults.content_history;
const char *entry_path = NULL;
const char *entry_label = NULL;
const char *core_path = NULL;

View File

@ -5476,7 +5476,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
if (settings->history_list_enable)
{
char path_playlist[PATH_MAX_LENGTH] = {0};
playlist_t *playlist = g_defaults.history;
playlist_t *playlist = g_defaults.content_history;
if (!playlist)
command_event(CMD_EVENT_HISTORY_INIT, NULL);

View File

@ -1667,7 +1667,7 @@ static bool task_load_content(content_ctx_info_t *content_info,
if (info && *tmp)
{
playlist_t *playlist_tmp = g_defaults.history;
playlist_t *playlist_tmp = g_defaults.content_history;
if (content_push_to_history_playlist(playlist_tmp, tmp, info, mode))
playlist_write_file(playlist_tmp);