Skip to content

Commit

Permalink
Start creating new history files for music/video/image
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jul 30, 2016
1 parent f391c1b commit 8b706ad
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 9 deletions.
61 changes: 56 additions & 5 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 8 additions & 1 deletion defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
2 changes: 2 additions & 0 deletions intl/msg_hash_us.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tasks/task_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8b706ad

Please sign in to comment.